mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 011858832762aaff245b2336fb1c38166e7a10fb (#4663)
This commit is contained in:
@@ -561,7 +561,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
test('Parameter Hints, back and forth', async () => {
|
||||
disposables.push(extHost.registerSignatureHelpProvider(nullExtensionDescription, defaultSelector, new class implements vscode.SignatureHelpProvider {
|
||||
provideSignatureHelp(_document, _position, _token, context: vscode.SignatureHelpContext): vscode.SignatureHelp {
|
||||
provideSignatureHelp(_document: vscode.TextDocument, _position: vscode.Position, _token: vscode.CancellationToken, context: vscode.SignatureHelpContext): vscode.SignatureHelp {
|
||||
return {
|
||||
activeSignature: 0,
|
||||
activeParameter: 1,
|
||||
|
||||
@@ -33,7 +33,7 @@ import { getWorkspaceSymbols } from 'vs/workbench/contrib/search/common/search';
|
||||
import { rename } from 'vs/editor/contrib/rename/rename';
|
||||
import { provideSignatureHelp } from 'vs/editor/contrib/parameterHints/provideSignatureHelp';
|
||||
import { provideSuggestionItems, CompletionOptions } from 'vs/editor/contrib/suggest/suggest';
|
||||
import { getDocumentFormattingEdits, getDocumentRangeFormattingEdits, getOnTypeFormattingEdits, FormatMode } from 'vs/editor/contrib/format/format';
|
||||
import { getDocumentFormattingEditsUntilResult, getDocumentRangeFormattingEditsUntilResult, getOnTypeFormattingEdits } from 'vs/editor/contrib/format/format';
|
||||
import { getLinks } from 'vs/editor/contrib/links/getLinks';
|
||||
import { MainContext, ExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostDiagnostics } from 'vs/workbench/api/node/extHostDiagnostics';
|
||||
@@ -46,10 +46,10 @@ import { getColors } from 'vs/editor/contrib/colorPicker/color';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { nullExtensionDescription as defaultExtension } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { provideSelectionRanges } from 'vs/editor/contrib/smartSelect/smartSelect';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { mock } from 'vs/workbench/test/electron-browser/api/mock';
|
||||
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
||||
import { dispose } from 'vs/base/common/lifecycle';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
const defaultSelector = { scheme: 'far' };
|
||||
const model: ITextModel = EditorModel.createFromString(
|
||||
@@ -906,8 +906,8 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
// --- format
|
||||
|
||||
const NullWorkerService = new class extends mock<IEditorWorkerService>() {
|
||||
computeMoreMinimalEdits(resource: URI, edits: modes.TextEdit[] | null | undefined): Promise<modes.TextEdit[] | null | undefined> {
|
||||
return Promise.resolve(edits);
|
||||
computeMoreMinimalEdits(resource: URI, edits: modes.TextEdit[] | null | undefined): Promise<modes.TextEdit[] | undefined> {
|
||||
return Promise.resolve(withNullAsUndefined(edits));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -919,7 +919,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = (await getDocumentFormattingEdits(NullTelemetryService, NullWorkerService, model, { insertSpaces: true, tabSize: 4 }, FormatMode.Auto, CancellationToken.None))!;
|
||||
let value = (await getDocumentFormattingEditsUntilResult(NullWorkerService, model, { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
assert.equal(value.length, 2);
|
||||
let [first, second] = value;
|
||||
assert.equal(first.text, 'testing');
|
||||
@@ -937,7 +937,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
return getDocumentFormattingEdits(NullTelemetryService, NullWorkerService, model, { insertSpaces: true, tabSize: 4 }, FormatMode.Auto, CancellationToken.None);
|
||||
return getDocumentFormattingEditsUntilResult(NullWorkerService, model, { insertSpaces: true, tabSize: 4 }, CancellationToken.None);
|
||||
});
|
||||
|
||||
test('Format Doc, order', async () => {
|
||||
@@ -961,7 +961,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = (await getDocumentFormattingEdits(NullTelemetryService, NullWorkerService, model, { insertSpaces: true, tabSize: 4 }, FormatMode.Auto, CancellationToken.None))!;
|
||||
let value = (await getDocumentFormattingEditsUntilResult(NullWorkerService, model, { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
assert.equal(value.length, 1);
|
||||
let [first] = value;
|
||||
assert.equal(first.text, 'testing');
|
||||
@@ -976,7 +976,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = (await getDocumentRangeFormattingEdits(NullTelemetryService, NullWorkerService, model, new EditorRange(1, 1, 1, 1), { insertSpaces: true, tabSize: 4 }, FormatMode.Auto, CancellationToken.None))!;
|
||||
const value = (await getDocumentRangeFormattingEditsUntilResult(NullWorkerService, model, new EditorRange(1, 1, 1, 1), { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
assert.equal(value.length, 1);
|
||||
const [first] = value;
|
||||
assert.equal(first.text, 'testing');
|
||||
@@ -1000,7 +1000,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}
|
||||
}));
|
||||
await rpcProtocol.sync();
|
||||
const value = (await getDocumentRangeFormattingEdits(NullTelemetryService, NullWorkerService, model, new EditorRange(1, 1, 1, 1), { insertSpaces: true, tabSize: 4 }, FormatMode.Auto, CancellationToken.None))!;
|
||||
const value = (await getDocumentRangeFormattingEditsUntilResult(NullWorkerService, model, new EditorRange(1, 1, 1, 1), { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
assert.equal(value.length, 1);
|
||||
const [first] = value;
|
||||
assert.equal(first.text, 'range2');
|
||||
@@ -1018,7 +1018,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
return getDocumentRangeFormattingEdits(NullTelemetryService, NullWorkerService, model, new EditorRange(1, 1, 1, 1), { insertSpaces: true, tabSize: 4 }, FormatMode.Auto, CancellationToken.None);
|
||||
return getDocumentRangeFormattingEditsUntilResult(NullWorkerService, model, new EditorRange(1, 1, 1, 1), { insertSpaces: true, tabSize: 4 }, CancellationToken.None);
|
||||
});
|
||||
|
||||
test('Format on Type, data conversion', async () => {
|
||||
@@ -1030,7 +1030,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}, [';']));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = (await getOnTypeFormattingEdits(NullTelemetryService, NullWorkerService, model, new EditorPosition(1, 1), ';', { insertSpaces: true, tabSize: 2 }))!;
|
||||
const value = (await getOnTypeFormattingEdits(NullWorkerService, model, new EditorPosition(1, 1), ';', { insertSpaces: true, tabSize: 2 }))!;
|
||||
assert.equal(value.length, 1);
|
||||
const [first] = value;
|
||||
assert.equal(first.text, ';');
|
||||
|
||||
@@ -90,7 +90,7 @@ suite('ExtHostMessageService', function () {
|
||||
suite('modal', () => {
|
||||
test('calls dialog service', async () => {
|
||||
const service = new MainThreadMessageService(null!, emptyNotificationService, emptyCommandService, new class extends mock<IDialogService>() {
|
||||
show(severity, message, buttons) {
|
||||
show(severity: Severity, message: string, buttons: string[]) {
|
||||
assert.equal(severity, 1);
|
||||
assert.equal(message, 'h');
|
||||
assert.equal(buttons.length, 2);
|
||||
@@ -105,7 +105,7 @@ suite('ExtHostMessageService', function () {
|
||||
|
||||
test('returns undefined when cancelled', async () => {
|
||||
const service = new MainThreadMessageService(null!, emptyNotificationService, emptyCommandService, new class extends mock<IDialogService>() {
|
||||
show(severity, message, buttons) {
|
||||
show() {
|
||||
return Promise.resolve(1);
|
||||
}
|
||||
} as IDialogService);
|
||||
@@ -116,7 +116,7 @@ suite('ExtHostMessageService', function () {
|
||||
|
||||
test('hides Cancel button when not needed', async () => {
|
||||
const service = new MainThreadMessageService(null!, emptyNotificationService, emptyCommandService, new class extends mock<IDialogService>() {
|
||||
show(severity, message, buttons) {
|
||||
show(severity: Severity, message: string, buttons: string[]) {
|
||||
assert.equal(buttons.length, 1);
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,9 @@ suite('ExtHostTreeView', function () {
|
||||
let target: RecordingShape;
|
||||
let onDidChangeTreeNode: Emitter<{ key: string } | undefined>;
|
||||
let onDidChangeTreeNodeWithId: Emitter<{ key: string }>;
|
||||
let tree, labels, nodes;
|
||||
let tree: object;
|
||||
let labels: object;
|
||||
let nodes: object;
|
||||
|
||||
setup(() => {
|
||||
tree = {
|
||||
@@ -582,7 +584,7 @@ suite('ExtHostTreeView', function () {
|
||||
});
|
||||
});
|
||||
|
||||
function loadCompleteTree(treeId, element?: string) {
|
||||
function loadCompleteTree(treeId: string, element?: string): Promise<null> {
|
||||
return testObject.$getChildren(treeId, element)
|
||||
.then(elements => elements.map(e => loadCompleteTree(treeId, e.handle)))
|
||||
.then(() => null);
|
||||
@@ -661,7 +663,7 @@ suite('ExtHostTreeView', function () {
|
||||
};
|
||||
}
|
||||
|
||||
function getTreeElement(element): any {
|
||||
function getTreeElement(element: string): any {
|
||||
let parent = tree;
|
||||
for (let i = 0; i < element.length; i++) {
|
||||
parent = parent[element.substring(0, i + 1)];
|
||||
|
||||
@@ -11,6 +11,7 @@ import { mock } from 'vs/workbench/test/electron-browser/api/mock';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
||||
import { TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol';
|
||||
import { TextEdit } from 'vs/editor/common/modes';
|
||||
|
||||
suite('MainThreadDocumentContentProviders', function () {
|
||||
|
||||
@@ -21,13 +22,13 @@ suite('MainThreadDocumentContentProviders', function () {
|
||||
|
||||
let providers = new MainThreadDocumentContentProviders(new TestRPCProtocol(), null!, null!,
|
||||
new class extends mock<IModelService>() {
|
||||
getModel(_uri) {
|
||||
getModel(_uri: URI) {
|
||||
assert.equal(uri.toString(), _uri.toString());
|
||||
return model;
|
||||
}
|
||||
},
|
||||
new class extends mock<IEditorWorkerService>() {
|
||||
computeMoreMinimalEdits(_uri, data) {
|
||||
computeMoreMinimalEdits(_uri: URI, data: TextEdit[] | undefined) {
|
||||
assert.equal(model.getValue(), '1');
|
||||
return Promise.resolve(data);
|
||||
}
|
||||
|
||||
@@ -97,15 +97,15 @@ suite.skip('TextSearch performance (integration)', () => {
|
||||
|
||||
telemetryService.events = [];
|
||||
|
||||
resolve(resultsFinishedEvent);
|
||||
resolve!(resultsFinishedEvent);
|
||||
} catch (e) {
|
||||
// Fail the runSearch() promise
|
||||
error(e);
|
||||
error!(e);
|
||||
}
|
||||
}
|
||||
|
||||
let resolve;
|
||||
let error;
|
||||
let resolve: (result: any) => void;
|
||||
let error: (error: Error) => void;
|
||||
return new Promise((_resolve, _error) => {
|
||||
resolve = _resolve;
|
||||
error = _error;
|
||||
@@ -122,9 +122,9 @@ suite.skip('TextSearch performance (integration)', () => {
|
||||
.then(() => {
|
||||
if (testWorkspaceArg) { // Don't measure by default
|
||||
let i = n;
|
||||
return (function iterate() {
|
||||
return (function iterate(): Promise<undefined> | undefined {
|
||||
if (!i--) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return runSearch()
|
||||
@@ -133,11 +133,12 @@ suite.skip('TextSearch performance (integration)', () => {
|
||||
finishedEvents.push(resultsFinishedEvent);
|
||||
return iterate();
|
||||
});
|
||||
})().then(() => {
|
||||
})()!.then(() => {
|
||||
const totalTime = finishedEvents.reduce((sum, e) => sum + e.data.duration, 0);
|
||||
console.log(`Avg duration: ${totalTime / n / 1000}s`);
|
||||
});
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user