mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 02:58:31 -05:00
Merge from vscode 011858832762aaff245b2336fb1c38166e7a10fb (#4663)
This commit is contained in:
@@ -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, ';');
|
||||
|
||||
Reference in New Issue
Block a user