mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 10:12:34 -05:00
Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)
* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 * Bump distro * Upgrade GCC to 4.9 due to yarn install errors * Update build image * Fix bootstrap base url * Bump distro * Fix build errors * Update source map file * Disable checkbox for blocking migration issues (#15131) * disable checkbox for blocking issues * wip * disable checkbox fixes * fix strings * Remove duplicate tsec command * Default to off for tab color if settings not present * re-skip failing tests * Fix mocha error * Bump sqlite version & fix notebooks search view * Turn off esbuild warnings * Update esbuild log level * Fix overflowactionbar tests * Fix ts-ignore in dropdown tests * cleanup/fixes * Fix hygiene * Bundle in entire zone.js module * Remove extra constructor param * bump distro for web compile break * bump distro for web compile break v2 * Undo log level change * New distro * Fix integration test scripts * remove the "no yarn.lock changes" workflow * fix scripts v2 * Update unit test scripts * Ensure ads-kerberos2 updates in .vscodeignore * Try fix unit tests * Upload crash reports * remove nogpu * always upload crashes * Use bash script * Consolidate data/ext dir names * Create in tmp directory Co-authored-by: chlafreniere <hichise@gmail.com> Co-authored-by: Christopher Suh <chsuh@microsoft.com> Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -35,20 +35,21 @@ import { NullApiDeprecationService } from 'vs/workbench/api/common/extHostApiDep
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { IResolvedTextEditorModel, ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
|
||||
import 'vs/editor/contrib/codeAction/codeAction';
|
||||
import 'vs/editor/contrib/codelens/codelens';
|
||||
import 'vs/editor/contrib/colorPicker/color';
|
||||
import 'vs/editor/contrib/format/format';
|
||||
import 'vs/editor/contrib/gotoSymbol/goToCommands';
|
||||
import 'vs/editor/contrib/gotoSymbol/documentSymbols';
|
||||
import 'vs/editor/contrib/documentSymbols/documentSymbols';
|
||||
import 'vs/editor/contrib/hover/getHover';
|
||||
import 'vs/editor/contrib/links/getLinks';
|
||||
import 'vs/editor/contrib/parameterHints/provideSignatureHelp';
|
||||
import 'vs/editor/contrib/smartSelect/smartSelect';
|
||||
import 'vs/editor/contrib/suggest/suggest';
|
||||
import 'vs/editor/contrib/rename/rename';
|
||||
import { IResolvedTextEditorModel, ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import 'vs/editor/contrib/inlineHints/inlineHintsController';
|
||||
|
||||
const defaultSelector = { scheme: 'far' };
|
||||
const model: ITextModel = createTextModel(
|
||||
@@ -200,11 +201,11 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
return commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeWorkspaceSymbolProvider', 'testing').then(value => {
|
||||
|
||||
for (let info of value) {
|
||||
assert.ok(info instanceof types.SymbolInformation);
|
||||
assert.equal(info.name, 'testing');
|
||||
assert.equal(info.kind, types.SymbolKind.Array);
|
||||
assert.strictEqual(info instanceof types.SymbolInformation, true);
|
||||
assert.strictEqual(info.name, 'testing');
|
||||
assert.strictEqual(info.kind, types.SymbolKind.Array);
|
||||
}
|
||||
assert.equal(value.length, 3);
|
||||
assert.strictEqual(value.length, 3);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -219,11 +220,11 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let symbols = await commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeWorkspaceSymbolProvider', '');
|
||||
assert.equal(symbols.length, 1);
|
||||
assert.strictEqual(symbols.length, 1);
|
||||
|
||||
await rpcProtocol.sync();
|
||||
symbols = await commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeWorkspaceSymbolProvider', '*');
|
||||
assert.equal(symbols.length, 1);
|
||||
assert.strictEqual(symbols.length, 1);
|
||||
});
|
||||
|
||||
// --- formatting
|
||||
@@ -237,7 +238,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let edits = await commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeFormatDocumentProvider', model.uri);
|
||||
assert.equal(edits.length, 1);
|
||||
assert.strictEqual(edits.length, 1);
|
||||
});
|
||||
|
||||
|
||||
@@ -256,10 +257,10 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
const edit = await commands.executeCommand<vscode.WorkspaceEdit>('vscode.executeDocumentRenameProvider', model.uri, new types.Position(0, 12), 'newNameOfThis');
|
||||
|
||||
assert.ok(edit);
|
||||
assert.equal(edit.has(model.uri), true);
|
||||
assert.strictEqual(edit.has(model.uri), true);
|
||||
const textEdits = edit.get(model.uri);
|
||||
assert.equal(textEdits.length, 1);
|
||||
assert.equal(textEdits[0].newText, 'newNameOfThis');
|
||||
assert.strictEqual(textEdits.length, 1);
|
||||
assert.strictEqual(textEdits[0].newText, 'newNameOfThis');
|
||||
});
|
||||
|
||||
// --- definition
|
||||
@@ -294,7 +295,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.Location[]>('vscode.executeDefinitionProvider', model.uri, new types.Position(0, 0)).then(values => {
|
||||
assert.equal(values.length, 4);
|
||||
assert.strictEqual(values.length, 4);
|
||||
for (let v of values) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
assert.ok(v.range instanceof types.Range);
|
||||
@@ -315,7 +316,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<(vscode.Location | vscode.LocationLink)[]>('vscode.executeDefinitionProvider', model.uri, new types.Position(0, 0)).then(values => {
|
||||
assert.equal(values.length, 2);
|
||||
assert.strictEqual(values.length, 2);
|
||||
for (let v of values) {
|
||||
if (isLocation(v)) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
@@ -352,7 +353,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.Location[]>('vscode.executeDeclarationProvider', model.uri, new types.Position(0, 0)).then(values => {
|
||||
assert.equal(values.length, 4);
|
||||
assert.strictEqual(values.length, 4);
|
||||
for (let v of values) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
assert.ok(v.range instanceof types.Range);
|
||||
@@ -373,7 +374,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<(vscode.Location | vscode.LocationLink)[]>('vscode.executeDeclarationProvider', model.uri, new types.Position(0, 0)).then(values => {
|
||||
assert.equal(values.length, 2);
|
||||
assert.strictEqual(values.length, 2);
|
||||
for (let v of values) {
|
||||
if (isLocation(v)) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
@@ -421,7 +422,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.Location[]>('vscode.executeTypeDefinitionProvider', model.uri, new types.Position(0, 0)).then(values => {
|
||||
assert.equal(values.length, 4);
|
||||
assert.strictEqual(values.length, 4);
|
||||
for (const v of values) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
assert.ok(v.range instanceof types.Range);
|
||||
@@ -442,7 +443,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<(vscode.Location | vscode.LocationLink)[]>('vscode.executeTypeDefinitionProvider', model.uri, new types.Position(0, 0)).then(values => {
|
||||
assert.equal(values.length, 2);
|
||||
assert.strictEqual(values.length, 2);
|
||||
for (let v of values) {
|
||||
if (isLocation(v)) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
@@ -490,7 +491,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.Location[]>('vscode.executeImplementationProvider', model.uri, new types.Position(0, 0)).then(values => {
|
||||
assert.equal(values.length, 4);
|
||||
assert.strictEqual(values.length, 4);
|
||||
for (const v of values) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
assert.ok(v.range instanceof types.Range);
|
||||
@@ -511,7 +512,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<(vscode.Location | vscode.LocationLink)[]>('vscode.executeImplementationProvider', model.uri, new types.Position(0, 0)).then(values => {
|
||||
assert.equal(values.length, 2);
|
||||
assert.strictEqual(values.length, 2);
|
||||
for (let v of values) {
|
||||
if (isLocation(v)) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
@@ -540,13 +541,13 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
}));
|
||||
|
||||
return commands.executeCommand<vscode.Location[]>('vscode.executeReferenceProvider', model.uri, new types.Position(0, 0)).then(values => {
|
||||
assert.equal(values.length, 1);
|
||||
assert.strictEqual(values.length, 1);
|
||||
let [first] = values;
|
||||
assert.equal(first.uri.toString(), 'some:uri/path');
|
||||
assert.equal(first.range.start.line, 0);
|
||||
assert.equal(first.range.start.character, 1);
|
||||
assert.equal(first.range.end.line, 0);
|
||||
assert.equal(first.range.end.character, 5);
|
||||
assert.strictEqual(first.uri.toString(), 'some:uri/path');
|
||||
assert.strictEqual(first.range.start.line, 0);
|
||||
assert.strictEqual(first.range.start.character, 1);
|
||||
assert.strictEqual(first.range.end.line, 0);
|
||||
assert.strictEqual(first.range.end.character, 5);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -564,12 +565,12 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeDocumentSymbolProvider', model.uri).then(values => {
|
||||
assert.equal(values.length, 2);
|
||||
assert.strictEqual(values.length, 2);
|
||||
let [first, second] = values;
|
||||
assert.ok(first instanceof types.SymbolInformation);
|
||||
assert.ok(second instanceof types.SymbolInformation);
|
||||
assert.equal(first.name, 'testing2');
|
||||
assert.equal(second.name, 'testing1');
|
||||
assert.strictEqual(first instanceof types.SymbolInformation, true);
|
||||
assert.strictEqual(second instanceof types.SymbolInformation, true);
|
||||
assert.strictEqual(first.name, 'testing2');
|
||||
assert.strictEqual(second.name, 'testing1');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -592,14 +593,14 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<(vscode.SymbolInformation & vscode.DocumentSymbol)[]>('vscode.executeDocumentSymbolProvider', model.uri).then(values => {
|
||||
assert.equal(values.length, 2);
|
||||
assert.strictEqual(values.length, 2);
|
||||
let [first, second] = values;
|
||||
assert.ok(first instanceof types.SymbolInformation);
|
||||
assert.ok(!(first instanceof types.DocumentSymbol));
|
||||
assert.ok(second instanceof types.SymbolInformation);
|
||||
assert.equal(first.name, 'DocumentSymbol');
|
||||
assert.equal(first.children.length, 1);
|
||||
assert.equal(second.name, 'SymbolInformation');
|
||||
assert.strictEqual(first instanceof types.SymbolInformation, true);
|
||||
assert.strictEqual(first instanceof types.DocumentSymbol, false);
|
||||
assert.strictEqual(second instanceof types.SymbolInformation, true);
|
||||
assert.strictEqual(first.name, 'DocumentSymbol');
|
||||
assert.strictEqual(first.children.length, 1);
|
||||
assert.strictEqual(second.name, 'SymbolInformation');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -629,37 +630,37 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
assert.ok(list instanceof types.CompletionList);
|
||||
let values = list.items;
|
||||
assert.ok(Array.isArray(values));
|
||||
assert.equal(values.length, 4);
|
||||
assert.strictEqual(values.length, 4);
|
||||
let [first, second, third, fourth] = values;
|
||||
assert.equal(first.label, 'item1');
|
||||
assert.equal(first.textEdit, undefined);// no text edit, default ranges
|
||||
assert.strictEqual(first.label, 'item1');
|
||||
assert.strictEqual(first.textEdit, undefined);// no text edit, default ranges
|
||||
assert.ok(!types.Range.isRange(first.range));
|
||||
|
||||
assert.equal(second.label, 'item2');
|
||||
assert.equal(second.textEdit!.newText, 'foo');
|
||||
assert.equal(second.textEdit!.range.start.line, 0);
|
||||
assert.equal(second.textEdit!.range.start.character, 4);
|
||||
assert.equal(second.textEdit!.range.end.line, 0);
|
||||
assert.equal(second.textEdit!.range.end.character, 8);
|
||||
assert.strictEqual(second.label, 'item2');
|
||||
assert.strictEqual(second.textEdit!.newText, 'foo');
|
||||
assert.strictEqual(second.textEdit!.range.start.line, 0);
|
||||
assert.strictEqual(second.textEdit!.range.start.character, 4);
|
||||
assert.strictEqual(second.textEdit!.range.end.line, 0);
|
||||
assert.strictEqual(second.textEdit!.range.end.character, 8);
|
||||
|
||||
assert.equal(third.label, 'item3');
|
||||
assert.equal(third.textEdit!.newText, 'foobar');
|
||||
assert.equal(third.textEdit!.range.start.line, 0);
|
||||
assert.equal(third.textEdit!.range.start.character, 1);
|
||||
assert.equal(third.textEdit!.range.end.line, 0);
|
||||
assert.equal(third.textEdit!.range.end.character, 6);
|
||||
assert.strictEqual(third.label, 'item3');
|
||||
assert.strictEqual(third.textEdit!.newText, 'foobar');
|
||||
assert.strictEqual(third.textEdit!.range.start.line, 0);
|
||||
assert.strictEqual(third.textEdit!.range.start.character, 1);
|
||||
assert.strictEqual(third.textEdit!.range.end.line, 0);
|
||||
assert.strictEqual(third.textEdit!.range.end.character, 6);
|
||||
|
||||
assert.equal(fourth.label, 'item4');
|
||||
assert.equal(fourth.textEdit, undefined);
|
||||
assert.strictEqual(fourth.label, 'item4');
|
||||
assert.strictEqual(fourth.textEdit, undefined);
|
||||
|
||||
const range: any = fourth.range!;
|
||||
assert.ok(types.Range.isRange(range));
|
||||
assert.equal(range.start.line, 0);
|
||||
assert.equal(range.start.character, 1);
|
||||
assert.equal(range.end.line, 0);
|
||||
assert.equal(range.end.character, 4);
|
||||
assert.strictEqual(range.start.line, 0);
|
||||
assert.strictEqual(range.start.character, 1);
|
||||
assert.strictEqual(range.end.line, 0);
|
||||
assert.strictEqual(range.end.character, 4);
|
||||
assert.ok(fourth.insertText instanceof types.SnippetString);
|
||||
assert.equal((<types.SnippetString>fourth.insertText).value, 'foo$0bar');
|
||||
assert.strictEqual((<types.SnippetString>fourth.insertText).value, 'foo$0bar');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -676,7 +677,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.CompletionList>('vscode.executeCompletionItemProvider', model.uri, new types.Position(0, 4)).then(list => {
|
||||
assert.ok(list instanceof types.CompletionList);
|
||||
assert.equal(list.isIncomplete, true);
|
||||
assert.strictEqual(list.isIncomplete, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -710,7 +711,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
);
|
||||
|
||||
assert.ok(list instanceof types.CompletionList);
|
||||
assert.equal(resolveCount, 2);
|
||||
assert.strictEqual(resolveCount, 2);
|
||||
|
||||
});
|
||||
|
||||
@@ -737,13 +738,13 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
);
|
||||
|
||||
assert.ok(list instanceof types.CompletionList);
|
||||
assert.equal(list.items.length, 4);
|
||||
assert.strictEqual(list.items.length, 4);
|
||||
|
||||
let [a, b, c, d] = list.items;
|
||||
assert.equal(a.preselect, true);
|
||||
assert.equal(b.preselect, undefined);
|
||||
assert.equal(c.preselect, true);
|
||||
assert.equal(d.preselect, undefined);
|
||||
assert.strictEqual(a.preselect, true);
|
||||
assert.strictEqual(b.preselect, undefined);
|
||||
assert.strictEqual(c.preselect, true);
|
||||
assert.strictEqual(d.preselect, undefined);
|
||||
});
|
||||
|
||||
test('executeCompletionItemProvider doesn\'t capture commitCharacters #58228', async function () {
|
||||
@@ -766,11 +767,11 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
);
|
||||
|
||||
assert.ok(list instanceof types.CompletionList);
|
||||
assert.equal(list.items.length, 2);
|
||||
assert.strictEqual(list.items.length, 2);
|
||||
|
||||
let [a, b] = list.items;
|
||||
assert.deepEqual(a.commitCharacters, ['a', 'b']);
|
||||
assert.equal(b.commitCharacters, undefined);
|
||||
assert.deepStrictEqual(a.commitCharacters, ['a', 'b']);
|
||||
assert.strictEqual(b.commitCharacters, undefined);
|
||||
});
|
||||
|
||||
test('vscode.executeCompletionItemProvider returns the wrong CompletionItemKinds in insiders #95715', async function () {
|
||||
@@ -793,11 +794,11 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
);
|
||||
|
||||
assert.ok(list instanceof types.CompletionList);
|
||||
assert.equal(list.items.length, 2);
|
||||
assert.strictEqual(list.items.length, 2);
|
||||
|
||||
const [a, b] = list.items;
|
||||
assert.equal(a.kind, types.CompletionItemKind.Method);
|
||||
assert.equal(b.kind, types.CompletionItemKind.Property);
|
||||
assert.strictEqual(a.kind, types.CompletionItemKind.Method);
|
||||
assert.strictEqual(b.kind, types.CompletionItemKind.Property);
|
||||
});
|
||||
|
||||
// --- signatureHelp
|
||||
@@ -840,11 +841,11 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.Command[]>('vscode.executeCodeActionProvider', model.uri, new types.Range(0, 0, 1, 1)).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
assert.equal(first.title, 'Title');
|
||||
assert.equal(first.command, 'testing');
|
||||
assert.deepEqual(first.arguments, [1, 2, true]);
|
||||
assert.strictEqual(first.title, 'Title');
|
||||
assert.strictEqual(first.command, 'testing');
|
||||
assert.deepStrictEqual(first.arguments, [1, 2, true]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -866,13 +867,13 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.CodeAction[]>('vscode.executeCodeActionProvider', model.uri, new types.Range(0, 0, 1, 1)).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [first] = value;
|
||||
assert.ok(first.command);
|
||||
assert.equal(first.command!.command, 'command');
|
||||
assert.equal(first.command!.title, 'command_title');
|
||||
assert.equal(first.kind!.value, 'foo');
|
||||
assert.equal(first.title, 'title');
|
||||
assert.strictEqual(first.command!.command, 'command');
|
||||
assert.strictEqual(first.command!.title, 'command_title');
|
||||
assert.strictEqual(first.kind!.value, 'foo');
|
||||
assert.strictEqual(first.title, 'title');
|
||||
|
||||
});
|
||||
});
|
||||
@@ -897,7 +898,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.CodeAction[]>('vscode.executeCodeActionProvider', model.uri, selection).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [first] = value;
|
||||
assert.ok(first.command);
|
||||
assert.ok(first.command!.arguments![1] instanceof types.Selection);
|
||||
@@ -926,9 +927,9 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.CodeAction[]>('vscode.executeCodeActionProvider', model.uri, selection).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [first] = value;
|
||||
assert.equal(first.isPreferred, true);
|
||||
assert.strictEqual(first.isPreferred, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -957,11 +958,11 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
await rpcProtocol.sync();
|
||||
|
||||
const value = await commands.executeCommand<vscode.CodeAction[]>('vscode.executeCodeActionProvider', model.uri, selection, undefined, 1000);
|
||||
assert.equal(didCallResolve, 1);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(didCallResolve, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
|
||||
const [first] = value;
|
||||
assert.equal(first.title, 'title'); // does NOT change
|
||||
assert.strictEqual(first.title, 'title'); // does NOT change
|
||||
assert.ok(first.edit); // is set
|
||||
});
|
||||
|
||||
@@ -983,14 +984,14 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.CodeLens[]>('vscode.executeCodeLensProvider', model.uri).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [first] = value;
|
||||
|
||||
assert.equal(first.command!.title, 'Title');
|
||||
assert.equal(first.command!.command, 'cmd');
|
||||
assert.equal(first.command!.arguments![0], 1);
|
||||
assert.equal(first.command!.arguments![1], true);
|
||||
assert.equal(first.command!.arguments![2], complexArg);
|
||||
assert.strictEqual(first.command!.title, 'Title');
|
||||
assert.strictEqual(first.command!.command, 'cmd');
|
||||
assert.strictEqual(first.command!.arguments![0], 1);
|
||||
assert.strictEqual(first.command!.arguments![1], true);
|
||||
assert.strictEqual(first.command!.arguments![2], complexArg);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1019,14 +1020,14 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
let value = await commands.executeCommand<vscode.CodeLens[]>('vscode.executeCodeLensProvider', model.uri, 2);
|
||||
|
||||
assert.equal(value.length, 3); // the resolve argument defines the number of results being returned
|
||||
assert.equal(resolveCount, 2);
|
||||
assert.strictEqual(value.length, 3); // the resolve argument defines the number of results being returned
|
||||
assert.strictEqual(resolveCount, 2);
|
||||
|
||||
resolveCount = 0;
|
||||
value = await commands.executeCommand<vscode.CodeLens[]>('vscode.executeCodeLensProvider', model.uri);
|
||||
|
||||
assert.equal(value.length, 4);
|
||||
assert.equal(resolveCount, 0);
|
||||
assert.strictEqual(value.length, 4);
|
||||
assert.strictEqual(resolveCount, 0);
|
||||
});
|
||||
|
||||
test('Links, back and forth', function () {
|
||||
@@ -1039,14 +1040,14 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.DocumentLink[]>('vscode.executeLinkProvider', model.uri).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
|
||||
assert.equal(first.target + '', 'foo:bar');
|
||||
assert.equal(first.range.start.line, 0);
|
||||
assert.equal(first.range.start.character, 0);
|
||||
assert.equal(first.range.end.line, 0);
|
||||
assert.equal(first.range.end.character, 20);
|
||||
assert.strictEqual(first.target + '', 'foo:bar');
|
||||
assert.strictEqual(first.range.start.line, 0);
|
||||
assert.strictEqual(first.range.start.character, 0);
|
||||
assert.strictEqual(first.range.end.line, 0);
|
||||
assert.strictEqual(first.range.end.character, 20);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1065,12 +1066,12 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
await rpcProtocol.sync();
|
||||
|
||||
const links1 = await commands.executeCommand<vscode.DocumentLink[]>('vscode.executeLinkProvider', model.uri);
|
||||
assert.equal(links1.length, 1);
|
||||
assert.equal(links1[0].target, undefined);
|
||||
assert.strictEqual(links1.length, 1);
|
||||
assert.strictEqual(links1[0].target, undefined);
|
||||
|
||||
const links2 = await commands.executeCommand<vscode.DocumentLink[]>('vscode.executeLinkProvider', model.uri, 1000);
|
||||
assert.equal(links2.length, 1);
|
||||
assert.equal(links2[0].target!.toString(), URI.parse('foo:bar').toString());
|
||||
assert.strictEqual(links2.length, 1);
|
||||
assert.strictEqual(links2[0].target!.toString(), URI.parse('foo:bar').toString());
|
||||
|
||||
});
|
||||
|
||||
@@ -1091,36 +1092,36 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.ColorInformation[]>('vscode.executeDocumentColorProvider', model.uri).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
|
||||
assert.equal(first.color.red, 0.1);
|
||||
assert.equal(first.color.green, 0.2);
|
||||
assert.equal(first.color.blue, 0.3);
|
||||
assert.equal(first.color.alpha, 0.4);
|
||||
assert.equal(first.range.start.line, 0);
|
||||
assert.equal(first.range.start.character, 0);
|
||||
assert.equal(first.range.end.line, 0);
|
||||
assert.equal(first.range.end.character, 20);
|
||||
assert.strictEqual(first.color.red, 0.1);
|
||||
assert.strictEqual(first.color.green, 0.2);
|
||||
assert.strictEqual(first.color.blue, 0.3);
|
||||
assert.strictEqual(first.color.alpha, 0.4);
|
||||
assert.strictEqual(first.range.start.line, 0);
|
||||
assert.strictEqual(first.range.start.character, 0);
|
||||
assert.strictEqual(first.range.end.line, 0);
|
||||
assert.strictEqual(first.range.end.character, 20);
|
||||
});
|
||||
}).then(() => {
|
||||
const color = new types.Color(0.5, 0.6, 0.7, 0.8);
|
||||
const range = new types.Range(0, 0, 0, 20);
|
||||
return commands.executeCommand<vscode.ColorPresentation[]>('vscode.executeColorPresentationProvider', color, { uri: model.uri, range }).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
|
||||
assert.equal(first.label, '#ABC');
|
||||
assert.equal(first.textEdit!.newText, '#ABC');
|
||||
assert.equal(first.textEdit!.range.start.line, 1);
|
||||
assert.equal(first.textEdit!.range.start.character, 0);
|
||||
assert.equal(first.textEdit!.range.end.line, 1);
|
||||
assert.equal(first.textEdit!.range.end.character, 20);
|
||||
assert.equal(first.additionalTextEdits!.length, 1);
|
||||
assert.equal(first.additionalTextEdits![0].range.start.line, 2);
|
||||
assert.equal(first.additionalTextEdits![0].range.start.character, 20);
|
||||
assert.equal(first.additionalTextEdits![0].range.end.line, 2);
|
||||
assert.equal(first.additionalTextEdits![0].range.end.character, 20);
|
||||
assert.strictEqual(first.label, '#ABC');
|
||||
assert.strictEqual(first.textEdit!.newText, '#ABC');
|
||||
assert.strictEqual(first.textEdit!.range.start.line, 1);
|
||||
assert.strictEqual(first.textEdit!.range.start.character, 0);
|
||||
assert.strictEqual(first.textEdit!.range.end.line, 1);
|
||||
assert.strictEqual(first.textEdit!.range.end.character, 20);
|
||||
assert.strictEqual(first.additionalTextEdits!.length, 1);
|
||||
assert.strictEqual(first.additionalTextEdits![0].range.start.line, 2);
|
||||
assert.strictEqual(first.additionalTextEdits![0].range.start.character, 20);
|
||||
assert.strictEqual(first.additionalTextEdits![0].range.end.line, 2);
|
||||
assert.strictEqual(first.additionalTextEdits![0].range.end.character, 20);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1135,12 +1136,93 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.Hover[]>('vscode.executeHoverProvider', model.uri, new types.Position(1, 1)).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.equal(value[0].contents.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
assert.strictEqual(value[0].contents.length, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// --- inline hints
|
||||
|
||||
test('Inline Hints, back and forth', async function () {
|
||||
disposables.push(extHost.registerInlineHintsProvider(nullExtensionDescription, defaultSelector, <vscode.InlineHintsProvider>{
|
||||
provideInlineHints() {
|
||||
return [new types.InlineHint('Foo', new types.Range(0, 1, 2, 3), undefined, true, false)];
|
||||
}
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
|
||||
const value = await commands.executeCommand<vscode.InlineHint[]>('vscode.executeInlineHintProvider', model.uri, new types.Range(0, 0, 20, 20));
|
||||
assert.strictEqual(value.length, 1);
|
||||
|
||||
const [first] = value;
|
||||
assert.strictEqual(first.text, 'Foo');
|
||||
assert.strictEqual(first.range.start.line, 0);
|
||||
assert.strictEqual(first.range.start.character, 1);
|
||||
assert.strictEqual(first.range.end.line, 2);
|
||||
assert.strictEqual(first.range.end.character, 3);
|
||||
});
|
||||
|
||||
test('Inline Hints, merge', async function () {
|
||||
disposables.push(extHost.registerInlineHintsProvider(nullExtensionDescription, defaultSelector, <vscode.InlineHintsProvider>{
|
||||
provideInlineHints() {
|
||||
return [new types.InlineHint('Bar', new types.Range(10, 11, 12, 13), undefined, true, false)];
|
||||
}
|
||||
}));
|
||||
|
||||
disposables.push(extHost.registerInlineHintsProvider(nullExtensionDescription, defaultSelector, <vscode.InlineHintsProvider>{
|
||||
provideInlineHints() {
|
||||
return [new types.InlineHint('Foo', new types.Range(0, 1, 2, 3), new types.MarkdownString('**Hello**'), true, false)];
|
||||
}
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
|
||||
const value = await commands.executeCommand<vscode.InlineHint[]>('vscode.executeInlineHintProvider', model.uri, new types.Range(0, 0, 20, 20));
|
||||
assert.strictEqual(value.length, 2);
|
||||
|
||||
const [first, second] = value;
|
||||
assert.strictEqual(first.text, 'Foo');
|
||||
assert.strictEqual(first.range.start.line, 0);
|
||||
assert.strictEqual(first.range.start.character, 1);
|
||||
assert.strictEqual(first.range.end.line, 2);
|
||||
assert.strictEqual(first.range.end.character, 3);
|
||||
assert.ok(first.description instanceof types.MarkdownString);
|
||||
assert.strictEqual((<types.MarkdownString>first.description).value, '**Hello**');
|
||||
|
||||
assert.strictEqual(second.text, 'Bar');
|
||||
assert.strictEqual(second.range.start.line, 10);
|
||||
assert.strictEqual(second.range.start.character, 11);
|
||||
assert.strictEqual(second.range.end.line, 12);
|
||||
assert.strictEqual(second.range.end.character, 13);
|
||||
});
|
||||
|
||||
test('Inline Hints, bad provider', async function () {
|
||||
disposables.push(extHost.registerInlineHintsProvider(nullExtensionDescription, defaultSelector, <vscode.InlineHintsProvider>{
|
||||
provideInlineHints() {
|
||||
return [new types.InlineHint('Foo', new types.Range(0, 1, 2, 3), undefined, true, false)];
|
||||
}
|
||||
}));
|
||||
disposables.push(extHost.registerInlineHintsProvider(nullExtensionDescription, defaultSelector, <vscode.InlineHintsProvider>{
|
||||
provideInlineHints() {
|
||||
throw new Error();
|
||||
}
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
|
||||
const value = await commands.executeCommand<vscode.InlineHint[]>('vscode.executeInlineHintProvider', model.uri, new types.Range(0, 0, 20, 20));
|
||||
assert.strictEqual(value.length, 1);
|
||||
|
||||
const [first] = value;
|
||||
assert.strictEqual(first.text, 'Foo');
|
||||
assert.strictEqual(first.range.start.line, 0);
|
||||
assert.strictEqual(first.range.start.character, 1);
|
||||
assert.strictEqual(first.range.end.line, 2);
|
||||
assert.strictEqual(first.range.end.character, 3);
|
||||
});
|
||||
|
||||
// --- selection ranges
|
||||
|
||||
test('Selection Range, back and forth', async function () {
|
||||
@@ -1155,7 +1237,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await commands.executeCommand<vscode.SelectionRange[]>('vscode.executeSelectionRangeProvider', model.uri, [new types.Position(0, 10)]);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
assert.ok(value[0].parent);
|
||||
});
|
||||
|
||||
@@ -1190,16 +1272,16 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
const root = await commands.executeCommand<vscode.CallHierarchyItem[]>('vscode.prepareCallHierarchy', model.uri, new types.Position(0, 0));
|
||||
|
||||
assert.ok(Array.isArray(root));
|
||||
assert.equal(root.length, 1);
|
||||
assert.equal(root[0].name, 'ROOT');
|
||||
assert.strictEqual(root.length, 1);
|
||||
assert.strictEqual(root[0].name, 'ROOT');
|
||||
|
||||
const incoming = await commands.executeCommand<vscode.CallHierarchyIncomingCall[]>('vscode.provideIncomingCalls', root[0]);
|
||||
assert.equal(incoming.length, 1);
|
||||
assert.equal(incoming[0].from.name, 'INCOMING');
|
||||
assert.strictEqual(incoming.length, 1);
|
||||
assert.strictEqual(incoming[0].from.name, 'INCOMING');
|
||||
|
||||
const outgoing = await commands.executeCommand<vscode.CallHierarchyOutgoingCall[]>('vscode.provideOutgoingCalls', root[0]);
|
||||
assert.equal(outgoing.length, 1);
|
||||
assert.equal(outgoing[0].to.name, 'OUTGOING');
|
||||
assert.strictEqual(outgoing.length, 1);
|
||||
assert.strictEqual(outgoing[0].to.name, 'OUTGOING');
|
||||
});
|
||||
|
||||
test('selectionRangeProvider on inner array always returns outer array #91852', async function () {
|
||||
@@ -1215,11 +1297,11 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await commands.executeCommand<vscode.SelectionRange[]>('vscode.executeSelectionRangeProvider', model.uri, [new types.Position(0, 10)]);
|
||||
assert.equal(value.length, 1);
|
||||
assert.equal(value[0].range.start.line, 0);
|
||||
assert.equal(value[0].range.start.character, 10);
|
||||
assert.equal(value[0].range.end.line, 0);
|
||||
assert.equal(value[0].range.end.character, 10);
|
||||
assert.strictEqual(value.length, 1);
|
||||
assert.strictEqual(value[0].range.start.line, 0);
|
||||
assert.strictEqual(value[0].range.start.character, 10);
|
||||
assert.strictEqual(value[0].range.end.line, 0);
|
||||
assert.strictEqual(value[0].range.end.character, 10);
|
||||
});
|
||||
|
||||
test('selectionRangeProvider on inner array always returns outer array #91852', async function () {
|
||||
@@ -1240,14 +1322,14 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
model.uri,
|
||||
[new types.Position(0, 0), new types.Position(0, 10)]
|
||||
);
|
||||
assert.equal(value.length, 2);
|
||||
assert.equal(value[0].range.start.line, 0);
|
||||
assert.equal(value[0].range.start.character, 0);
|
||||
assert.equal(value[0].range.end.line, 0);
|
||||
assert.equal(value[0].range.end.character, 0);
|
||||
assert.equal(value[1].range.start.line, 0);
|
||||
assert.equal(value[1].range.start.character, 10);
|
||||
assert.equal(value[1].range.end.line, 0);
|
||||
assert.equal(value[1].range.end.character, 10);
|
||||
assert.strictEqual(value.length, 2);
|
||||
assert.strictEqual(value[0].range.start.line, 0);
|
||||
assert.strictEqual(value[0].range.start.character, 0);
|
||||
assert.strictEqual(value[0].range.end.line, 0);
|
||||
assert.strictEqual(value[0].range.end.character, 0);
|
||||
assert.strictEqual(value[1].range.start.line, 0);
|
||||
assert.strictEqual(value[1].range.start.character, 10);
|
||||
assert.strictEqual(value[1].range.end.line, 0);
|
||||
assert.strictEqual(value[1].range.end.character, 10);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -47,17 +47,17 @@ suite('ExtHostBulkEdits.applyWorkspaceEdit', () => {
|
||||
let edit = new extHostTypes.WorkspaceEdit();
|
||||
edit.replace(resource, new extHostTypes.Range(0, 0, 0, 0), 'hello');
|
||||
await bulkEdits.applyWorkspaceEdit(edit);
|
||||
assert.equal(workspaceResourceEdits.edits.length, 1);
|
||||
assert.strictEqual(workspaceResourceEdits.edits.length, 1);
|
||||
const [first] = workspaceResourceEdits.edits;
|
||||
assertType(first._type === WorkspaceEditType.Text);
|
||||
assert.equal(first.modelVersionId, 1337);
|
||||
assert.strictEqual(first.modelVersionId, 1337);
|
||||
});
|
||||
|
||||
test('does not use version id if document is not available', async () => {
|
||||
let edit = new extHostTypes.WorkspaceEdit();
|
||||
edit.replace(URI.parse('foo:bar2'), new extHostTypes.Range(0, 0, 0, 0), 'hello');
|
||||
await bulkEdits.applyWorkspaceEdit(edit);
|
||||
assert.equal(workspaceResourceEdits.edits.length, 1);
|
||||
assert.strictEqual(workspaceResourceEdits.edits.length, 1);
|
||||
const [first] = workspaceResourceEdits.edits;
|
||||
assertType(first._type === WorkspaceEditType.Text);
|
||||
assert.ok(typeof first.modelVersionId === 'undefined');
|
||||
|
||||
@@ -31,8 +31,8 @@ suite('ExtHostCommands', function () {
|
||||
new NullLogService()
|
||||
);
|
||||
commands.registerCommand(true, 'foo', (): any => { }).dispose();
|
||||
assert.equal(lastUnregister!, 'foo');
|
||||
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
|
||||
assert.strictEqual(lastUnregister!, 'foo');
|
||||
assert.strictEqual(CommandsRegistry.getCommand('foo'), undefined);
|
||||
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ suite('ExtHostCommands', function () {
|
||||
reg.dispose();
|
||||
reg.dispose();
|
||||
reg.dispose();
|
||||
assert.equal(unregisterCounter, 1);
|
||||
assert.strictEqual(unregisterCounter, 1);
|
||||
});
|
||||
|
||||
test('execute with retry', async function () {
|
||||
@@ -70,12 +70,12 @@ suite('ExtHostCommands', function () {
|
||||
}
|
||||
async $executeCommand<T>(id: string, args: any[], retry: boolean): Promise<T | undefined> {
|
||||
count++;
|
||||
assert.equal(retry, count === 1);
|
||||
assert.strictEqual(retry, count === 1);
|
||||
if (count === 1) {
|
||||
assert.equal(retry, true);
|
||||
assert.strictEqual(retry, true);
|
||||
throw new Error('$executeCommand:retry');
|
||||
} else {
|
||||
assert.equal(retry, false);
|
||||
assert.strictEqual(retry, false);
|
||||
return <any>17;
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ suite('ExtHostCommands', function () {
|
||||
);
|
||||
|
||||
const result = await commands.executeCommand('fooo', [this, true]);
|
||||
assert.equal(result, 17);
|
||||
assert.equal(count, 2);
|
||||
assert.strictEqual(result, 17);
|
||||
assert.strictEqual(count, 2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -59,12 +59,12 @@ suite('ExtHostConfiguration', function () {
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(extHostConfig.getConfiguration('search.exclude')['**/node_modules'], true);
|
||||
assert.equal(extHostConfig.getConfiguration('search.exclude').get('**/node_modules'), true);
|
||||
assert.equal(extHostConfig.getConfiguration('search').get<any>('exclude')['**/node_modules'], true);
|
||||
assert.strictEqual(extHostConfig.getConfiguration('search.exclude')['**/node_modules'], true);
|
||||
assert.strictEqual(extHostConfig.getConfiguration('search.exclude').get('**/node_modules'), true);
|
||||
assert.strictEqual(extHostConfig.getConfiguration('search').get<any>('exclude')['**/node_modules'], true);
|
||||
|
||||
assert.equal(extHostConfig.getConfiguration('search.exclude').has('**/node_modules'), true);
|
||||
assert.equal(extHostConfig.getConfiguration('search').has('exclude.**/node_modules'), true);
|
||||
assert.strictEqual(extHostConfig.getConfiguration('search.exclude').has('**/node_modules'), true);
|
||||
assert.strictEqual(extHostConfig.getConfiguration('search').has('exclude.**/node_modules'), true);
|
||||
});
|
||||
|
||||
test('has/get', () => {
|
||||
@@ -83,18 +83,18 @@ suite('ExtHostConfiguration', function () {
|
||||
const config = all.getConfiguration('farboo');
|
||||
|
||||
assert.ok(config.has('config0'));
|
||||
assert.equal(config.get('config0'), true);
|
||||
assert.equal(config.get('config4'), '');
|
||||
assert.equal(config['config0'], true);
|
||||
assert.equal(config['config4'], '');
|
||||
assert.strictEqual(config.get('config0'), true);
|
||||
assert.strictEqual(config.get('config4'), '');
|
||||
assert.strictEqual(config['config0'], true);
|
||||
assert.strictEqual(config['config4'], '');
|
||||
|
||||
assert.ok(config.has('nested.config1'));
|
||||
assert.equal(config.get('nested.config1'), 42);
|
||||
assert.strictEqual(config.get('nested.config1'), 42);
|
||||
assert.ok(config.has('nested.config2'));
|
||||
assert.equal(config.get('nested.config2'), 'Das Pferd frisst kein Reis.');
|
||||
assert.strictEqual(config.get('nested.config2'), 'Das Pferd frisst kein Reis.');
|
||||
|
||||
assert.ok(config.has('nested'));
|
||||
assert.deepEqual(config.get('nested'), { config1: 42, config2: 'Das Pferd frisst kein Reis.' });
|
||||
assert.deepStrictEqual(config.get('nested'), { config1: 42, config2: 'Das Pferd frisst kein Reis.' });
|
||||
});
|
||||
|
||||
test('can modify the returned configuration', function () {
|
||||
@@ -118,37 +118,37 @@ suite('ExtHostConfiguration', function () {
|
||||
let testObject = all.getConfiguration();
|
||||
let actual = testObject.get<any>('farboo')!;
|
||||
actual['nested']['config1'] = 41;
|
||||
assert.equal(41, actual['nested']['config1']);
|
||||
assert.strictEqual(41, actual['nested']['config1']);
|
||||
actual['farboo1'] = 'newValue';
|
||||
assert.equal('newValue', actual['farboo1']);
|
||||
assert.strictEqual('newValue', actual['farboo1']);
|
||||
|
||||
testObject = all.getConfiguration();
|
||||
actual = testObject.get('farboo')!;
|
||||
assert.equal(actual['nested']['config1'], 42);
|
||||
assert.equal(actual['farboo1'], undefined);
|
||||
assert.strictEqual(actual['nested']['config1'], 42);
|
||||
assert.strictEqual(actual['farboo1'], undefined);
|
||||
|
||||
testObject = all.getConfiguration();
|
||||
actual = testObject.get('farboo')!;
|
||||
assert.equal(actual['config0'], true);
|
||||
assert.strictEqual(actual['config0'], true);
|
||||
actual['config0'] = false;
|
||||
assert.equal(actual['config0'], false);
|
||||
assert.strictEqual(actual['config0'], false);
|
||||
|
||||
testObject = all.getConfiguration();
|
||||
actual = testObject.get('farboo')!;
|
||||
assert.equal(actual['config0'], true);
|
||||
assert.strictEqual(actual['config0'], true);
|
||||
|
||||
testObject = all.getConfiguration();
|
||||
actual = testObject.inspect('farboo')!;
|
||||
actual['value'] = 'effectiveValue';
|
||||
assert.equal('effectiveValue', actual['value']);
|
||||
assert.strictEqual('effectiveValue', actual['value']);
|
||||
|
||||
testObject = all.getConfiguration('workbench');
|
||||
actual = testObject.get('colorCustomizations')!;
|
||||
actual['statusBar.foreground'] = undefined;
|
||||
assert.equal(actual['statusBar.foreground'], undefined);
|
||||
assert.strictEqual(actual['statusBar.foreground'], undefined);
|
||||
testObject = all.getConfiguration('workbench');
|
||||
actual = testObject.get('colorCustomizations')!;
|
||||
assert.equal(actual['statusBar.foreground'], 'somevalue');
|
||||
assert.strictEqual(actual['statusBar.foreground'], 'somevalue');
|
||||
});
|
||||
|
||||
test('Stringify returned configuration', function () {
|
||||
@@ -173,7 +173,7 @@ suite('ExtHostConfiguration', function () {
|
||||
|
||||
const testObject = all.getConfiguration();
|
||||
let actual: any = testObject.get('farboo');
|
||||
assert.deepEqual(JSON.stringify({
|
||||
assert.deepStrictEqual(JSON.stringify({
|
||||
'config0': true,
|
||||
'nested': {
|
||||
'config1': 42,
|
||||
@@ -182,11 +182,11 @@ suite('ExtHostConfiguration', function () {
|
||||
'config4': ''
|
||||
}), JSON.stringify(actual));
|
||||
|
||||
assert.deepEqual(undefined, JSON.stringify(testObject.get('unknownkey')));
|
||||
assert.deepStrictEqual(undefined, JSON.stringify(testObject.get('unknownkey')));
|
||||
|
||||
actual = testObject.get('farboo')!;
|
||||
actual['config0'] = false;
|
||||
assert.deepEqual(JSON.stringify({
|
||||
assert.deepStrictEqual(JSON.stringify({
|
||||
'config0': false,
|
||||
'nested': {
|
||||
'config1': 42,
|
||||
@@ -197,14 +197,14 @@ suite('ExtHostConfiguration', function () {
|
||||
|
||||
actual = testObject.get<any>('workbench')!['colorCustomizations']!;
|
||||
actual['statusBar.background'] = 'anothervalue';
|
||||
assert.deepEqual(JSON.stringify({
|
||||
assert.deepStrictEqual(JSON.stringify({
|
||||
'statusBar.foreground': 'somevalue',
|
||||
'statusBar.background': 'anothervalue'
|
||||
}), JSON.stringify(actual));
|
||||
|
||||
actual = testObject.get('workbench');
|
||||
actual['unknownkey'] = 'somevalue';
|
||||
assert.deepEqual(JSON.stringify({
|
||||
assert.deepStrictEqual(JSON.stringify({
|
||||
'colorCustomizations': {
|
||||
'statusBar.foreground': 'somevalue'
|
||||
},
|
||||
@@ -218,7 +218,7 @@ suite('ExtHostConfiguration', function () {
|
||||
'statusBar.background': `#0ff`,
|
||||
'statusBar.foreground': `#ff0`,
|
||||
};
|
||||
assert.deepEqual(JSON.stringify({
|
||||
assert.deepStrictEqual(JSON.stringify({
|
||||
'statusBar.background': `#0ff`,
|
||||
'statusBar.foreground': `#ff0`,
|
||||
}), JSON.stringify(actual));
|
||||
@@ -229,7 +229,7 @@ suite('ExtHostConfiguration', function () {
|
||||
'statusBar.background': `#0ff`,
|
||||
'statusBar.foreground': `#ff0`,
|
||||
};
|
||||
assert.deepEqual(JSON.stringify({
|
||||
assert.deepStrictEqual(JSON.stringify({
|
||||
'statusBar.background': `#0ff`,
|
||||
'statusBar.foreground': `#ff0`,
|
||||
}), JSON.stringify(actual));
|
||||
@@ -292,16 +292,16 @@ suite('ExtHostConfiguration', function () {
|
||||
);
|
||||
|
||||
let actual = testObject.getConfiguration().inspect('editor.wordWrap')!;
|
||||
assert.equal(actual.defaultValue, 'off');
|
||||
assert.equal(actual.globalValue, 'on');
|
||||
assert.equal(actual.workspaceValue, undefined);
|
||||
assert.equal(actual.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(actual.defaultValue, 'off');
|
||||
assert.strictEqual(actual.globalValue, 'on');
|
||||
assert.strictEqual(actual.workspaceValue, undefined);
|
||||
assert.strictEqual(actual.workspaceFolderValue, undefined);
|
||||
|
||||
actual = testObject.getConfiguration('editor').inspect('wordWrap')!;
|
||||
assert.equal(actual.defaultValue, 'off');
|
||||
assert.equal(actual.globalValue, 'on');
|
||||
assert.equal(actual.workspaceValue, undefined);
|
||||
assert.equal(actual.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(actual.defaultValue, 'off');
|
||||
assert.strictEqual(actual.globalValue, 'on');
|
||||
assert.strictEqual(actual.workspaceValue, undefined);
|
||||
assert.strictEqual(actual.workspaceFolderValue, undefined);
|
||||
});
|
||||
|
||||
test('inspect in single root context', function () {
|
||||
@@ -341,28 +341,28 @@ suite('ExtHostConfiguration', function () {
|
||||
);
|
||||
|
||||
let actual1 = testObject.getConfiguration().inspect('editor.wordWrap')!;
|
||||
assert.equal(actual1.defaultValue, 'off');
|
||||
assert.equal(actual1.globalValue, 'on');
|
||||
assert.equal(actual1.workspaceValue, 'bounded');
|
||||
assert.equal(actual1.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(actual1.defaultValue, 'off');
|
||||
assert.strictEqual(actual1.globalValue, 'on');
|
||||
assert.strictEqual(actual1.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual1.workspaceFolderValue, undefined);
|
||||
|
||||
actual1 = testObject.getConfiguration('editor').inspect('wordWrap')!;
|
||||
assert.equal(actual1.defaultValue, 'off');
|
||||
assert.equal(actual1.globalValue, 'on');
|
||||
assert.equal(actual1.workspaceValue, 'bounded');
|
||||
assert.equal(actual1.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(actual1.defaultValue, 'off');
|
||||
assert.strictEqual(actual1.globalValue, 'on');
|
||||
assert.strictEqual(actual1.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual1.workspaceFolderValue, undefined);
|
||||
|
||||
let actual2 = testObject.getConfiguration(undefined, workspaceUri).inspect('editor.wordWrap')!;
|
||||
assert.equal(actual2.defaultValue, 'off');
|
||||
assert.equal(actual2.globalValue, 'on');
|
||||
assert.equal(actual2.workspaceValue, 'bounded');
|
||||
assert.equal(actual2.workspaceFolderValue, 'bounded');
|
||||
assert.strictEqual(actual2.defaultValue, 'off');
|
||||
assert.strictEqual(actual2.globalValue, 'on');
|
||||
assert.strictEqual(actual2.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual2.workspaceFolderValue, 'bounded');
|
||||
|
||||
actual2 = testObject.getConfiguration('editor', workspaceUri).inspect('wordWrap')!;
|
||||
assert.equal(actual2.defaultValue, 'off');
|
||||
assert.equal(actual2.globalValue, 'on');
|
||||
assert.equal(actual2.workspaceValue, 'bounded');
|
||||
assert.equal(actual2.workspaceFolderValue, 'bounded');
|
||||
assert.strictEqual(actual2.defaultValue, 'off');
|
||||
assert.strictEqual(actual2.globalValue, 'on');
|
||||
assert.strictEqual(actual2.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual2.workspaceFolderValue, 'bounded');
|
||||
});
|
||||
|
||||
test('inspect in multi root context', function () {
|
||||
@@ -418,66 +418,66 @@ suite('ExtHostConfiguration', function () {
|
||||
);
|
||||
|
||||
let actual1 = testObject.getConfiguration().inspect('editor.wordWrap')!;
|
||||
assert.equal(actual1.defaultValue, 'off');
|
||||
assert.equal(actual1.globalValue, 'on');
|
||||
assert.equal(actual1.workspaceValue, 'bounded');
|
||||
assert.equal(actual1.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(actual1.defaultValue, 'off');
|
||||
assert.strictEqual(actual1.globalValue, 'on');
|
||||
assert.strictEqual(actual1.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual1.workspaceFolderValue, undefined);
|
||||
|
||||
actual1 = testObject.getConfiguration('editor').inspect('wordWrap')!;
|
||||
assert.equal(actual1.defaultValue, 'off');
|
||||
assert.equal(actual1.globalValue, 'on');
|
||||
assert.equal(actual1.workspaceValue, 'bounded');
|
||||
assert.equal(actual1.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(actual1.defaultValue, 'off');
|
||||
assert.strictEqual(actual1.globalValue, 'on');
|
||||
assert.strictEqual(actual1.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual1.workspaceFolderValue, undefined);
|
||||
|
||||
actual1 = testObject.getConfiguration('editor').inspect('lineNumbers')!;
|
||||
assert.equal(actual1.defaultValue, 'on');
|
||||
assert.equal(actual1.globalValue, undefined);
|
||||
assert.equal(actual1.workspaceValue, undefined);
|
||||
assert.equal(actual1.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(actual1.defaultValue, 'on');
|
||||
assert.strictEqual(actual1.globalValue, undefined);
|
||||
assert.strictEqual(actual1.workspaceValue, undefined);
|
||||
assert.strictEqual(actual1.workspaceFolderValue, undefined);
|
||||
|
||||
let actual2 = testObject.getConfiguration(undefined, firstRoot).inspect('editor.wordWrap')!;
|
||||
assert.equal(actual2.defaultValue, 'off');
|
||||
assert.equal(actual2.globalValue, 'on');
|
||||
assert.equal(actual2.workspaceValue, 'bounded');
|
||||
assert.equal(actual2.workspaceFolderValue, 'off');
|
||||
assert.strictEqual(actual2.defaultValue, 'off');
|
||||
assert.strictEqual(actual2.globalValue, 'on');
|
||||
assert.strictEqual(actual2.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual2.workspaceFolderValue, 'off');
|
||||
|
||||
actual2 = testObject.getConfiguration('editor', firstRoot).inspect('wordWrap')!;
|
||||
assert.equal(actual2.defaultValue, 'off');
|
||||
assert.equal(actual2.globalValue, 'on');
|
||||
assert.equal(actual2.workspaceValue, 'bounded');
|
||||
assert.equal(actual2.workspaceFolderValue, 'off');
|
||||
assert.strictEqual(actual2.defaultValue, 'off');
|
||||
assert.strictEqual(actual2.globalValue, 'on');
|
||||
assert.strictEqual(actual2.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual2.workspaceFolderValue, 'off');
|
||||
|
||||
actual2 = testObject.getConfiguration('editor', firstRoot).inspect('lineNumbers')!;
|
||||
assert.equal(actual2.defaultValue, 'on');
|
||||
assert.equal(actual2.globalValue, undefined);
|
||||
assert.equal(actual2.workspaceValue, undefined);
|
||||
assert.equal(actual2.workspaceFolderValue, 'relative');
|
||||
assert.strictEqual(actual2.defaultValue, 'on');
|
||||
assert.strictEqual(actual2.globalValue, undefined);
|
||||
assert.strictEqual(actual2.workspaceValue, undefined);
|
||||
assert.strictEqual(actual2.workspaceFolderValue, 'relative');
|
||||
|
||||
actual2 = testObject.getConfiguration(undefined, secondRoot).inspect('editor.wordWrap')!;
|
||||
assert.equal(actual2.defaultValue, 'off');
|
||||
assert.equal(actual2.globalValue, 'on');
|
||||
assert.equal(actual2.workspaceValue, 'bounded');
|
||||
assert.equal(actual2.workspaceFolderValue, 'on');
|
||||
assert.strictEqual(actual2.defaultValue, 'off');
|
||||
assert.strictEqual(actual2.globalValue, 'on');
|
||||
assert.strictEqual(actual2.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual2.workspaceFolderValue, 'on');
|
||||
|
||||
actual2 = testObject.getConfiguration('editor', secondRoot).inspect('wordWrap')!;
|
||||
assert.equal(actual2.defaultValue, 'off');
|
||||
assert.equal(actual2.globalValue, 'on');
|
||||
assert.equal(actual2.workspaceValue, 'bounded');
|
||||
assert.equal(actual2.workspaceFolderValue, 'on');
|
||||
assert.strictEqual(actual2.defaultValue, 'off');
|
||||
assert.strictEqual(actual2.globalValue, 'on');
|
||||
assert.strictEqual(actual2.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual2.workspaceFolderValue, 'on');
|
||||
|
||||
actual2 = testObject.getConfiguration(undefined, thirdRoot).inspect('editor.wordWrap')!;
|
||||
assert.equal(actual2.defaultValue, 'off');
|
||||
assert.equal(actual2.globalValue, 'on');
|
||||
assert.equal(actual2.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual2.defaultValue, 'off');
|
||||
assert.strictEqual(actual2.globalValue, 'on');
|
||||
assert.strictEqual(actual2.workspaceValue, 'bounded');
|
||||
assert.ok(Object.keys(actual2).indexOf('workspaceFolderValue') !== -1);
|
||||
assert.equal(actual2.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(actual2.workspaceFolderValue, undefined);
|
||||
|
||||
actual2 = testObject.getConfiguration('editor', thirdRoot).inspect('wordWrap')!;
|
||||
assert.equal(actual2.defaultValue, 'off');
|
||||
assert.equal(actual2.globalValue, 'on');
|
||||
assert.equal(actual2.workspaceValue, 'bounded');
|
||||
assert.strictEqual(actual2.defaultValue, 'off');
|
||||
assert.strictEqual(actual2.globalValue, 'on');
|
||||
assert.strictEqual(actual2.workspaceValue, 'bounded');
|
||||
assert.ok(Object.keys(actual2).indexOf('workspaceFolderValue') !== -1);
|
||||
assert.equal(actual2.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(actual2.workspaceFolderValue, undefined);
|
||||
});
|
||||
|
||||
test('inspect with language overrides', function () {
|
||||
@@ -527,26 +527,26 @@ suite('ExtHostConfiguration', function () {
|
||||
);
|
||||
|
||||
let actual = testObject.getConfiguration(undefined, { uri: firstRoot, languageId: 'typescript' }).inspect('editor.wordWrap')!;
|
||||
assert.equal(actual.defaultValue, 'off');
|
||||
assert.equal(actual.globalValue, 'bounded');
|
||||
assert.equal(actual.workspaceValue, undefined);
|
||||
assert.equal(actual.workspaceFolderValue, 'bounded');
|
||||
assert.equal(actual.defaultLanguageValue, undefined);
|
||||
assert.equal(actual.globalLanguageValue, undefined);
|
||||
assert.equal(actual.workspaceLanguageValue, 'unbounded');
|
||||
assert.equal(actual.workspaceFolderLanguageValue, 'unbounded');
|
||||
assert.deepEqual(actual.languageIds, ['markdown', 'typescript']);
|
||||
assert.strictEqual(actual.defaultValue, 'off');
|
||||
assert.strictEqual(actual.globalValue, 'bounded');
|
||||
assert.strictEqual(actual.workspaceValue, undefined);
|
||||
assert.strictEqual(actual.workspaceFolderValue, 'bounded');
|
||||
assert.strictEqual(actual.defaultLanguageValue, undefined);
|
||||
assert.strictEqual(actual.globalLanguageValue, undefined);
|
||||
assert.strictEqual(actual.workspaceLanguageValue, 'unbounded');
|
||||
assert.strictEqual(actual.workspaceFolderLanguageValue, 'unbounded');
|
||||
assert.deepStrictEqual(actual.languageIds, ['markdown', 'typescript']);
|
||||
|
||||
actual = testObject.getConfiguration(undefined, { uri: secondRoot, languageId: 'typescript' }).inspect('editor.wordWrap')!;
|
||||
assert.equal(actual.defaultValue, 'off');
|
||||
assert.equal(actual.globalValue, 'bounded');
|
||||
assert.equal(actual.workspaceValue, undefined);
|
||||
assert.equal(actual.workspaceFolderValue, undefined);
|
||||
assert.equal(actual.defaultLanguageValue, undefined);
|
||||
assert.equal(actual.globalLanguageValue, undefined);
|
||||
assert.equal(actual.workspaceLanguageValue, 'unbounded');
|
||||
assert.equal(actual.workspaceFolderLanguageValue, undefined);
|
||||
assert.deepEqual(actual.languageIds, ['markdown', 'typescript']);
|
||||
assert.strictEqual(actual.defaultValue, 'off');
|
||||
assert.strictEqual(actual.globalValue, 'bounded');
|
||||
assert.strictEqual(actual.workspaceValue, undefined);
|
||||
assert.strictEqual(actual.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(actual.defaultLanguageValue, undefined);
|
||||
assert.strictEqual(actual.globalLanguageValue, undefined);
|
||||
assert.strictEqual(actual.workspaceLanguageValue, 'unbounded');
|
||||
assert.strictEqual(actual.workspaceFolderLanguageValue, undefined);
|
||||
assert.deepStrictEqual(actual.languageIds, ['markdown', 'typescript']);
|
||||
});
|
||||
|
||||
|
||||
@@ -560,12 +560,12 @@ suite('ExtHostConfiguration', function () {
|
||||
});
|
||||
|
||||
let config = all.getConfiguration('farboo.config0');
|
||||
assert.equal(config.get(''), undefined);
|
||||
assert.equal(config.has(''), false);
|
||||
assert.strictEqual(config.get(''), undefined);
|
||||
assert.strictEqual(config.has(''), false);
|
||||
|
||||
config = all.getConfiguration('farboo');
|
||||
assert.equal(config.get('config0'), true);
|
||||
assert.equal(config.has('config0'), true);
|
||||
assert.strictEqual(config.get('config0'), true);
|
||||
assert.strictEqual(config.has('config0'), true);
|
||||
});
|
||||
|
||||
test('getConfiguration vs get', function () {
|
||||
@@ -578,12 +578,12 @@ suite('ExtHostConfiguration', function () {
|
||||
});
|
||||
|
||||
let config = all.getConfiguration('farboo.config0');
|
||||
assert.equal(config.get(''), undefined);
|
||||
assert.equal(config.has(''), false);
|
||||
assert.strictEqual(config.get(''), undefined);
|
||||
assert.strictEqual(config.has(''), false);
|
||||
|
||||
config = all.getConfiguration('farboo');
|
||||
assert.equal(config.get('config0'), true);
|
||||
assert.equal(config.has('config0'), true);
|
||||
assert.strictEqual(config.get('config0'), true);
|
||||
assert.strictEqual(config.has('config0'), true);
|
||||
});
|
||||
|
||||
test('name vs property', function () {
|
||||
@@ -595,8 +595,8 @@ suite('ExtHostConfiguration', function () {
|
||||
const config = all.getConfiguration('farboo');
|
||||
|
||||
assert.ok(config.has('get'));
|
||||
assert.equal(config.get('get'), 'get-prop');
|
||||
assert.deepEqual(config['get'], config.get);
|
||||
assert.strictEqual(config.get('get'), 'get-prop');
|
||||
assert.deepStrictEqual(config['get'], config.get);
|
||||
assert.throws(() => config['get'] = <any>'get-prop');
|
||||
});
|
||||
|
||||
@@ -612,7 +612,7 @@ suite('ExtHostConfiguration', function () {
|
||||
let config = allConfig.getConfiguration('foo');
|
||||
config.update('bar', 42);
|
||||
|
||||
assert.equal(shape.lastArgs[0], null);
|
||||
assert.strictEqual(shape.lastArgs[0], null);
|
||||
});
|
||||
|
||||
test('update/section to key', function () {
|
||||
@@ -628,16 +628,16 @@ suite('ExtHostConfiguration', function () {
|
||||
let config = allConfig.getConfiguration('foo');
|
||||
config.update('bar', 42, true);
|
||||
|
||||
assert.equal(shape.lastArgs[0], ConfigurationTarget.USER);
|
||||
assert.equal(shape.lastArgs[1], 'foo.bar');
|
||||
assert.equal(shape.lastArgs[2], 42);
|
||||
assert.strictEqual(shape.lastArgs[0], ConfigurationTarget.USER);
|
||||
assert.strictEqual(shape.lastArgs[1], 'foo.bar');
|
||||
assert.strictEqual(shape.lastArgs[2], 42);
|
||||
|
||||
config = allConfig.getConfiguration('');
|
||||
config.update('bar', 42, true);
|
||||
assert.equal(shape.lastArgs[1], 'bar');
|
||||
assert.strictEqual(shape.lastArgs[1], 'bar');
|
||||
|
||||
config.update('foo.bar', 42, true);
|
||||
assert.equal(shape.lastArgs[1], 'foo.bar');
|
||||
assert.strictEqual(shape.lastArgs[1], 'foo.bar');
|
||||
});
|
||||
|
||||
test('update, what is #15834', function () {
|
||||
@@ -649,8 +649,8 @@ suite('ExtHostConfiguration', function () {
|
||||
}, shape);
|
||||
|
||||
allConfig.getConfiguration('editor').update('formatOnSave', { extensions: ['ts'] });
|
||||
assert.equal(shape.lastArgs[1], 'editor.formatOnSave');
|
||||
assert.deepEqual(shape.lastArgs[2], { extensions: ['ts'] });
|
||||
assert.strictEqual(shape.lastArgs[1], 'editor.formatOnSave');
|
||||
assert.deepStrictEqual(shape.lastArgs[2], { extensions: ['ts'] });
|
||||
});
|
||||
|
||||
test('update/error-state not OK', function () {
|
||||
@@ -698,7 +698,7 @@ suite('ExtHostConfiguration', function () {
|
||||
const configEventData: IConfigurationChange = { keys: ['farboo.updatedConfig', 'farboo.newConfig'], overrides: [] };
|
||||
testObject.onDidChangeConfiguration(e => {
|
||||
|
||||
assert.deepEqual(testObject.getConfiguration().get('farboo'), {
|
||||
assert.deepStrictEqual(testObject.getConfiguration().get('farboo'), {
|
||||
'config': false,
|
||||
'updatedConfig': true,
|
||||
'newConfig': true,
|
||||
|
||||
@@ -68,17 +68,17 @@ suite('ExtHostDecorations', function () {
|
||||
return extHostDecorations.$provideDecorations(handle, [{ id: idx, uri: URI.parse('test:///file') }], CancellationToken.None);
|
||||
});
|
||||
|
||||
assert.equal(calledA, true);
|
||||
assert.equal(calledB, true);
|
||||
assert.strictEqual(calledA, true);
|
||||
assert.strictEqual(calledB, true);
|
||||
|
||||
assert.equal(requests.length, 2);
|
||||
assert.strictEqual(requests.length, 2);
|
||||
const [first, second] = requests;
|
||||
|
||||
const firstResult = await Promise.race([first, timeout(30).then(() => false)]);
|
||||
assert.equal(typeof firstResult, 'boolean'); // never finishes...
|
||||
assert.strictEqual(typeof firstResult, 'boolean'); // never finishes...
|
||||
|
||||
const secondResult = await Promise.race([second, timeout(30).then(() => false)]);
|
||||
assert.equal(typeof secondResult, 'object');
|
||||
assert.strictEqual(typeof secondResult, 'object');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -45,26 +45,26 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
test('diagnostic collection, forEach, clear, has', function () {
|
||||
let collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
|
||||
assert.equal(collection.name, 'test');
|
||||
assert.strictEqual(collection.name, 'test');
|
||||
collection.dispose();
|
||||
assert.throws(() => collection.name);
|
||||
|
||||
let c = 0;
|
||||
collection = new DiagnosticCollection('test', 'test', 100, new DiagnosticsShape(), new Emitter());
|
||||
collection.forEach(() => c++);
|
||||
assert.equal(c, 0);
|
||||
assert.strictEqual(c, 0);
|
||||
|
||||
collection.set(URI.parse('foo:bar'), [
|
||||
new Diagnostic(new Range(0, 0, 1, 1), 'message-1'),
|
||||
new Diagnostic(new Range(0, 0, 1, 1), 'message-2')
|
||||
]);
|
||||
collection.forEach(() => c++);
|
||||
assert.equal(c, 1);
|
||||
assert.strictEqual(c, 1);
|
||||
|
||||
c = 0;
|
||||
collection.clear();
|
||||
collection.forEach(() => c++);
|
||||
assert.equal(c, 0);
|
||||
assert.strictEqual(c, 0);
|
||||
|
||||
collection.set(URI.parse('foo:bar1'), [
|
||||
new Diagnostic(new Range(0, 0, 1, 1), 'message-1'),
|
||||
@@ -75,7 +75,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
new Diagnostic(new Range(0, 0, 1, 1), 'message-2')
|
||||
]);
|
||||
collection.forEach(() => c++);
|
||||
assert.equal(c, 2);
|
||||
assert.strictEqual(c, 2);
|
||||
|
||||
assert.ok(collection.has(URI.parse('foo:bar1')));
|
||||
assert.ok(collection.has(URI.parse('foo:bar2')));
|
||||
@@ -105,7 +105,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
});
|
||||
|
||||
array = collection.get(URI.parse('foo:bar')) as Diagnostic[];
|
||||
assert.equal(array.length, 2);
|
||||
assert.strictEqual(array.length, 2);
|
||||
|
||||
collection.dispose();
|
||||
});
|
||||
@@ -121,10 +121,10 @@ suite('ExtHostDiagnostics', () => {
|
||||
]);
|
||||
|
||||
let array = collection.get(uri);
|
||||
assert.equal(array.length, 2);
|
||||
assert.strictEqual(array.length, 2);
|
||||
let [first, second] = array;
|
||||
assert.equal(first.message, 'message-1');
|
||||
assert.equal(second.message, 'message-2');
|
||||
assert.strictEqual(first.message, 'message-1');
|
||||
assert.strictEqual(second.message, 'message-2');
|
||||
|
||||
// clear
|
||||
collection.delete(uri);
|
||||
@@ -152,10 +152,10 @@ suite('ExtHostDiagnostics', () => {
|
||||
]);
|
||||
|
||||
array = collection.get(uri);
|
||||
assert.equal(array.length, 2);
|
||||
assert.strictEqual(array.length, 2);
|
||||
[first, second] = array;
|
||||
assert.equal(first.message, 'message-2');
|
||||
assert.equal(second.message, 'message-3');
|
||||
assert.strictEqual(first.message, 'message-2');
|
||||
assert.strictEqual(second.message, 'message-3');
|
||||
|
||||
collection.dispose();
|
||||
});
|
||||
@@ -172,21 +172,21 @@ suite('ExtHostDiagnostics', () => {
|
||||
let uri = URI.parse('sc:hightower');
|
||||
|
||||
collection.set([[uri, [new Diagnostic(new Range(0, 0, 1, 1), 'error')]]]);
|
||||
assert.equal(collection.get(uri).length, 1);
|
||||
assert.equal(collection.get(uri)[0].message, 'error');
|
||||
assert.equal(lastEntries.length, 1);
|
||||
assert.strictEqual(collection.get(uri).length, 1);
|
||||
assert.strictEqual(collection.get(uri)[0].message, 'error');
|
||||
assert.strictEqual(lastEntries.length, 1);
|
||||
let [[, data1]] = lastEntries;
|
||||
assert.equal(data1.length, 1);
|
||||
assert.equal(data1[0].message, 'error');
|
||||
assert.strictEqual(data1.length, 1);
|
||||
assert.strictEqual(data1[0].message, 'error');
|
||||
lastEntries = undefined!;
|
||||
|
||||
collection.set([[uri, [new Diagnostic(new Range(0, 0, 1, 1), 'warning')]]]);
|
||||
assert.equal(collection.get(uri).length, 1);
|
||||
assert.equal(collection.get(uri)[0].message, 'warning');
|
||||
assert.equal(lastEntries.length, 1);
|
||||
assert.strictEqual(collection.get(uri).length, 1);
|
||||
assert.strictEqual(collection.get(uri)[0].message, 'warning');
|
||||
assert.strictEqual(lastEntries.length, 1);
|
||||
let [[, data2]] = lastEntries;
|
||||
assert.equal(data2.length, 1);
|
||||
assert.equal(data2[0].message, 'warning');
|
||||
assert.strictEqual(data2.length, 1);
|
||||
assert.strictEqual(data2[0].message, 'warning');
|
||||
lastEntries = undefined!;
|
||||
});
|
||||
|
||||
@@ -207,12 +207,12 @@ suite('ExtHostDiagnostics', () => {
|
||||
let diag = new Diagnostic(new Range(0, 0, 0, 1), 'ffff');
|
||||
|
||||
collection.set(uri, [diag]);
|
||||
assert.equal(changeCount, 1);
|
||||
assert.equal(eventCount, 1);
|
||||
assert.strictEqual(changeCount, 1);
|
||||
assert.strictEqual(eventCount, 1);
|
||||
|
||||
collection.set(uri, [diag]);
|
||||
assert.equal(changeCount, 2);
|
||||
assert.equal(eventCount, 2);
|
||||
assert.strictEqual(changeCount, 2);
|
||||
assert.strictEqual(eventCount, 2);
|
||||
});
|
||||
|
||||
test('diagnostics collection, tuples and undefined (small array), #15585', function () {
|
||||
@@ -232,8 +232,8 @@ suite('ExtHostDiagnostics', () => {
|
||||
[uri2, [diag]],
|
||||
]);
|
||||
|
||||
assert.equal(collection.get(uri).length, 1);
|
||||
assert.equal(collection.get(uri2).length, 1);
|
||||
assert.strictEqual(collection.get(uri).length, 1);
|
||||
assert.strictEqual(collection.get(uri2).length, 1);
|
||||
});
|
||||
|
||||
test('diagnostics collection, tuples and undefined (large array), #15585', function () {
|
||||
@@ -254,8 +254,8 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
for (let i = 0; i < 500; i++) {
|
||||
let uri = URI.parse('sc:hightower#' + i);
|
||||
assert.equal(collection.has(uri), true);
|
||||
assert.equal(collection.get(uri).length, 1);
|
||||
assert.strictEqual(collection.has(uri), true);
|
||||
assert.strictEqual(collection.get(uri).length, 1);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -278,12 +278,12 @@ suite('ExtHostDiagnostics', () => {
|
||||
}
|
||||
|
||||
collection.set(uri, diagnostics);
|
||||
assert.equal(collection.get(uri).length, 500);
|
||||
assert.equal(lastEntries.length, 1);
|
||||
assert.equal(lastEntries[0][1].length, 251);
|
||||
assert.equal(lastEntries[0][1][0].severity, MarkerSeverity.Error);
|
||||
assert.equal(lastEntries[0][1][200].severity, MarkerSeverity.Warning);
|
||||
assert.equal(lastEntries[0][1][250].severity, MarkerSeverity.Info);
|
||||
assert.strictEqual(collection.get(uri).length, 500);
|
||||
assert.strictEqual(lastEntries.length, 1);
|
||||
assert.strictEqual(lastEntries[0][1].length, 251);
|
||||
assert.strictEqual(lastEntries[0][1][0].severity, MarkerSeverity.Error);
|
||||
assert.strictEqual(lastEntries[0][1][200].severity, MarkerSeverity.Warning);
|
||||
assert.strictEqual(lastEntries[0][1][250].severity, MarkerSeverity.Info);
|
||||
});
|
||||
|
||||
test('diagnostic eventing', async function () {
|
||||
@@ -295,19 +295,19 @@ suite('ExtHostDiagnostics', () => {
|
||||
let diag3 = new Diagnostic(new Range(1, 1, 2, 3), 'diag3');
|
||||
|
||||
let p = Event.toPromise(emitter.event).then(a => {
|
||||
assert.equal(a.length, 1);
|
||||
assert.equal(a[0].toString(), 'aa:bb');
|
||||
assert.strictEqual(a.length, 1);
|
||||
assert.strictEqual(a[0].toString(), 'aa:bb');
|
||||
assert.ok(URI.isUri(a[0]));
|
||||
});
|
||||
collection.set(URI.parse('aa:bb'), []);
|
||||
await p;
|
||||
|
||||
p = Event.toPromise(emitter.event).then(e => {
|
||||
assert.equal(e.length, 2);
|
||||
assert.strictEqual(e.length, 2);
|
||||
assert.ok(URI.isUri(e[0]));
|
||||
assert.ok(URI.isUri(e[1]));
|
||||
assert.equal(e[0].toString(), 'aa:bb');
|
||||
assert.equal(e[1].toString(), 'aa:cc');
|
||||
assert.strictEqual(e[0].toString(), 'aa:bb');
|
||||
assert.strictEqual(e[1].toString(), 'aa:cc');
|
||||
});
|
||||
collection.set([
|
||||
[URI.parse('aa:bb'), [diag1]],
|
||||
@@ -316,7 +316,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
await p;
|
||||
|
||||
p = Event.toPromise(emitter.event).then(e => {
|
||||
assert.equal(e.length, 2);
|
||||
assert.strictEqual(e.length, 2);
|
||||
assert.ok(URI.isUri(e[0]));
|
||||
assert.ok(URI.isUri(e[1]));
|
||||
});
|
||||
@@ -333,7 +333,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
// delete
|
||||
collection.set(URI.parse('aa:bb'), [diag1]);
|
||||
let p = Event.toPromise(emitter.event).then(e => {
|
||||
assert.equal(e[0].toString(), 'aa:bb');
|
||||
assert.strictEqual(e[0].toString(), 'aa:bb');
|
||||
});
|
||||
collection.delete(URI.parse('aa:bb'));
|
||||
await p;
|
||||
@@ -341,7 +341,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
// set->undefined (as delete)
|
||||
collection.set(URI.parse('aa:bb'), [diag1]);
|
||||
p = Event.toPromise(emitter.event).then(e => {
|
||||
assert.equal(e[0].toString(), 'aa:bb');
|
||||
assert.strictEqual(e[0].toString(), 'aa:bb');
|
||||
});
|
||||
collection.set(URI.parse('aa:bb'), undefined!);
|
||||
await p;
|
||||
@@ -353,13 +353,13 @@ suite('ExtHostDiagnostics', () => {
|
||||
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]) {
|
||||
|
||||
let [[, data]] = entries;
|
||||
assert.equal(entries.length, 1);
|
||||
assert.equal(data.length, 1);
|
||||
assert.strictEqual(entries.length, 1);
|
||||
assert.strictEqual(data.length, 1);
|
||||
|
||||
let [diag] = data;
|
||||
assert.equal(diag.relatedInformation!.length, 2);
|
||||
assert.equal(diag.relatedInformation![0].message, 'more1');
|
||||
assert.equal(diag.relatedInformation![1].message, 'more2');
|
||||
assert.strictEqual(diag.relatedInformation!.length, 2);
|
||||
assert.strictEqual(diag.relatedInformation![0].message, 'more1');
|
||||
assert.strictEqual(diag.relatedInformation![1].message, 'more2');
|
||||
done();
|
||||
}
|
||||
}, new Emitter<any>());
|
||||
@@ -400,9 +400,9 @@ suite('ExtHostDiagnostics', () => {
|
||||
collection1.clear();
|
||||
collection2.clear();
|
||||
|
||||
assert.equal(ownerHistory.length, 2);
|
||||
assert.equal(ownerHistory[0], 'foo');
|
||||
assert.equal(ownerHistory[1], 'foo0');
|
||||
assert.strictEqual(ownerHistory.length, 2);
|
||||
assert.strictEqual(ownerHistory[0], 'foo');
|
||||
assert.strictEqual(ownerHistory[1], 'foo0');
|
||||
});
|
||||
|
||||
test('Error updating diagnostics from extension #60394', function () {
|
||||
@@ -420,14 +420,14 @@ suite('ExtHostDiagnostics', () => {
|
||||
array.push(diag1, diag2);
|
||||
|
||||
collection.set(URI.parse('test:me'), array);
|
||||
assert.equal(callCount, 1);
|
||||
assert.strictEqual(callCount, 1);
|
||||
|
||||
collection.set(URI.parse('test:me'), array);
|
||||
assert.equal(callCount, 2); // equal array
|
||||
assert.strictEqual(callCount, 2); // equal array
|
||||
|
||||
array.push(diag2);
|
||||
collection.set(URI.parse('test:me'), array);
|
||||
assert.equal(callCount, 3); // same but un-equal array
|
||||
assert.strictEqual(callCount, 3); // same but un-equal array
|
||||
});
|
||||
|
||||
test('Diagnostics created by tasks aren\'t accessible to extensions #47292', async function () {
|
||||
@@ -461,11 +461,11 @@ suite('ExtHostDiagnostics', () => {
|
||||
const p1 = Event.toPromise(diags.onDidChangeDiagnostics);
|
||||
diags.$acceptMarkersChange([[uri, data]]);
|
||||
await p1;
|
||||
assert.equal(diags.getDiagnostics(uri).length, 1);
|
||||
assert.strictEqual(diags.getDiagnostics(uri).length, 1);
|
||||
|
||||
const p2 = Event.toPromise(diags.onDidChangeDiagnostics);
|
||||
diags.$acceptMarkersChange([[uri, []]]);
|
||||
await p2;
|
||||
assert.equal(diags.getDiagnostics(uri).length, 0);
|
||||
assert.strictEqual(diags.getDiagnostics(uri).length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,14 +19,14 @@ suite('ExtHostDocumentData', () => {
|
||||
|
||||
function assertPositionAt(offset: number, line: number, character: number) {
|
||||
let position = data.document.positionAt(offset);
|
||||
assert.equal(position.line, line);
|
||||
assert.equal(position.character, character);
|
||||
assert.strictEqual(position.line, line);
|
||||
assert.strictEqual(position.character, character);
|
||||
}
|
||||
|
||||
function assertOffsetAt(line: number, character: number, offset: number) {
|
||||
let pos = new Position(line, character);
|
||||
let actual = data.document.offsetAt(pos);
|
||||
assert.equal(actual, offset);
|
||||
assert.strictEqual(actual, offset);
|
||||
}
|
||||
|
||||
setup(function () {
|
||||
@@ -58,7 +58,7 @@ suite('ExtHostDocumentData', () => {
|
||||
}, URI.parse('foo:bar'), [], '\n', 1, 'text', true);
|
||||
|
||||
return data.document.save().then(() => {
|
||||
assert.equal(saved.toString(), 'foo:bar');
|
||||
assert.strictEqual(saved.toString(), 'foo:bar');
|
||||
|
||||
data.dispose();
|
||||
|
||||
@@ -74,13 +74,13 @@ suite('ExtHostDocumentData', () => {
|
||||
data.dispose();
|
||||
|
||||
const { document } = data;
|
||||
assert.equal(document.lineCount, 4);
|
||||
assert.equal(document.lineAt(0).text, 'This is line one');
|
||||
assert.strictEqual(document.lineCount, 4);
|
||||
assert.strictEqual(document.lineAt(0).text, 'This is line one');
|
||||
});
|
||||
|
||||
test('lines', () => {
|
||||
|
||||
assert.equal(data.document.lineCount, 4);
|
||||
assert.strictEqual(data.document.lineCount, 4);
|
||||
|
||||
assert.throws(() => data.document.lineAt(-1));
|
||||
assert.throws(() => data.document.lineAt(data.document.lineCount));
|
||||
@@ -89,11 +89,11 @@ suite('ExtHostDocumentData', () => {
|
||||
assert.throws(() => data.document.lineAt(0.8));
|
||||
|
||||
let line = data.document.lineAt(0);
|
||||
assert.equal(line.lineNumber, 0);
|
||||
assert.equal(line.text.length, 16);
|
||||
assert.equal(line.text, 'This is line one');
|
||||
assert.equal(line.isEmptyOrWhitespace, false);
|
||||
assert.equal(line.firstNonWhitespaceCharacterIndex, 0);
|
||||
assert.strictEqual(line.lineNumber, 0);
|
||||
assert.strictEqual(line.text.length, 16);
|
||||
assert.strictEqual(line.text, 'This is line one');
|
||||
assert.strictEqual(line.isEmptyOrWhitespace, false);
|
||||
assert.strictEqual(line.firstNonWhitespaceCharacterIndex, 0);
|
||||
|
||||
data.onEvents({
|
||||
changes: [{
|
||||
@@ -107,31 +107,31 @@ suite('ExtHostDocumentData', () => {
|
||||
});
|
||||
|
||||
// line didn't change
|
||||
assert.equal(line.text, 'This is line one');
|
||||
assert.equal(line.firstNonWhitespaceCharacterIndex, 0);
|
||||
assert.strictEqual(line.text, 'This is line one');
|
||||
assert.strictEqual(line.firstNonWhitespaceCharacterIndex, 0);
|
||||
|
||||
// fetch line again
|
||||
line = data.document.lineAt(0);
|
||||
assert.equal(line.text, '\t This is line one');
|
||||
assert.equal(line.firstNonWhitespaceCharacterIndex, 2);
|
||||
assert.strictEqual(line.text, '\t This is line one');
|
||||
assert.strictEqual(line.firstNonWhitespaceCharacterIndex, 2);
|
||||
});
|
||||
|
||||
test('line, issue #5704', function () {
|
||||
|
||||
let line = data.document.lineAt(0);
|
||||
let { range, rangeIncludingLineBreak } = line;
|
||||
assert.equal(range.end.line, 0);
|
||||
assert.equal(range.end.character, 16);
|
||||
assert.equal(rangeIncludingLineBreak.end.line, 1);
|
||||
assert.equal(rangeIncludingLineBreak.end.character, 0);
|
||||
assert.strictEqual(range.end.line, 0);
|
||||
assert.strictEqual(range.end.character, 16);
|
||||
assert.strictEqual(rangeIncludingLineBreak.end.line, 1);
|
||||
assert.strictEqual(rangeIncludingLineBreak.end.character, 0);
|
||||
|
||||
line = data.document.lineAt(data.document.lineCount - 1);
|
||||
range = line.range;
|
||||
rangeIncludingLineBreak = line.rangeIncludingLineBreak;
|
||||
assert.equal(range.end.line, 3);
|
||||
assert.equal(range.end.character, 29);
|
||||
assert.equal(rangeIncludingLineBreak.end.line, 3);
|
||||
assert.equal(rangeIncludingLineBreak.end.character, 29);
|
||||
assert.strictEqual(range.end.line, 3);
|
||||
assert.strictEqual(range.end.character, 29);
|
||||
assert.strictEqual(rangeIncludingLineBreak.end.line, 3);
|
||||
assert.strictEqual(rangeIncludingLineBreak.end.character, 29);
|
||||
|
||||
});
|
||||
|
||||
@@ -245,28 +245,28 @@ suite('ExtHostDocumentData', () => {
|
||||
], '\n', 1, 'text', false);
|
||||
|
||||
let range = data.document.getWordRangeAtPosition(new Position(0, 2))!;
|
||||
assert.equal(range.start.line, 0);
|
||||
assert.equal(range.start.character, 0);
|
||||
assert.equal(range.end.line, 0);
|
||||
assert.equal(range.end.character, 4);
|
||||
assert.strictEqual(range.start.line, 0);
|
||||
assert.strictEqual(range.start.character, 0);
|
||||
assert.strictEqual(range.end.line, 0);
|
||||
assert.strictEqual(range.end.character, 4);
|
||||
|
||||
// ignore bad regular expresson /.*/
|
||||
assert.throws(() => data.document.getWordRangeAtPosition(new Position(0, 2), /.*/)!);
|
||||
|
||||
range = data.document.getWordRangeAtPosition(new Position(0, 5), /[a-z+]+/)!;
|
||||
assert.equal(range.start.line, 0);
|
||||
assert.equal(range.start.character, 5);
|
||||
assert.equal(range.end.line, 0);
|
||||
assert.equal(range.end.character, 14);
|
||||
assert.strictEqual(range.start.line, 0);
|
||||
assert.strictEqual(range.start.character, 5);
|
||||
assert.strictEqual(range.end.line, 0);
|
||||
assert.strictEqual(range.end.character, 14);
|
||||
|
||||
range = data.document.getWordRangeAtPosition(new Position(0, 17), /[a-z+]+/)!;
|
||||
assert.equal(range.start.line, 0);
|
||||
assert.equal(range.start.character, 15);
|
||||
assert.equal(range.end.line, 0);
|
||||
assert.equal(range.end.character, 18);
|
||||
assert.strictEqual(range.start.line, 0);
|
||||
assert.strictEqual(range.start.character, 15);
|
||||
assert.strictEqual(range.end.line, 0);
|
||||
assert.strictEqual(range.end.character, 18);
|
||||
|
||||
range = data.document.getWordRangeAtPosition(new Position(0, 11), /yy/)!;
|
||||
assert.equal(range, undefined);
|
||||
assert.strictEqual(range, undefined);
|
||||
});
|
||||
|
||||
test('getWordRangeAtPosition doesn\'t quite use the regex as expected, #29102', function () {
|
||||
@@ -279,22 +279,22 @@ suite('ExtHostDocumentData', () => {
|
||||
], '\n', 1, 'text', false);
|
||||
|
||||
let range = data.document.getWordRangeAtPosition(new Position(0, 0), /\/\*.+\*\//);
|
||||
assert.equal(range, undefined);
|
||||
assert.strictEqual(range, undefined);
|
||||
|
||||
range = data.document.getWordRangeAtPosition(new Position(1, 0), /\/\*.+\*\//)!;
|
||||
assert.equal(range.start.line, 1);
|
||||
assert.equal(range.start.character, 0);
|
||||
assert.equal(range.end.line, 1);
|
||||
assert.equal(range.end.character, 14);
|
||||
assert.strictEqual(range.start.line, 1);
|
||||
assert.strictEqual(range.start.character, 0);
|
||||
assert.strictEqual(range.end.line, 1);
|
||||
assert.strictEqual(range.end.character, 14);
|
||||
|
||||
range = data.document.getWordRangeAtPosition(new Position(3, 0), /("|').*\1/);
|
||||
assert.equal(range, undefined);
|
||||
assert.strictEqual(range, undefined);
|
||||
|
||||
range = data.document.getWordRangeAtPosition(new Position(3, 1), /("|').*\1/)!;
|
||||
assert.equal(range.start.line, 3);
|
||||
assert.equal(range.start.character, 1);
|
||||
assert.equal(range.end.line, 3);
|
||||
assert.equal(range.end.character, 10);
|
||||
assert.strictEqual(range.start.line, 3);
|
||||
assert.strictEqual(range.start.character, 1);
|
||||
assert.strictEqual(range.end.line, 3);
|
||||
assert.strictEqual(range.end.character, 10);
|
||||
});
|
||||
|
||||
|
||||
@@ -307,13 +307,13 @@ suite('ExtHostDocumentData', () => {
|
||||
], '\n', 1, 'text', false);
|
||||
|
||||
let range = data.document.getWordRangeAtPosition(new Position(0, 1_177_170), regex)!;
|
||||
assert.equal(range, undefined);
|
||||
assert.strictEqual(range, undefined);
|
||||
|
||||
const pos = new Position(0, 1177170);
|
||||
range = data.document.getWordRangeAtPosition(pos)!;
|
||||
assert.ok(range);
|
||||
assert.ok(range.contains(pos));
|
||||
assert.equal(data.document.getText(range), 'TaskDefinition');
|
||||
assert.strictEqual(data.document.getText(range), 'TaskDefinition');
|
||||
});
|
||||
|
||||
test('Rename popup sometimes populates with text on the left side omitted #96013', function () {
|
||||
@@ -326,10 +326,10 @@ suite('ExtHostDocumentData', () => {
|
||||
], '\n', 1, 'text', false);
|
||||
|
||||
let range = data.document.getWordRangeAtPosition(new Position(0, 27), regex)!;
|
||||
assert.equal(range.start.line, 0);
|
||||
assert.equal(range.end.line, 0);
|
||||
assert.equal(range.start.character, 4);
|
||||
assert.equal(range.end.character, 28);
|
||||
assert.strictEqual(range.start.line, 0);
|
||||
assert.strictEqual(range.end.line, 0);
|
||||
assert.strictEqual(range.start.character, 4);
|
||||
assert.strictEqual(range.end.character, 28);
|
||||
});
|
||||
|
||||
test('Custom snippet $TM_SELECTED_TEXT not show suggestion #108892', function () {
|
||||
@@ -340,11 +340,11 @@ suite('ExtHostDocumentData', () => {
|
||||
|
||||
const pos = new Position(0, 55);
|
||||
const range = data.document.getWordRangeAtPosition(pos)!;
|
||||
assert.equal(range.start.line, 0);
|
||||
assert.equal(range.end.line, 0);
|
||||
assert.equal(range.start.character, 47);
|
||||
assert.equal(range.end.character, 61);
|
||||
assert.equal(data.document.getText(range), 'soprannominato');
|
||||
assert.strictEqual(range.start.line, 0);
|
||||
assert.strictEqual(range.end.line, 0);
|
||||
assert.strictEqual(range.start.character, 47);
|
||||
assert.strictEqual(range.end.character, 61);
|
||||
assert.strictEqual(data.document.getText(range), 'soprannominato');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -365,7 +365,7 @@ suite('ExtHostDocumentData updates line mapping', () => {
|
||||
let line = 0, character = 0, previousIsCarriageReturn = false;
|
||||
for (let offset = 0; offset <= allText.length; offset++) {
|
||||
// The position coordinate system cannot express the position between \r and \n
|
||||
let position = new Position(line, character + (previousIsCarriageReturn ? -1 : 0));
|
||||
const position = new Position(line, character + (previousIsCarriageReturn ? -1 : 0));
|
||||
|
||||
if (direction === AssertDocumentLineMappingDirection.OffsetToPosition) {
|
||||
let actualPosition = doc.document.positionAt(offset);
|
||||
|
||||
@@ -68,8 +68,8 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
sub.dispose();
|
||||
|
||||
assert.ok(event);
|
||||
assert.equal(event.reason, TextDocumentSaveReason.Manual);
|
||||
assert.equal(typeof event.waitUntil, 'function');
|
||||
assert.strictEqual(event.reason, TextDocumentSaveReason.Manual);
|
||||
assert.strictEqual(typeof event.waitUntil, 'function');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -100,7 +100,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
sub.dispose();
|
||||
|
||||
const [first] = values;
|
||||
assert.equal(first, false);
|
||||
assert.strictEqual(first, false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -128,11 +128,11 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
|
||||
let counter = 0;
|
||||
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
assert.equal(counter++, 0);
|
||||
assert.strictEqual(counter++, 0);
|
||||
});
|
||||
|
||||
let sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
assert.equal(counter++, 1);
|
||||
assert.strictEqual(counter++, 1);
|
||||
});
|
||||
|
||||
return participant.$participateInSave(resource, SaveReason.EXPLICIT).then(() => {
|
||||
@@ -156,7 +156,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
await participant.$participateInSave(resource, SaveReason.EXPLICIT);
|
||||
|
||||
sub.dispose();
|
||||
assert.equal(callCount, 2);
|
||||
assert.strictEqual(callCount, 2);
|
||||
});
|
||||
|
||||
test('event delivery, overall timeout', () => {
|
||||
@@ -182,8 +182,8 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
sub2.dispose();
|
||||
sub3.dispose();
|
||||
|
||||
assert.equal(callCount, 2);
|
||||
assert.equal(values.length, 2);
|
||||
assert.strictEqual(callCount, 2);
|
||||
assert.strictEqual(values.length, 2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -226,18 +226,19 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('event delivery, waitUntil will timeout', () => {
|
||||
test('event delivery, waitUntil will timeout', function () {
|
||||
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits, { timeout: 5, errors: 3 });
|
||||
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
event.waitUntil(timeout(15));
|
||||
event.waitUntil(timeout(100));
|
||||
});
|
||||
|
||||
return participant.$participateInSave(resource, SaveReason.EXPLICIT).then(values => {
|
||||
sub.dispose();
|
||||
|
||||
const [first] = values;
|
||||
assert.equal(first, false);
|
||||
assert.strictEqual(first, false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -278,7 +279,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
return participant.$participateInSave(resource, SaveReason.EXPLICIT).then(() => {
|
||||
sub.dispose();
|
||||
|
||||
assert.equal(dto.edits.length, 2);
|
||||
assert.strictEqual(dto.edits.length, 2);
|
||||
assert.ok((<IWorkspaceTextEditDto>dto.edits[0]).edit);
|
||||
assert.ok((<IWorkspaceTextEditDto>dto.edits[1]).edit);
|
||||
});
|
||||
@@ -314,8 +315,8 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
return participant.$participateInSave(resource, SaveReason.EXPLICIT).then(values => {
|
||||
sub.dispose();
|
||||
|
||||
assert.equal(edits, undefined);
|
||||
assert.equal(values[0], false);
|
||||
assert.strictEqual(edits, undefined);
|
||||
assert.strictEqual(values[0], false);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -350,16 +351,16 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
|
||||
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
// the document state we started with
|
||||
assert.equal(document.version, 1);
|
||||
assert.equal(document.getText(), 'foo');
|
||||
assert.strictEqual(document.version, 1);
|
||||
assert.strictEqual(document.getText(), 'foo');
|
||||
|
||||
e.waitUntil(Promise.resolve([TextEdit.insert(new Position(0, 0), 'bar')]));
|
||||
});
|
||||
|
||||
let sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
// the document state AFTER the first listener kicked in
|
||||
assert.equal(document.version, 2);
|
||||
assert.equal(document.getText(), 'barfoo');
|
||||
assert.strictEqual(document.version, 2);
|
||||
assert.strictEqual(document.getText(), 'barfoo');
|
||||
|
||||
e.waitUntil(Promise.resolve([TextEdit.insert(new Position(0, 0), 'bar')]));
|
||||
});
|
||||
@@ -369,8 +370,8 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
sub2.dispose();
|
||||
|
||||
// the document state AFTER eventing is done
|
||||
assert.equal(document.version, 3);
|
||||
assert.equal(document.getText(), 'barbarfoo');
|
||||
assert.strictEqual(document.version, 3);
|
||||
assert.strictEqual(document.getText(), 'barbarfoo');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -390,7 +391,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
|
||||
return participant.$participateInSave(resource, SaveReason.EXPLICIT).then(() => {
|
||||
sub.dispose();
|
||||
assert.equal(didLogSomething, true);
|
||||
assert.strictEqual(didLogSomething, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ suite('ExtHostDocumentsAndEditors', () => {
|
||||
try {
|
||||
|
||||
for (const data of e) {
|
||||
assert.equal(data.document.isClosed, true);
|
||||
assert.strictEqual(data.document.isClosed, true);
|
||||
}
|
||||
resolve(undefined);
|
||||
} catch (e) {
|
||||
|
||||
@@ -20,14 +20,14 @@ suite('ExtHostFileSystemEventService', () => {
|
||||
};
|
||||
|
||||
const watcher1 = new ExtHostFileSystemEventService(protocol, new NullLogService(), undefined!).createFileSystemWatcher('**/somethingInteresting', false, false, false);
|
||||
assert.equal(watcher1.ignoreChangeEvents, false);
|
||||
assert.equal(watcher1.ignoreCreateEvents, false);
|
||||
assert.equal(watcher1.ignoreDeleteEvents, false);
|
||||
assert.strictEqual(watcher1.ignoreChangeEvents, false);
|
||||
assert.strictEqual(watcher1.ignoreCreateEvents, false);
|
||||
assert.strictEqual(watcher1.ignoreDeleteEvents, false);
|
||||
|
||||
const watcher2 = new ExtHostFileSystemEventService(protocol, new NullLogService(), undefined!).createFileSystemWatcher('**/somethingBoring', true, true, true);
|
||||
assert.equal(watcher2.ignoreChangeEvents, true);
|
||||
assert.equal(watcher2.ignoreCreateEvents, true);
|
||||
assert.equal(watcher2.ignoreDeleteEvents, true);
|
||||
assert.strictEqual(watcher2.ignoreChangeEvents, true);
|
||||
assert.strictEqual(watcher2.ignoreCreateEvents, true);
|
||||
assert.strictEqual(watcher2.ignoreDeleteEvents, true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
|
||||
import { MainThreadCommands } from 'vs/workbench/api/browser/mainThreadCommands';
|
||||
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
|
||||
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
|
||||
import { getDocumentSymbols } from 'vs/editor/contrib/gotoSymbol/documentSymbols';
|
||||
import { getDocumentSymbols } from 'vs/editor/contrib/documentSymbols/documentSymbols';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import { getCodeLensModel } from 'vs/editor/contrib/codelens/codelens';
|
||||
import { getDefinitionsAtPosition, getImplementationsAtPosition, getTypeDefinitionsAtPosition, getDeclarationsAtPosition, getReferencesAtPosition } from 'vs/editor/contrib/gotoSymbol/goToSymbol';
|
||||
@@ -127,7 +127,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
// --- outline
|
||||
|
||||
test('DocumentSymbols, register/deregister', async () => {
|
||||
assert.equal(modes.DocumentSymbolProviderRegistry.all(model).length, 0);
|
||||
assert.strictEqual(modes.DocumentSymbolProviderRegistry.all(model).length, 0);
|
||||
let d1 = extHost.registerDocumentSymbolProvider(defaultExtension, defaultSelector, new class implements vscode.DocumentSymbolProvider {
|
||||
provideDocumentSymbols() {
|
||||
return <vscode.SymbolInformation[]>[];
|
||||
@@ -135,7 +135,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
});
|
||||
|
||||
await rpcProtocol.sync();
|
||||
assert.equal(modes.DocumentSymbolProviderRegistry.all(model).length, 1);
|
||||
assert.strictEqual(modes.DocumentSymbolProviderRegistry.all(model).length, 1);
|
||||
d1.dispose();
|
||||
return rpcProtocol.sync();
|
||||
|
||||
@@ -155,7 +155,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getDocumentSymbols(model, true, CancellationToken.None);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
});
|
||||
|
||||
test('DocumentSymbols, data conversion', async () => {
|
||||
@@ -167,10 +167,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getDocumentSymbols(model, true, CancellationToken.None);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let entry = value[0];
|
||||
assert.equal(entry.name, 'test');
|
||||
assert.deepEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.strictEqual(entry.name, 'test');
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
});
|
||||
|
||||
// --- code lens
|
||||
@@ -190,7 +190,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getCodeLensModel(model, CancellationToken.None);
|
||||
assert.equal(value.lenses.length, 1);
|
||||
assert.strictEqual(value.lenses.length, 1);
|
||||
});
|
||||
|
||||
test('CodeLens, do not resolve a resolved lens', async () => {
|
||||
@@ -208,11 +208,11 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getCodeLensModel(model, CancellationToken.None);
|
||||
assert.equal(value.lenses.length, 1);
|
||||
assert.strictEqual(value.lenses.length, 1);
|
||||
const [data] = value.lenses;
|
||||
const symbol = await Promise.resolve(data.provider.resolveCodeLens!(model, data.symbol, CancellationToken.None));
|
||||
assert.equal(symbol!.command!.id, 'id');
|
||||
assert.equal(symbol!.command!.title, 'Title');
|
||||
assert.strictEqual(symbol!.command!.id, 'id');
|
||||
assert.strictEqual(symbol!.command!.title, 'Title');
|
||||
});
|
||||
|
||||
test('CodeLens, missing command', async () => {
|
||||
@@ -225,11 +225,11 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getCodeLensModel(model, CancellationToken.None);
|
||||
assert.equal(value.lenses.length, 1);
|
||||
assert.strictEqual(value.lenses.length, 1);
|
||||
let [data] = value.lenses;
|
||||
const symbol = await Promise.resolve(data.provider.resolveCodeLens!(model, data.symbol, CancellationToken.None));
|
||||
assert.equal(symbol!.command!.id, 'missing');
|
||||
assert.equal(symbol!.command!.title, '!!MISSING: command!!');
|
||||
assert.strictEqual(symbol!.command!.id, 'missing');
|
||||
assert.strictEqual(symbol!.command!.title, '!!MISSING: command!!');
|
||||
});
|
||||
|
||||
// --- definition
|
||||
@@ -244,10 +244,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getDefinitionsAtPosition(model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.equal(entry.uri.toString(), model.uri.toString());
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.strictEqual(entry.uri.toString(), model.uri.toString());
|
||||
});
|
||||
|
||||
test('Definition, one or many', async () => {
|
||||
@@ -265,7 +265,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getDefinitionsAtPosition(model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.equal(value.length, 2);
|
||||
assert.strictEqual(value.length, 2);
|
||||
});
|
||||
|
||||
test('Definition, registration order', async () => {
|
||||
@@ -284,10 +284,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getDefinitionsAtPosition(model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.equal(value.length, 2);
|
||||
assert.strictEqual(value.length, 2);
|
||||
// let [first, second] = value;
|
||||
assert.equal(value[0].uri.authority, 'second');
|
||||
assert.equal(value[1].uri.authority, 'first');
|
||||
assert.strictEqual(value[0].uri.authority, 'second');
|
||||
assert.strictEqual(value[1].uri.authority, 'first');
|
||||
});
|
||||
|
||||
test('Definition, evil provider', async () => {
|
||||
@@ -305,7 +305,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getDefinitionsAtPosition(model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
});
|
||||
|
||||
// -- declaration
|
||||
@@ -320,10 +320,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getDeclarationsAtPosition(model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.equal(entry.uri.toString(), model.uri.toString());
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.strictEqual(entry.uri.toString(), model.uri.toString());
|
||||
});
|
||||
|
||||
// --- implementation
|
||||
@@ -338,10 +338,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getImplementationsAtPosition(model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.equal(entry.uri.toString(), model.uri.toString());
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.strictEqual(entry.uri.toString(), model.uri.toString());
|
||||
});
|
||||
|
||||
// --- type definition
|
||||
@@ -356,10 +356,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getTypeDefinitionsAtPosition(model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.equal(entry.uri.toString(), model.uri.toString());
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.strictEqual(entry.uri.toString(), model.uri.toString());
|
||||
});
|
||||
|
||||
// --- extra info
|
||||
@@ -374,9 +374,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
getHover(model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 5 });
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 5 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -391,9 +391,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
getHover(model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 4, startColumn: 1, endLineNumber: 9, endColumn: 8 });
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 4, startColumn: 1, endLineNumber: 9, endColumn: 8 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -414,10 +414,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getHover(model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.equal(value.length, 2);
|
||||
assert.strictEqual(value.length, 2);
|
||||
let [first, second] = (value as modes.Hover[]);
|
||||
assert.equal(first.contents[0].value, 'registered second');
|
||||
assert.equal(second.contents[0].value, 'registered first');
|
||||
assert.strictEqual(first.contents[0].value, 'registered second');
|
||||
assert.strictEqual(second.contents[0].value, 'registered first');
|
||||
});
|
||||
|
||||
|
||||
@@ -436,7 +436,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
getHover(model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -452,10 +452,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = (await getOccurrencesAtPosition(model, new EditorPosition(1, 2), CancellationToken.None))!;
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 5 });
|
||||
assert.equal(entry.kind, modes.DocumentHighlightKind.Text);
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 5 });
|
||||
assert.strictEqual(entry.kind, modes.DocumentHighlightKind.Text);
|
||||
});
|
||||
|
||||
test('Occurrences, order 1/2', async () => {
|
||||
@@ -473,10 +473,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = (await getOccurrencesAtPosition(model, new EditorPosition(1, 2), CancellationToken.None))!;
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 5 });
|
||||
assert.equal(entry.kind, modes.DocumentHighlightKind.Text);
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 5 });
|
||||
assert.strictEqual(entry.kind, modes.DocumentHighlightKind.Text);
|
||||
});
|
||||
|
||||
test('Occurrences, order 2/2', async () => {
|
||||
@@ -494,10 +494,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = (await getOccurrencesAtPosition(model, new EditorPosition(1, 2), CancellationToken.None))!;
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [entry] = value;
|
||||
assert.deepEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 3 });
|
||||
assert.equal(entry.kind, modes.DocumentHighlightKind.Text);
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 3 });
|
||||
assert.strictEqual(entry.kind, modes.DocumentHighlightKind.Text);
|
||||
});
|
||||
|
||||
test('Occurrences, evil provider', async () => {
|
||||
@@ -516,7 +516,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getOccurrencesAtPosition(model, new EditorPosition(1, 2), CancellationToken.None);
|
||||
assert.equal(value!.length, 1);
|
||||
assert.strictEqual(value!.length, 1);
|
||||
});
|
||||
|
||||
// --- references
|
||||
@@ -537,10 +537,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getReferencesAtPosition(model, new EditorPosition(1, 2), false, CancellationToken.None);
|
||||
assert.equal(value.length, 2);
|
||||
assert.strictEqual(value.length, 2);
|
||||
let [first, second] = value;
|
||||
assert.equal(first.uri.path, '/second');
|
||||
assert.equal(second.uri.path, '/first');
|
||||
assert.strictEqual(first.uri.path, '/second');
|
||||
assert.strictEqual(second.uri.path, '/first');
|
||||
});
|
||||
|
||||
test('References, data conversion', async () => {
|
||||
@@ -553,10 +553,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getReferencesAtPosition(model, new EditorPosition(1, 2), false, CancellationToken.None);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [item] = value;
|
||||
assert.deepEqual(item.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.equal(item.uri.toString(), model.uri.toString());
|
||||
assert.deepStrictEqual(item.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.strictEqual(item.uri.toString(), model.uri.toString());
|
||||
});
|
||||
|
||||
test('References, evil provider', async () => {
|
||||
@@ -574,7 +574,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await getReferencesAtPosition(model, new EditorPosition(1, 2), false, CancellationToken.None);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
});
|
||||
|
||||
// --- quick fix
|
||||
@@ -592,12 +592,12 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 2);
|
||||
assert.strictEqual(actions.length, 2);
|
||||
const [first, second] = actions;
|
||||
assert.equal(first.action.title, 'Testing1');
|
||||
assert.equal(first.action.command!.id, 'test1');
|
||||
assert.equal(second.action.title, 'Testing2');
|
||||
assert.equal(second.action.command!.id, 'test2');
|
||||
assert.strictEqual(first.action.title, 'Testing1');
|
||||
assert.strictEqual(first.action.command!.id, 'test1');
|
||||
assert.strictEqual(second.action.title, 'Testing2');
|
||||
assert.strictEqual(second.action.command!.id, 'test2');
|
||||
});
|
||||
|
||||
test('Quick Fix, code action data conversion', async () => {
|
||||
@@ -616,12 +616,12 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
assert.strictEqual(actions.length, 1);
|
||||
const [first] = actions;
|
||||
assert.equal(first.action.title, 'Testing1');
|
||||
assert.equal(first.action.command!.title, 'Testing1Command');
|
||||
assert.equal(first.action.command!.id, 'test1');
|
||||
assert.equal(first.action.kind, 'test.scope');
|
||||
assert.strictEqual(first.action.title, 'Testing1');
|
||||
assert.strictEqual(first.action.command!.title, 'Testing1Command');
|
||||
assert.strictEqual(first.action.command!.id, 'test1');
|
||||
assert.strictEqual(first.action.kind, 'test.scope');
|
||||
});
|
||||
|
||||
|
||||
@@ -639,7 +639,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
assert.strictEqual(actions.length, 1);
|
||||
});
|
||||
|
||||
test('Quick Fix, evil provider', async () => {
|
||||
@@ -657,7 +657,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
assert.strictEqual(actions.length, 1);
|
||||
});
|
||||
|
||||
// --- navigate types
|
||||
@@ -678,11 +678,11 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getWorkspaceSymbols('');
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [first] = value;
|
||||
const [, symbols] = first;
|
||||
assert.equal(symbols.length, 1);
|
||||
assert.equal(symbols[0].name, 'testing');
|
||||
assert.strictEqual(symbols.length, 1);
|
||||
assert.strictEqual(symbols[0].name, 'testing');
|
||||
});
|
||||
|
||||
// --- rename
|
||||
@@ -715,7 +715,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await rename(model, new EditorPosition(1, 1), 'newName');
|
||||
assert.equal(value.rejectReason, 'evil');
|
||||
assert.strictEqual(value.rejectReason, 'evil');
|
||||
});
|
||||
|
||||
test('Rename, evil provider 2/2', async () => {
|
||||
@@ -736,7 +736,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await rename(model, new EditorPosition(1, 1), 'newName');
|
||||
assert.equal(value.edits.length, 1);
|
||||
assert.strictEqual(value.edits.length, 1);
|
||||
});
|
||||
|
||||
test('Rename, ordering', async () => {
|
||||
@@ -759,7 +759,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
await rpcProtocol.sync();
|
||||
const value = await rename(model, new EditorPosition(1, 1), 'newName');
|
||||
// least relevant rename provider
|
||||
assert.equal(value.edits.length, 2);
|
||||
assert.strictEqual(value.edits.length, 2);
|
||||
});
|
||||
|
||||
test('Multiple RenameProviders don\'t respect all possible PrepareRename handlers, #98352', async function () {
|
||||
@@ -793,7 +793,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
await rpcProtocol.sync();
|
||||
await rename(model, new EditorPosition(1, 1), 'newName');
|
||||
|
||||
assert.deepEqual(called, [true, true, true, false]);
|
||||
assert.deepStrictEqual(called, [true, true, true, false]);
|
||||
});
|
||||
|
||||
test('Multiple RenameProviders don\'t respect all possible PrepareRename handlers, #98352', async function () {
|
||||
@@ -825,7 +825,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
await rename(model, new EditorPosition(1, 1), 'newName');
|
||||
|
||||
// first provider has NO prepare which means it is taken by default
|
||||
assert.deepEqual(called, [false, false, true]);
|
||||
assert.deepStrictEqual(called, [false, false, true]);
|
||||
});
|
||||
|
||||
// --- parameter hints
|
||||
@@ -863,7 +863,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = await provideSignatureHelp(model, new EditorPosition(1, 1), { triggerKind: modes.SignatureHelpTriggerKind.Invoke, isRetrigger: false }, CancellationToken.None);
|
||||
assert.equal(value, undefined);
|
||||
assert.strictEqual(value, undefined);
|
||||
});
|
||||
|
||||
// --- suggestions
|
||||
@@ -884,8 +884,8 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { items } = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
|
||||
assert.equal(items.length, 1);
|
||||
assert.equal(items[0].completion.insertText, 'testing2');
|
||||
assert.strictEqual(items.length, 1);
|
||||
assert.strictEqual(items[0].completion.insertText, 'testing2');
|
||||
});
|
||||
|
||||
test('Suggest, order 2/3', async () => {
|
||||
@@ -904,8 +904,8 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { items } = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
|
||||
assert.equal(items.length, 1);
|
||||
assert.equal(items[0].completion.insertText, 'weak-selector');
|
||||
assert.strictEqual(items.length, 1);
|
||||
assert.strictEqual(items[0].completion.insertText, 'weak-selector');
|
||||
});
|
||||
|
||||
test('Suggest, order 2/3', async () => {
|
||||
@@ -924,9 +924,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { items } = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
|
||||
assert.equal(items.length, 2);
|
||||
assert.equal(items[0].completion.insertText, 'strong-1'); // sort by label
|
||||
assert.equal(items[1].completion.insertText, 'strong-2');
|
||||
assert.strictEqual(items.length, 2);
|
||||
assert.strictEqual(items[0].completion.insertText, 'strong-1'); // sort by label
|
||||
assert.strictEqual(items[1].completion.insertText, 'strong-2');
|
||||
});
|
||||
|
||||
test('Suggest, evil provider', async () => {
|
||||
@@ -946,7 +946,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { items } = await provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet)));
|
||||
assert.equal(items[0].container.incomplete, false);
|
||||
assert.strictEqual(items[0].container.incomplete, false);
|
||||
});
|
||||
|
||||
test('Suggest, CompletionList', async () => {
|
||||
@@ -959,7 +959,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
provideSuggestionItems(model, new EditorPosition(1, 1), new CompletionOptions(undefined, new Set<modes.CompletionItemKind>().add(modes.CompletionItemKind.Snippet))).then(model => {
|
||||
assert.equal(model.items[0].container.incomplete, true);
|
||||
assert.strictEqual(model.items[0].container.incomplete, true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -980,13 +980,13 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = (await getDocumentFormattingEditsUntilResult(NullWorkerService, model, { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
assert.equal(value.length, 2);
|
||||
assert.strictEqual(value.length, 2);
|
||||
let [first, second] = value;
|
||||
assert.equal(first.text, 'testing');
|
||||
assert.deepEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.equal(second.eol, EndOfLineSequence.LF);
|
||||
assert.equal(second.text, '');
|
||||
assert.deepEqual(second.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.strictEqual(first.text, 'testing');
|
||||
assert.deepStrictEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.strictEqual(second.eol, EndOfLineSequence.LF);
|
||||
assert.strictEqual(second.text, '');
|
||||
assert.deepStrictEqual(second.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
});
|
||||
|
||||
test('Format Doc, evil provider', async () => {
|
||||
@@ -1022,10 +1022,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = (await getDocumentFormattingEditsUntilResult(NullWorkerService, model, { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
assert.equal(first.text, 'testing');
|
||||
assert.deepEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.strictEqual(first.text, 'testing');
|
||||
assert.deepStrictEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
});
|
||||
|
||||
test('Format Range, data conversion', async () => {
|
||||
@@ -1037,10 +1037,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = (await getDocumentRangeFormattingEditsUntilResult(NullWorkerService, model, new EditorRange(1, 1, 1, 1), { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [first] = value;
|
||||
assert.equal(first.text, 'testing');
|
||||
assert.deepEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.strictEqual(first.text, 'testing');
|
||||
assert.deepStrictEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
});
|
||||
|
||||
test('Format Range, + format_doc', async () => {
|
||||
@@ -1061,13 +1061,13 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
await rpcProtocol.sync();
|
||||
const value = (await getDocumentRangeFormattingEditsUntilResult(NullWorkerService, model, new EditorRange(1, 1, 1, 1), { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [first] = value;
|
||||
assert.equal(first.text, 'range2');
|
||||
assert.equal(first.range.startLineNumber, 3);
|
||||
assert.equal(first.range.startColumn, 4);
|
||||
assert.equal(first.range.endLineNumber, 5);
|
||||
assert.equal(first.range.endColumn, 6);
|
||||
assert.strictEqual(first.text, 'range2');
|
||||
assert.strictEqual(first.range.startLineNumber, 3);
|
||||
assert.strictEqual(first.range.startColumn, 4);
|
||||
assert.strictEqual(first.range.endLineNumber, 5);
|
||||
assert.strictEqual(first.range.endColumn, 6);
|
||||
});
|
||||
|
||||
test('Format Range, evil provider', async () => {
|
||||
@@ -1091,10 +1091,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const value = (await getOnTypeFormattingEdits(NullWorkerService, model, new EditorPosition(1, 1), ';', { insertSpaces: true, tabSize: 2 }))!;
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [first] = value;
|
||||
assert.equal(first.text, ';');
|
||||
assert.deepEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.strictEqual(first.text, ';');
|
||||
assert.deepStrictEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
});
|
||||
|
||||
test('Links, data conversion', async () => {
|
||||
@@ -1109,11 +1109,11 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let { links } = await getLinks(model, CancellationToken.None);
|
||||
assert.equal(links.length, 1);
|
||||
assert.strictEqual(links.length, 1);
|
||||
let [first] = links;
|
||||
assert.equal(first.url, 'foo:bar#3');
|
||||
assert.deepEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 2, endColumn: 2 });
|
||||
assert.equal(first.tooltip, 'tooltip');
|
||||
assert.strictEqual(first.url?.toString(), 'foo:bar#3');
|
||||
assert.deepStrictEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 2, endColumn: 2 });
|
||||
assert.strictEqual(first.tooltip, 'tooltip');
|
||||
});
|
||||
|
||||
test('Links, evil provider', async () => {
|
||||
@@ -1132,10 +1132,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let { links } = await getLinks(model, CancellationToken.None);
|
||||
assert.equal(links.length, 1);
|
||||
assert.strictEqual(links.length, 1);
|
||||
let [first] = links;
|
||||
assert.equal(first.url, 'foo:bar#3');
|
||||
assert.deepEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 2, endColumn: 2 });
|
||||
assert.strictEqual(first.url?.toString(), 'foo:bar#3');
|
||||
assert.deepStrictEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 2, endColumn: 2 });
|
||||
});
|
||||
|
||||
test('Document colors, data conversion', async () => {
|
||||
@@ -1151,10 +1151,10 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getColors(model, CancellationToken.None);
|
||||
assert.equal(value.length, 1);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
assert.deepEqual(first.colorInfo.color, { red: 0.1, green: 0.2, blue: 0.3, alpha: 0.4 });
|
||||
assert.deepEqual(first.colorInfo.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 21 });
|
||||
assert.deepStrictEqual(first.colorInfo.color, { red: 0.1, green: 0.2, blue: 0.3, alpha: 0.4 });
|
||||
assert.deepStrictEqual(first.colorInfo.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 21 });
|
||||
});
|
||||
|
||||
// -- selection ranges
|
||||
@@ -1171,7 +1171,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
await rpcProtocol.sync();
|
||||
|
||||
provideSelectionRanges(model, [new Position(1, 17)], { selectLeadingAndTrailingWhitespace: true }, CancellationToken.None).then(ranges => {
|
||||
assert.equal(ranges.length, 1);
|
||||
assert.strictEqual(ranges.length, 1);
|
||||
assert.ok(ranges[0].length >= 2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -101,28 +101,28 @@ suite('ExtHostMessageService', function () {
|
||||
test('propagte handle on select', async function () {
|
||||
|
||||
let service = new MainThreadMessageService(null!, new EmptyNotificationService(notification => {
|
||||
assert.equal(notification.actions!.primary!.length, 1);
|
||||
assert.strictEqual(notification.actions!.primary!.length, 1);
|
||||
platform.setImmediate(() => notification.actions!.primary![0].run());
|
||||
}), emptyCommandService, emptyDialogService);
|
||||
|
||||
const handle = await service.$showMessage(1, 'h', {}, [{ handle: 42, title: 'a thing', isCloseAffordance: true }]);
|
||||
assert.equal(handle, 42);
|
||||
assert.strictEqual(handle, 42);
|
||||
});
|
||||
|
||||
suite('modal', () => {
|
||||
test('calls dialog service', async () => {
|
||||
const service = new MainThreadMessageService(null!, emptyNotificationService, emptyCommandService, new class extends mock<IDialogService>() {
|
||||
show(severity: Severity, message: string, buttons: string[]) {
|
||||
assert.equal(severity, 1);
|
||||
assert.equal(message, 'h');
|
||||
assert.equal(buttons.length, 2);
|
||||
assert.equal(buttons[1], 'Cancel');
|
||||
assert.strictEqual(severity, 1);
|
||||
assert.strictEqual(message, 'h');
|
||||
assert.strictEqual(buttons.length, 2);
|
||||
assert.strictEqual(buttons[1], 'Cancel');
|
||||
return Promise.resolve({ choice: 0 });
|
||||
}
|
||||
} as IDialogService);
|
||||
|
||||
const handle = await service.$showMessage(1, 'h', { modal: true }, [{ handle: 42, title: 'a thing', isCloseAffordance: false }]);
|
||||
assert.equal(handle, 42);
|
||||
assert.strictEqual(handle, 42);
|
||||
});
|
||||
|
||||
test('returns undefined when cancelled', async () => {
|
||||
@@ -133,19 +133,19 @@ suite('ExtHostMessageService', function () {
|
||||
} as IDialogService);
|
||||
|
||||
const handle = await service.$showMessage(1, 'h', { modal: true }, [{ handle: 42, title: 'a thing', isCloseAffordance: false }]);
|
||||
assert.equal(handle, undefined);
|
||||
assert.strictEqual(handle, undefined);
|
||||
});
|
||||
|
||||
test('hides Cancel button when not needed', async () => {
|
||||
const service = new MainThreadMessageService(null!, emptyNotificationService, emptyCommandService, new class extends mock<IDialogService>() {
|
||||
show(severity: Severity, message: string, buttons: string[]) {
|
||||
assert.equal(buttons.length, 1);
|
||||
assert.strictEqual(buttons.length, 1);
|
||||
return Promise.resolve({ choice: 0 });
|
||||
}
|
||||
} as IDialogService);
|
||||
|
||||
const handle = await service.$showMessage(1, 'h', { modal: true }, [{ handle: 42, title: 'a thing', isCloseAffordance: true }]);
|
||||
assert.equal(handle, 42);
|
||||
assert.strictEqual(handle, 42);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -104,14 +104,14 @@ suite('NotebookCell#Document', function () {
|
||||
const d1 = extHostDocuments.getDocument(c1.uri);
|
||||
|
||||
assert.ok(d1);
|
||||
assert.equal(d1.languageId, c1.language);
|
||||
assert.equal(d1.version, 1);
|
||||
assert.strictEqual(d1.languageId, c1.language);
|
||||
assert.strictEqual(d1.version, 1);
|
||||
assert.ok(d1.notebook === notebook.notebookDocument);
|
||||
|
||||
const d2 = extHostDocuments.getDocument(c2.uri);
|
||||
assert.ok(d2);
|
||||
assert.equal(d2.languageId, c2.language);
|
||||
assert.equal(d2.version, 1);
|
||||
assert.strictEqual(d2.languageId, c2.language);
|
||||
assert.strictEqual(d2.version, 1);
|
||||
assert.ok(d2.notebook === notebook.notebookDocument);
|
||||
});
|
||||
|
||||
@@ -197,7 +197,7 @@ suite('NotebookCell#Document', function () {
|
||||
for (let cell of notebook.notebookDocument.cells) {
|
||||
const doc = extHostDocuments.getDocument(cell.uri);
|
||||
assert.ok(doc);
|
||||
assert.equal(extHostDocuments.getDocument(cell.uri).isClosed, false);
|
||||
assert.strictEqual(extHostDocuments.getDocument(cell.uri).isClosed, false);
|
||||
docs.push(doc);
|
||||
addData.push({
|
||||
EOL: '\n',
|
||||
@@ -218,7 +218,7 @@ suite('NotebookCell#Document', function () {
|
||||
// notebook is still open -> cell documents stay open
|
||||
for (let cell of notebook.notebookDocument.cells) {
|
||||
assert.ok(extHostDocuments.getDocument(cell.uri));
|
||||
assert.equal(extHostDocuments.getDocument(cell.uri).isClosed, false);
|
||||
assert.strictEqual(extHostDocuments.getDocument(cell.uri).isClosed, false);
|
||||
}
|
||||
|
||||
// close notebook -> docs are closed
|
||||
@@ -227,13 +227,13 @@ suite('NotebookCell#Document', function () {
|
||||
assert.throws(() => extHostDocuments.getDocument(cell.uri));
|
||||
}
|
||||
for (let doc of docs) {
|
||||
assert.equal(doc.isClosed, true);
|
||||
assert.strictEqual(doc.isClosed, true);
|
||||
}
|
||||
});
|
||||
|
||||
test('cell document goes when cell is removed', async function () {
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 2);
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 2);
|
||||
const [cell1, cell2] = notebook.notebookDocument.cells;
|
||||
|
||||
extHostNotebooks.$acceptModelChanged(notebook.uri, {
|
||||
@@ -246,25 +246,25 @@ suite('NotebookCell#Document', function () {
|
||||
]
|
||||
}, false);
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1);
|
||||
assert.equal(cell1.document.isClosed, true); // ref still alive!
|
||||
assert.equal(cell2.document.isClosed, false);
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1);
|
||||
assert.strictEqual(cell1.document.isClosed, true); // ref still alive!
|
||||
assert.strictEqual(cell2.document.isClosed, false);
|
||||
|
||||
assert.throws(() => extHostDocuments.getDocument(cell1.uri));
|
||||
});
|
||||
|
||||
test('cell document knows notebook', function () {
|
||||
for (let cells of notebook.notebookDocument.cells) {
|
||||
assert.equal(cells.document.notebook === notebook.notebookDocument, true);
|
||||
assert.strictEqual(cells.document.notebook === notebook.notebookDocument, true);
|
||||
}
|
||||
});
|
||||
|
||||
test('cell#index', function () {
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 2);
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 2);
|
||||
const [first, second] = notebook.notebookDocument.cells;
|
||||
assert.equal(first.index, 0);
|
||||
assert.equal(second.index, 1);
|
||||
assert.strictEqual(first.index, 0);
|
||||
assert.strictEqual(second.index, 1);
|
||||
|
||||
// remove first cell
|
||||
extHostNotebooks.$acceptModelChanged(notebook.uri, {
|
||||
@@ -275,8 +275,8 @@ suite('NotebookCell#Document', function () {
|
||||
}]
|
||||
}, false);
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1);
|
||||
assert.equal(second.index, 0);
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1);
|
||||
assert.strictEqual(second.index, 0);
|
||||
|
||||
extHostNotebooks.$acceptModelChanged(notebookUri, {
|
||||
versionId: notebook.notebookDocument.version + 1,
|
||||
@@ -302,7 +302,7 @@ suite('NotebookCell#Document', function () {
|
||||
}]
|
||||
}, false);
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 3);
|
||||
assert.equal(second.index, 2);
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 3);
|
||||
assert.strictEqual(second.index, 2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -91,27 +91,27 @@ suite('NotebookConcatDocument', function () {
|
||||
|
||||
test('empty', function () {
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.notebookDocument, undefined);
|
||||
assert.equal(doc.getText(), '');
|
||||
assert.equal(doc.version, 0);
|
||||
assert.strictEqual(doc.getText(), '');
|
||||
assert.strictEqual(doc.version, 0);
|
||||
|
||||
// assert.equal(doc.locationAt(new Position(0, 0)), undefined);
|
||||
// assert.equal(doc.positionAt(SOME_FAKE_LOCATION?), undefined);
|
||||
// assert.strictEqual(doc.locationAt(new Position(0, 0)), undefined);
|
||||
// assert.strictEqual(doc.positionAt(SOME_FAKE_LOCATION?), undefined);
|
||||
});
|
||||
|
||||
|
||||
function assertLocation(doc: vscode.NotebookConcatTextDocument, pos: Position, expected: Location, reverse = true) {
|
||||
const actual = doc.locationAt(pos);
|
||||
assert.equal(actual.uri.toString(), expected.uri.toString());
|
||||
assert.equal(actual.range.isEqual(expected.range), true);
|
||||
assert.strictEqual(actual.uri.toString(), expected.uri.toString());
|
||||
assert.strictEqual(actual.range.isEqual(expected.range), true);
|
||||
|
||||
if (reverse) {
|
||||
// reverse - offset
|
||||
const offset = doc.offsetAt(pos);
|
||||
assert.equal(doc.positionAt(offset).isEqual(pos), true);
|
||||
assert.strictEqual(doc.positionAt(offset).isEqual(pos), true);
|
||||
|
||||
// reverse - pos
|
||||
const actualPosition = doc.positionAt(actual);
|
||||
assert.equal(actualPosition.isEqual(pos), true);
|
||||
assert.strictEqual(actualPosition.isEqual(pos), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,13 +151,13 @@ suite('NotebookConcatDocument', function () {
|
||||
}, false);
|
||||
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.notebookDocument, undefined);
|
||||
|
||||
assert.equal(doc.contains(cellUri1), true);
|
||||
assert.equal(doc.contains(cellUri2), true);
|
||||
assert.equal(doc.contains(URI.parse('some://miss/path')), false);
|
||||
assert.strictEqual(doc.contains(cellUri1), true);
|
||||
assert.strictEqual(doc.contains(cellUri2), true);
|
||||
assert.strictEqual(doc.contains(URI.parse('some://miss/path')), false);
|
||||
});
|
||||
|
||||
test('location, position mapping', function () {
|
||||
@@ -189,7 +189,7 @@ suite('NotebookConcatDocument', function () {
|
||||
}, false);
|
||||
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.notebookDocument, undefined);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
@@ -224,8 +224,8 @@ suite('NotebookConcatDocument', function () {
|
||||
}
|
||||
]
|
||||
}, false);
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1 + 1);
|
||||
assert.equal(doc.version, 1);
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1 + 1);
|
||||
assert.strictEqual(doc.version, 1);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!');
|
||||
|
||||
assertLocation(doc, new Position(0, 0), new Location(notebook.notebookDocument.cells[0].uri, new Position(0, 0)));
|
||||
@@ -252,8 +252,8 @@ suite('NotebookConcatDocument', function () {
|
||||
]
|
||||
}, false);
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1 + 2);
|
||||
assert.equal(doc.version, 2);
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1 + 2);
|
||||
assert.strictEqual(doc.version, 2);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
assertLocation(doc, new Position(0, 0), new Location(notebook.notebookDocument.cells[0].uri, new Position(0, 0)));
|
||||
assertLocation(doc, new Position(4, 0), new Location(notebook.notebookDocument.cells[1].uri, new Position(1, 0)));
|
||||
@@ -271,8 +271,8 @@ suite('NotebookConcatDocument', function () {
|
||||
}
|
||||
]
|
||||
}, false);
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1 + 1);
|
||||
assert.equal(doc.version, 3);
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1 + 1);
|
||||
assert.strictEqual(doc.version, 3);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!');
|
||||
assertLocation(doc, new Position(0, 0), new Location(notebook.notebookDocument.cells[0].uri, new Position(0, 0)));
|
||||
assertLocation(doc, new Position(2, 2), new Location(notebook.notebookDocument.cells[0].uri, new Position(2, 2)));
|
||||
@@ -310,8 +310,8 @@ suite('NotebookConcatDocument', function () {
|
||||
}
|
||||
]
|
||||
}, false);
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1 + 2);
|
||||
assert.equal(doc.version, 1);
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1 + 2);
|
||||
assert.strictEqual(doc.version, 1);
|
||||
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
assertLocation(doc, new Position(0, 0), new Location(notebook.notebookDocument.cells[0].uri, new Position(0, 0)));
|
||||
@@ -322,7 +322,7 @@ suite('NotebookConcatDocument', function () {
|
||||
|
||||
// offset math
|
||||
let cell1End = doc.offsetAt(new Position(2, 12));
|
||||
assert.equal(doc.positionAt(cell1End).isEqual(new Position(2, 12)), true);
|
||||
assert.strictEqual(doc.positionAt(cell1End).isEqual(new Position(2, 12)), true);
|
||||
|
||||
extHostDocuments.$acceptModelChanged(notebook.notebookDocument.cells[0].uri, {
|
||||
versionId: 0,
|
||||
@@ -337,7 +337,7 @@ suite('NotebookConcatDocument', function () {
|
||||
assertLines(doc, 'Hello', 'World', 'Hi World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
assertLocation(doc, new Position(2, 12), new Location(notebook.notebookDocument.cells[0].uri, new Position(2, 9)), false);
|
||||
|
||||
assert.equal(doc.positionAt(cell1End).isEqual(new Position(3, 2)), true);
|
||||
assert.strictEqual(doc.positionAt(cell1End).isEqual(new Position(3, 2)), true);
|
||||
|
||||
});
|
||||
|
||||
@@ -403,12 +403,12 @@ suite('NotebookConcatDocument', function () {
|
||||
function assertOffsetAtPosition(doc: vscode.NotebookConcatTextDocument, offset: number, expected: { line: number, character: number }, reverse = true) {
|
||||
const actual = doc.positionAt(offset);
|
||||
|
||||
assert.equal(actual.line, expected.line);
|
||||
assert.equal(actual.character, expected.character);
|
||||
assert.strictEqual(actual.line, expected.line);
|
||||
assert.strictEqual(actual.character, expected.character);
|
||||
|
||||
if (reverse) {
|
||||
const actualOffset = doc.offsetAt(actual);
|
||||
assert.equal(actualOffset, offset);
|
||||
assert.strictEqual(actualOffset, offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ suite('NotebookConcatDocument', function () {
|
||||
]
|
||||
}, false);
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.notebookDocument, undefined);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
@@ -457,16 +457,16 @@ suite('NotebookConcatDocument', function () {
|
||||
function assertLocationAtPosition(doc: vscode.NotebookConcatTextDocument, pos: { line: number, character: number }, expected: { uri: URI, line: number, character: number }, reverse = true) {
|
||||
|
||||
const actual = doc.locationAt(new Position(pos.line, pos.character));
|
||||
assert.equal(actual.uri.toString(), expected.uri.toString());
|
||||
assert.equal(actual.range.start.line, expected.line);
|
||||
assert.equal(actual.range.end.line, expected.line);
|
||||
assert.equal(actual.range.start.character, expected.character);
|
||||
assert.equal(actual.range.end.character, expected.character);
|
||||
assert.strictEqual(actual.uri.toString(), expected.uri.toString());
|
||||
assert.strictEqual(actual.range.start.line, expected.line);
|
||||
assert.strictEqual(actual.range.end.line, expected.line);
|
||||
assert.strictEqual(actual.range.start.character, expected.character);
|
||||
assert.strictEqual(actual.range.end.character, expected.character);
|
||||
|
||||
if (reverse) {
|
||||
const actualPos = doc.positionAt(actual);
|
||||
assert.equal(actualPos.line, pos.line);
|
||||
assert.equal(actualPos.character, pos.character);
|
||||
assert.strictEqual(actualPos.line, pos.line);
|
||||
assert.strictEqual(actualPos.character, pos.character);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,7 +498,7 @@ suite('NotebookConcatDocument', function () {
|
||||
]
|
||||
}, false);
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.notebookDocument, undefined);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
@@ -539,14 +539,14 @@ suite('NotebookConcatDocument', function () {
|
||||
]
|
||||
}, false);
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.notebookDocument, undefined);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
|
||||
assert.equal(doc.getText(new Range(0, 0, 0, 0)), '');
|
||||
assert.equal(doc.getText(new Range(0, 0, 1, 0)), 'Hello\n');
|
||||
assert.equal(doc.getText(new Range(2, 0, 4, 0)), 'Hello World!\nHallo\n');
|
||||
assert.strictEqual(doc.getText(new Range(0, 0, 0, 0)), '');
|
||||
assert.strictEqual(doc.getText(new Range(0, 0, 1, 0)), 'Hello\n');
|
||||
assert.strictEqual(doc.getText(new Range(2, 0, 4, 0)), 'Hello World!\nHallo\n');
|
||||
});
|
||||
|
||||
test('validateRange/Position', function () {
|
||||
@@ -577,15 +577,15 @@ suite('NotebookConcatDocument', function () {
|
||||
]
|
||||
}, false);
|
||||
|
||||
assert.equal(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
assert.strictEqual(notebook.notebookDocument.cells.length, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.notebookDocument, undefined);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
|
||||
|
||||
function assertPosition(actual: vscode.Position, expectedLine: number, expectedCh: number) {
|
||||
assert.equal(actual.line, expectedLine);
|
||||
assert.equal(actual.character, expectedCh);
|
||||
assert.strictEqual(actual.line, expectedLine);
|
||||
assert.strictEqual(actual.character, expectedCh);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,24 +4,22 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { MirroredTestCollection, OwnedTestCollection, SingleUseTestCollection } from 'vs/workbench/api/common/extHostTesting';
|
||||
import { MirroredTestCollection, TestItemFilteredWrapper } from 'vs/workbench/api/common/extHostTesting';
|
||||
import * as convert from 'vs/workbench/api/common/extHostTypeConverters';
|
||||
import { TestRunState, TestState } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { TestDiffOpType, TestsDiff } from 'vs/workbench/contrib/testing/common/testCollection';
|
||||
import { TestChangeEvent, TestItem } from 'vscode';
|
||||
|
||||
const stubTest = (label: string): TestItem => ({
|
||||
label,
|
||||
location: undefined,
|
||||
state: new TestState(TestRunState.Unset),
|
||||
debuggable: true,
|
||||
runnable: true,
|
||||
description: ''
|
||||
});
|
||||
import { TestDiffOpType } from 'vs/workbench/contrib/testing/common/testCollection';
|
||||
import { stubTest, testStubs } from 'vs/workbench/contrib/testing/common/testStubs';
|
||||
import { TestOwnedTestCollection, TestSingleUseCollection } from 'vs/workbench/contrib/testing/test/common/ownedTestCollection';
|
||||
import { TestChangeEvent, TestItem, TextDocument } from 'vscode';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Location } from 'vs/editor/common/modes';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
|
||||
const simplify = (item: TestItem) => {
|
||||
if ('toJSON' in item) {
|
||||
item = (item as any).toJSON();
|
||||
delete (item as any).id;
|
||||
delete (item as any).providerId;
|
||||
delete (item as any).testId;
|
||||
}
|
||||
|
||||
return { ...item, children: undefined };
|
||||
@@ -41,44 +39,6 @@ const assertTreeListEqual = (a: ReadonlyArray<Readonly<TestItem>>, b: ReadonlyAr
|
||||
a.forEach((_, i) => assertTreesEqual(a[i], b[i]));
|
||||
};
|
||||
|
||||
const stubNestedTests = () => ({
|
||||
...stubTest('root'),
|
||||
children: [
|
||||
{ ...stubTest('a'), children: [stubTest('aa'), stubTest('ab')] },
|
||||
stubTest('b'),
|
||||
]
|
||||
});
|
||||
|
||||
class TestOwnedTestCollection extends OwnedTestCollection {
|
||||
public get idToInternal() {
|
||||
return this.testIdToInternal;
|
||||
}
|
||||
|
||||
public createForHierarchy(publishDiff: (diff: TestsDiff) => void = () => undefined) {
|
||||
return new TestSingleUseCollection(this.testIdToInternal, publishDiff);
|
||||
}
|
||||
}
|
||||
|
||||
class TestSingleUseCollection extends SingleUseTestCollection {
|
||||
private idCounter = 0;
|
||||
|
||||
public get itemToInternal() {
|
||||
return this.testItemToInternal;
|
||||
}
|
||||
|
||||
public get currentDiff() {
|
||||
return this.diff;
|
||||
}
|
||||
|
||||
protected getId() {
|
||||
return String(this.idCounter++);
|
||||
}
|
||||
|
||||
public setDiff(diff: TestsDiff) {
|
||||
this.diff = diff;
|
||||
}
|
||||
}
|
||||
|
||||
class TestMirroredCollection extends MirroredTestCollection {
|
||||
public changeEvent!: TestChangeEvent;
|
||||
|
||||
@@ -102,37 +62,37 @@ suite('ExtHost Testing', () => {
|
||||
|
||||
teardown(() => {
|
||||
single.dispose();
|
||||
assert.deepEqual(owned.idToInternal.size, 0, 'expected owned ids to be empty after dispose');
|
||||
assert.strictEqual(owned.idToInternal.size, 0, 'expected owned ids to be empty after dispose');
|
||||
});
|
||||
|
||||
suite('OwnedTestCollection', () => {
|
||||
test('adds a root recursively', () => {
|
||||
const tests = stubNestedTests();
|
||||
const tests = testStubs.nested();
|
||||
single.addRoot(tests, 'pid');
|
||||
assert.deepStrictEqual(single.collectDiff(), [
|
||||
[TestDiffOpType.Add, { id: '0', providerId: 'pid', parent: null, item: convert.TestItem.from(stubTest('root')) }],
|
||||
[TestDiffOpType.Add, { id: '1', providerId: 'pid', parent: '0', item: convert.TestItem.from(stubTest('a')) }],
|
||||
[TestDiffOpType.Add, { id: '2', providerId: 'pid', parent: '1', item: convert.TestItem.from(stubTest('aa')) }],
|
||||
[TestDiffOpType.Add, { id: '3', providerId: 'pid', parent: '1', item: convert.TestItem.from(stubTest('ab')) }],
|
||||
[TestDiffOpType.Add, { id: '4', providerId: 'pid', parent: '0', item: convert.TestItem.from(stubTest('b')) }],
|
||||
[TestDiffOpType.Add, { id: '1', providerId: 'pid', parent: '0', item: convert.TestItem.from(stubTest('a'), 'root') }],
|
||||
[TestDiffOpType.Add, { id: '2', providerId: 'pid', parent: '1', item: convert.TestItem.from(stubTest('aa'), 'root\0a') }],
|
||||
[TestDiffOpType.Add, { id: '3', providerId: 'pid', parent: '1', item: convert.TestItem.from(stubTest('ab'), 'root\0a') }],
|
||||
[TestDiffOpType.Add, { id: '4', providerId: 'pid', parent: '0', item: convert.TestItem.from(stubTest('b'), 'root') }],
|
||||
]);
|
||||
});
|
||||
|
||||
test('no-ops if items not changed', () => {
|
||||
const tests = stubNestedTests();
|
||||
const tests = testStubs.nested();
|
||||
single.addRoot(tests, 'pid');
|
||||
single.collectDiff();
|
||||
assert.deepStrictEqual(single.collectDiff(), []);
|
||||
});
|
||||
|
||||
test('watches property mutations', () => {
|
||||
const tests = stubNestedTests();
|
||||
const tests = testStubs.nested();
|
||||
single.addRoot(tests, 'pid');
|
||||
single.collectDiff();
|
||||
tests.children![0].description = 'Hello world'; /* item a */
|
||||
single.onItemChange(tests, 'pid');
|
||||
assert.deepStrictEqual(single.collectDiff(), [
|
||||
[TestDiffOpType.Update, { id: '1', parent: '0', providerId: 'pid', item: convert.TestItem.from({ ...stubTest('a'), description: 'Hello world' }) }],
|
||||
[TestDiffOpType.Update, { id: '1', parent: '0', providerId: 'pid', item: convert.TestItem.from({ ...stubTest('a'), description: 'Hello world' }, 'root') }],
|
||||
]);
|
||||
|
||||
single.onItemChange(tests, 'pid');
|
||||
@@ -140,7 +100,7 @@ suite('ExtHost Testing', () => {
|
||||
});
|
||||
|
||||
test('removes children', () => {
|
||||
const tests = stubNestedTests();
|
||||
const tests = testStubs.nested();
|
||||
single.addRoot(tests, 'pid');
|
||||
single.collectDiff();
|
||||
tests.children!.splice(0, 1);
|
||||
@@ -154,7 +114,7 @@ suite('ExtHost Testing', () => {
|
||||
});
|
||||
|
||||
test('adds new children', () => {
|
||||
const tests = stubNestedTests();
|
||||
const tests = testStubs.nested();
|
||||
single.addRoot(tests, 'pid');
|
||||
single.collectDiff();
|
||||
const child = stubTest('ac');
|
||||
@@ -162,7 +122,7 @@ suite('ExtHost Testing', () => {
|
||||
single.onItemChange(tests, 'pid');
|
||||
|
||||
assert.deepStrictEqual(single.collectDiff(), [
|
||||
[TestDiffOpType.Add, { id: '5', providerId: 'pid', parent: '1', item: convert.TestItem.from(child) }],
|
||||
[TestDiffOpType.Add, { id: '5', providerId: 'pid', parent: '1', item: convert.TestItem.from(child, 'root\0a') }],
|
||||
]);
|
||||
assert.deepStrictEqual([...owned.idToInternal.keys()].sort(), ['0', '1', '2', '3', '4', '5']);
|
||||
assert.strictEqual(single.itemToInternal.size, 6);
|
||||
@@ -174,7 +134,7 @@ suite('ExtHost Testing', () => {
|
||||
setup(() => m = new TestMirroredCollection());
|
||||
|
||||
test('mirrors creation of the root', () => {
|
||||
const tests = stubNestedTests();
|
||||
const tests = testStubs.nested();
|
||||
single.addRoot(tests, 'pid');
|
||||
m.apply(single.collectDiff());
|
||||
assertTreesEqual(m.rootTestItems[0], owned.getTestById('0')!.actual);
|
||||
@@ -182,7 +142,7 @@ suite('ExtHost Testing', () => {
|
||||
});
|
||||
|
||||
test('mirrors node deletion', () => {
|
||||
const tests = stubNestedTests();
|
||||
const tests = testStubs.nested();
|
||||
single.addRoot(tests, 'pid');
|
||||
m.apply(single.collectDiff());
|
||||
tests.children!.splice(0, 1);
|
||||
@@ -194,7 +154,7 @@ suite('ExtHost Testing', () => {
|
||||
});
|
||||
|
||||
test('mirrors node addition', () => {
|
||||
const tests = stubNestedTests();
|
||||
const tests = testStubs.nested();
|
||||
single.addRoot(tests, 'pid');
|
||||
m.apply(single.collectDiff());
|
||||
tests.children![0].children!.push(stubTest('ac'));
|
||||
@@ -206,7 +166,7 @@ suite('ExtHost Testing', () => {
|
||||
});
|
||||
|
||||
test('mirrors node update', () => {
|
||||
const tests = stubNestedTests();
|
||||
const tests = testStubs.nested();
|
||||
single.addRoot(tests, 'pid');
|
||||
m.apply(single.collectDiff());
|
||||
tests.children![0].description = 'Hello world'; /* item a */
|
||||
@@ -217,9 +177,9 @@ suite('ExtHost Testing', () => {
|
||||
});
|
||||
|
||||
suite('MirroredChangeCollector', () => {
|
||||
let tests = stubNestedTests();
|
||||
let tests = testStubs.nested();
|
||||
setup(() => {
|
||||
tests = stubNestedTests();
|
||||
tests = testStubs.nested();
|
||||
single.addRoot(tests, 'pid');
|
||||
m.apply(single.collectDiff());
|
||||
});
|
||||
@@ -264,7 +224,7 @@ suite('ExtHost Testing', () => {
|
||||
});
|
||||
|
||||
test('is a no-op if a node is added and removed', () => {
|
||||
const nested = stubNestedTests();
|
||||
const nested = testStubs.nested();
|
||||
tests.children.push(nested);
|
||||
single.onItemChange(tests, 'pid');
|
||||
tests.children.pop();
|
||||
@@ -306,5 +266,141 @@ suite('ExtHost Testing', () => {
|
||||
assert.strictEqual(m.changeEvent.commonChangeAncestor?.label, 'root');
|
||||
});
|
||||
});
|
||||
|
||||
suite('TestItemFilteredWrapper', () => {
|
||||
const stubTestWithLocation = (label: string, location: Location): TestItem => {
|
||||
const t = stubTest(label);
|
||||
t.location = location as any;
|
||||
return t;
|
||||
};
|
||||
|
||||
const location1: Location = {
|
||||
range: new Range(0, 0, 0, 0),
|
||||
uri: URI.parse('file:///foo.ts')
|
||||
};
|
||||
|
||||
const location2: Location = {
|
||||
range: new Range(0, 0, 0, 0),
|
||||
uri: URI.parse('file:///bar.ts')
|
||||
};
|
||||
|
||||
const location3: Location = {
|
||||
range: new Range(0, 0, 0, 0),
|
||||
uri: URI.parse('file:///baz.ts')
|
||||
};
|
||||
|
||||
const textDocumentFilter = {
|
||||
uri: location1.uri
|
||||
} as TextDocument;
|
||||
|
||||
let testsWithLocation: TestItem;
|
||||
setup(() => {
|
||||
testsWithLocation = {
|
||||
...stubTest('root'),
|
||||
children: [
|
||||
{
|
||||
...stubTestWithLocation('a', location1),
|
||||
children: [stubTestWithLocation('aa', location1), stubTestWithLocation('ab', location1)]
|
||||
},
|
||||
{
|
||||
...stubTestWithLocation('b', location2),
|
||||
children: [stubTestWithLocation('ba', location2), stubTestWithLocation('bb', location2)]
|
||||
},
|
||||
{
|
||||
...stubTestWithLocation('b', location3),
|
||||
}
|
||||
],
|
||||
};
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
TestItemFilteredWrapper.removeFilter(textDocumentFilter);
|
||||
});
|
||||
|
||||
test('gets all actual properties', () => {
|
||||
const testItem: TestItem = stubTest('test1');
|
||||
const wrapper: TestItemFilteredWrapper = TestItemFilteredWrapper.getWrapperForTestItem(testItem, textDocumentFilter);
|
||||
|
||||
assert.strictEqual(testItem.debuggable, wrapper.debuggable);
|
||||
assert.strictEqual(testItem.description, wrapper.description);
|
||||
assert.strictEqual(testItem.label, wrapper.label);
|
||||
assert.strictEqual(testItem.location, wrapper.location);
|
||||
assert.strictEqual(testItem.runnable, wrapper.runnable);
|
||||
assert.strictEqual(testItem.state, wrapper.state);
|
||||
});
|
||||
|
||||
test('gets no children if nothing matches Uri filter', () => {
|
||||
let tests: TestItem = testStubs.nested();
|
||||
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(tests, textDocumentFilter);
|
||||
assert.strictEqual(wrapper.children.length, 0);
|
||||
});
|
||||
|
||||
test('filter is applied to children', () => {
|
||||
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
||||
assert.strictEqual(wrapper.label, 'root');
|
||||
assert.strictEqual(wrapper.children.length, 1);
|
||||
assert.strictEqual(wrapper.children[0] instanceof TestItemFilteredWrapper, true);
|
||||
assert.strictEqual(wrapper.children[0].label, 'a');
|
||||
});
|
||||
|
||||
test('can get if node has matching filter', () => {
|
||||
const rootWrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
||||
|
||||
const invisible = testsWithLocation.children![1];
|
||||
const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
||||
const visible = testsWithLocation.children![0];
|
||||
const visibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(visible, textDocumentFilter);
|
||||
|
||||
// The root is always visible
|
||||
assert.strictEqual(rootWrapper.hasNodeMatchingFilter, true);
|
||||
assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, false);
|
||||
assert.strictEqual(visibleWrapper.hasNodeMatchingFilter, true);
|
||||
});
|
||||
|
||||
test('can get visible parent', () => {
|
||||
const rootWrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
||||
|
||||
const invisible = testsWithLocation.children![1];
|
||||
const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
||||
const visible = testsWithLocation.children![0];
|
||||
const visibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(visible, textDocumentFilter);
|
||||
|
||||
// The root is always visible
|
||||
assert.strictEqual(rootWrapper.visibleParent, rootWrapper);
|
||||
assert.strictEqual(invisibleWrapper.visibleParent, rootWrapper);
|
||||
assert.strictEqual(visibleWrapper.visibleParent, visibleWrapper);
|
||||
});
|
||||
|
||||
test('can reset cached value of hasNodeMatchingFilter', () => {
|
||||
TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
||||
|
||||
const invisible = testsWithLocation.children![1];
|
||||
const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
||||
|
||||
assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, false);
|
||||
invisible.location = location1 as any;
|
||||
assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, false);
|
||||
invisibleWrapper.reset();
|
||||
assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, true);
|
||||
});
|
||||
|
||||
test('can reset cached value of hasNodeMatchingFilter of parents up to visible parent', () => {
|
||||
const rootWrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
||||
|
||||
const invisibleParent = testsWithLocation.children![1];
|
||||
const invisibleParentWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisibleParent, textDocumentFilter);
|
||||
const invisible = invisibleParent.children![1];
|
||||
const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
||||
|
||||
assert.strictEqual(invisibleParentWrapper.hasNodeMatchingFilter, false);
|
||||
invisible.location = location1 as any;
|
||||
assert.strictEqual(invisibleParentWrapper.hasNodeMatchingFilter, false);
|
||||
invisibleWrapper.reset();
|
||||
assert.strictEqual(invisibleParentWrapper.hasNodeMatchingFilter, true);
|
||||
|
||||
// the root should be undefined due to the reset.
|
||||
assert.strictEqual((rootWrapper as any).matchesFilter, undefined);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ExtHostDocumentData } from 'vs/workbench/api/common/extHostDocumentData
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { mock } from 'vs/base/test/common/mock';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { Lazy } from 'vs/base/common/lazy';
|
||||
|
||||
suite('ExtHostTextEditor', () => {
|
||||
|
||||
@@ -20,21 +21,21 @@ suite('ExtHostTextEditor', () => {
|
||||
], '\n', 1, 'text', false);
|
||||
|
||||
setup(() => {
|
||||
editor = new ExtHostTextEditor('fake', null!, new NullLogService(), doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4, indentSize: 4 }, [], 1);
|
||||
editor = new ExtHostTextEditor('fake', null!, new NullLogService(), new Lazy(() => doc.document), [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4 }, [], 1);
|
||||
});
|
||||
|
||||
test('disposed editor', () => {
|
||||
|
||||
assert.ok(editor.document);
|
||||
assert.ok(editor.value.document);
|
||||
editor._acceptViewColumn(3);
|
||||
assert.equal(3, editor.viewColumn);
|
||||
assert.strictEqual(3, editor.value.viewColumn);
|
||||
|
||||
editor.dispose();
|
||||
|
||||
assert.throws(() => editor._acceptViewColumn(2));
|
||||
assert.equal(3, editor.viewColumn);
|
||||
assert.strictEqual(3, editor.value.viewColumn);
|
||||
|
||||
assert.ok(editor.document);
|
||||
assert.ok(editor.value.document);
|
||||
assert.throws(() => editor._acceptOptions(null!));
|
||||
assert.throws(() => editor._acceptSelections([]));
|
||||
});
|
||||
@@ -47,16 +48,16 @@ suite('ExtHostTextEditor', () => {
|
||||
applyCount += 1;
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}, new NullLogService(), doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4, indentSize: 4 }, [], 1);
|
||||
}, new NullLogService(), new Lazy(() => doc.document), [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4 }, [], 1);
|
||||
|
||||
await editor.edit(edit => { });
|
||||
assert.equal(applyCount, 0);
|
||||
await editor.value.edit(edit => { });
|
||||
assert.strictEqual(applyCount, 0);
|
||||
|
||||
await editor.edit(edit => { edit.setEndOfLine(1); });
|
||||
assert.equal(applyCount, 1);
|
||||
await editor.value.edit(edit => { edit.setEndOfLine(1); });
|
||||
assert.strictEqual(applyCount, 1);
|
||||
|
||||
await editor.edit(edit => { edit.delete(new Range(0, 0, 1, 1)); });
|
||||
assert.equal(applyCount, 2);
|
||||
await editor.value.edit(edit => { edit.delete(new Range(0, 0, 1, 1)); });
|
||||
assert.strictEqual(applyCount, 2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -70,7 +71,7 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
let mockProxy: MainThreadTextEditorsShape = {
|
||||
dispose: undefined!,
|
||||
$trySetOptions: (id: string, options: ITextEditorConfigurationUpdate) => {
|
||||
assert.equal(id, '1');
|
||||
assert.strictEqual(id, '1');
|
||||
calls.push(options);
|
||||
return Promise.resolve(undefined);
|
||||
},
|
||||
@@ -89,7 +90,6 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
};
|
||||
opts = new ExtHostTextEditorOptions(mockProxy, '1', {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
@@ -103,349 +103,210 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
|
||||
function assertState(opts: ExtHostTextEditorOptions, expected: IResolvedTextEditorConfiguration): void {
|
||||
let actual = {
|
||||
tabSize: opts.tabSize,
|
||||
indentSize: opts.indentSize,
|
||||
insertSpaces: opts.insertSpaces,
|
||||
cursorStyle: opts.cursorStyle,
|
||||
lineNumbers: opts.lineNumbers
|
||||
tabSize: opts.value.tabSize,
|
||||
insertSpaces: opts.value.insertSpaces,
|
||||
cursorStyle: opts.value.cursorStyle,
|
||||
lineNumbers: opts.value.lineNumbers
|
||||
};
|
||||
assert.deepEqual(actual, expected);
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
}
|
||||
|
||||
test('can set tabSize to the same value', () => {
|
||||
opts.tabSize = 4;
|
||||
opts.value.tabSize = 4;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
assert.deepStrictEqual(calls, []);
|
||||
});
|
||||
|
||||
test('can change tabSize to positive integer', () => {
|
||||
opts.tabSize = 1;
|
||||
opts.value.tabSize = 1;
|
||||
assertState(opts, {
|
||||
tabSize: 1,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ tabSize: 1 }]);
|
||||
assert.deepStrictEqual(calls, [{ tabSize: 1 }]);
|
||||
});
|
||||
|
||||
test('can change tabSize to positive float', () => {
|
||||
opts.tabSize = 2.3;
|
||||
opts.value.tabSize = 2.3;
|
||||
assertState(opts, {
|
||||
tabSize: 2,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ tabSize: 2 }]);
|
||||
assert.deepStrictEqual(calls, [{ tabSize: 2 }]);
|
||||
});
|
||||
|
||||
test('can change tabSize to a string number', () => {
|
||||
opts.tabSize = '2';
|
||||
opts.value.tabSize = '2';
|
||||
assertState(opts, {
|
||||
tabSize: 2,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ tabSize: 2 }]);
|
||||
assert.deepStrictEqual(calls, [{ tabSize: 2 }]);
|
||||
});
|
||||
|
||||
test('tabSize can request indentation detection', () => {
|
||||
opts.tabSize = 'auto';
|
||||
opts.value.tabSize = 'auto';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ tabSize: 'auto' }]);
|
||||
assert.deepStrictEqual(calls, [{ tabSize: 'auto' }]);
|
||||
});
|
||||
|
||||
test('ignores invalid tabSize 1', () => {
|
||||
opts.tabSize = null!;
|
||||
opts.value.tabSize = null!;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
assert.deepStrictEqual(calls, []);
|
||||
});
|
||||
|
||||
test('ignores invalid tabSize 2', () => {
|
||||
opts.tabSize = -5;
|
||||
opts.value.tabSize = -5;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
assert.deepStrictEqual(calls, []);
|
||||
});
|
||||
|
||||
test('ignores invalid tabSize 3', () => {
|
||||
opts.tabSize = 'hello';
|
||||
opts.value.tabSize = 'hello';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
assert.deepStrictEqual(calls, []);
|
||||
});
|
||||
|
||||
test('ignores invalid tabSize 4', () => {
|
||||
opts.tabSize = '-17';
|
||||
opts.value.tabSize = '-17';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('can set indentSize to the same value', () => {
|
||||
opts.indentSize = 4;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('can change indentSize to positive integer', () => {
|
||||
opts.indentSize = 1;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 1,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ indentSize: 1 }]);
|
||||
});
|
||||
|
||||
test('can change indentSize to positive float', () => {
|
||||
opts.indentSize = 2.3;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 2,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ indentSize: 2 }]);
|
||||
});
|
||||
|
||||
test('can change indentSize to a string number', () => {
|
||||
opts.indentSize = '2';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 2,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ indentSize: 2 }]);
|
||||
});
|
||||
|
||||
test('indentSize can request to use tabSize', () => {
|
||||
opts.indentSize = 'tabSize';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ indentSize: 'tabSize' }]);
|
||||
});
|
||||
|
||||
test('indentSize cannot request indentation detection', () => {
|
||||
opts.indentSize = 'auto';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('ignores invalid indentSize 1', () => {
|
||||
opts.indentSize = null!;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('ignores invalid indentSize 2', () => {
|
||||
opts.indentSize = -5;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('ignores invalid indentSize 3', () => {
|
||||
opts.indentSize = 'hello';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('ignores invalid indentSize 4', () => {
|
||||
opts.indentSize = '-17';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
assert.deepStrictEqual(calls, []);
|
||||
});
|
||||
|
||||
test('can set insertSpaces to the same value', () => {
|
||||
opts.insertSpaces = false;
|
||||
opts.value.insertSpaces = false;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
assert.deepStrictEqual(calls, []);
|
||||
});
|
||||
|
||||
test('can set insertSpaces to boolean', () => {
|
||||
opts.insertSpaces = true;
|
||||
opts.value.insertSpaces = true;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: true,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ insertSpaces: true }]);
|
||||
assert.deepStrictEqual(calls, [{ insertSpaces: true }]);
|
||||
});
|
||||
|
||||
test('can set insertSpaces to false string', () => {
|
||||
opts.insertSpaces = 'false';
|
||||
opts.value.insertSpaces = 'false';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
assert.deepStrictEqual(calls, []);
|
||||
});
|
||||
|
||||
test('can set insertSpaces to truey', () => {
|
||||
opts.insertSpaces = 'hello';
|
||||
opts.value.insertSpaces = 'hello';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: true,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ insertSpaces: true }]);
|
||||
assert.deepStrictEqual(calls, [{ insertSpaces: true }]);
|
||||
});
|
||||
|
||||
test('insertSpaces can request indentation detection', () => {
|
||||
opts.insertSpaces = 'auto';
|
||||
opts.value.insertSpaces = 'auto';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ insertSpaces: 'auto' }]);
|
||||
assert.deepStrictEqual(calls, [{ insertSpaces: 'auto' }]);
|
||||
});
|
||||
|
||||
test('can set cursorStyle to same value', () => {
|
||||
opts.cursorStyle = TextEditorCursorStyle.Line;
|
||||
opts.value.cursorStyle = TextEditorCursorStyle.Line;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
assert.deepStrictEqual(calls, []);
|
||||
});
|
||||
|
||||
test('can change cursorStyle', () => {
|
||||
opts.cursorStyle = TextEditorCursorStyle.Block;
|
||||
opts.value.cursorStyle = TextEditorCursorStyle.Block;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Block,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ cursorStyle: TextEditorCursorStyle.Block }]);
|
||||
assert.deepStrictEqual(calls, [{ cursorStyle: TextEditorCursorStyle.Block }]);
|
||||
});
|
||||
|
||||
test('can set lineNumbers to same value', () => {
|
||||
opts.lineNumbers = TextEditorLineNumbersStyle.On;
|
||||
opts.value.lineNumbers = TextEditorLineNumbersStyle.On;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
assert.deepStrictEqual(calls, []);
|
||||
});
|
||||
|
||||
test('can change lineNumbers', () => {
|
||||
opts.lineNumbers = TextEditorLineNumbersStyle.Off;
|
||||
opts.value.lineNumbers = TextEditorLineNumbersStyle.Off;
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.Off
|
||||
});
|
||||
assert.deepEqual(calls, [{ lineNumbers: RenderLineNumbersType.Off }]);
|
||||
assert.deepStrictEqual(calls, [{ lineNumbers: RenderLineNumbersType.Off }]);
|
||||
});
|
||||
|
||||
test('can do bulk updates 0', () => {
|
||||
@@ -457,12 +318,11 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
});
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, []);
|
||||
assert.deepStrictEqual(calls, []);
|
||||
});
|
||||
|
||||
test('can do bulk updates 1', () => {
|
||||
@@ -472,12 +332,11 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
});
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: true,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ tabSize: 'auto', insertSpaces: true }]);
|
||||
assert.deepStrictEqual(calls, [{ tabSize: 'auto', insertSpaces: true }]);
|
||||
});
|
||||
|
||||
test('can do bulk updates 2', () => {
|
||||
@@ -487,12 +346,11 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
});
|
||||
assertState(opts, {
|
||||
tabSize: 3,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
assert.deepEqual(calls, [{ tabSize: 3, insertSpaces: 'auto' }]);
|
||||
assert.deepStrictEqual(calls, [{ tabSize: 3, insertSpaces: 'auto' }]);
|
||||
});
|
||||
|
||||
test('can do bulk updates 3', () => {
|
||||
@@ -502,12 +360,11 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
});
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Block,
|
||||
lineNumbers: RenderLineNumbersType.Relative
|
||||
});
|
||||
assert.deepEqual(calls, [{ cursorStyle: TextEditorCursorStyle.Block, lineNumbers: RenderLineNumbersType.Relative }]);
|
||||
assert.deepStrictEqual(calls, [{ cursorStyle: TextEditorCursorStyle.Block, lineNumbers: RenderLineNumbersType.Relative }]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -91,24 +91,24 @@ suite.skip('ExtHostTreeView', function () {
|
||||
return testObject.$getChildren('testNodeTreeProvider')
|
||||
.then(elements => {
|
||||
const actuals = elements.map(e => e.handle);
|
||||
assert.deepEqual(actuals, ['0/0:a', '0/0:b']);
|
||||
assert.deepStrictEqual(actuals, ['0/0:a', '0/0:b']);
|
||||
return Promise.all([
|
||||
testObject.$getChildren('testNodeTreeProvider', '0/0:a')
|
||||
.then(children => {
|
||||
const actuals = children.map(e => e.handle);
|
||||
assert.deepEqual(actuals, ['0/0:a/0:aa', '0/0:a/0:ab']);
|
||||
assert.deepStrictEqual(actuals, ['0/0:a/0:aa', '0/0:a/0:ab']);
|
||||
return Promise.all([
|
||||
testObject.$getChildren('testNodeTreeProvider', '0/0:a/0:aa').then(children => assert.equal(children.length, 0)),
|
||||
testObject.$getChildren('testNodeTreeProvider', '0/0:a/0:ab').then(children => assert.equal(children.length, 0))
|
||||
testObject.$getChildren('testNodeTreeProvider', '0/0:a/0:aa').then(children => assert.strictEqual(children.length, 0)),
|
||||
testObject.$getChildren('testNodeTreeProvider', '0/0:a/0:ab').then(children => assert.strictEqual(children.length, 0))
|
||||
]);
|
||||
}),
|
||||
testObject.$getChildren('testNodeTreeProvider', '0/0:b')
|
||||
.then(children => {
|
||||
const actuals = children.map(e => e.handle);
|
||||
assert.deepEqual(actuals, ['0/0:b/0:ba', '0/0:b/0:bb']);
|
||||
assert.deepStrictEqual(actuals, ['0/0:b/0:ba', '0/0:b/0:bb']);
|
||||
return Promise.all([
|
||||
testObject.$getChildren('testNodeTreeProvider', '0/0:b/0:ba').then(children => assert.equal(children.length, 0)),
|
||||
testObject.$getChildren('testNodeTreeProvider', '0/0:b/0:bb').then(children => assert.equal(children.length, 0))
|
||||
testObject.$getChildren('testNodeTreeProvider', '0/0:b/0:ba').then(children => assert.strictEqual(children.length, 0)),
|
||||
testObject.$getChildren('testNodeTreeProvider', '0/0:b/0:bb').then(children => assert.strictEqual(children.length, 0))
|
||||
]);
|
||||
})
|
||||
]);
|
||||
@@ -119,24 +119,24 @@ suite.skip('ExtHostTreeView', function () {
|
||||
return testObject.$getChildren('testNodeWithIdTreeProvider')
|
||||
.then(elements => {
|
||||
const actuals = elements.map(e => e.handle);
|
||||
assert.deepEqual(actuals, ['1/a', '1/b']);
|
||||
assert.deepStrictEqual(actuals, ['1/a', '1/b']);
|
||||
return Promise.all([
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider', '1/a')
|
||||
.then(children => {
|
||||
const actuals = children.map(e => e.handle);
|
||||
assert.deepEqual(actuals, ['1/aa', '1/ab']);
|
||||
assert.deepStrictEqual(actuals, ['1/aa', '1/ab']);
|
||||
return Promise.all([
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider', '1/aa').then(children => assert.equal(children.length, 0)),
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider', '1/ab').then(children => assert.equal(children.length, 0))
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider', '1/aa').then(children => assert.strictEqual(children.length, 0)),
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider', '1/ab').then(children => assert.strictEqual(children.length, 0))
|
||||
]);
|
||||
}),
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider', '1/b')
|
||||
.then(children => {
|
||||
const actuals = children.map(e => e.handle);
|
||||
assert.deepEqual(actuals, ['1/ba', '1/bb']);
|
||||
assert.deepStrictEqual(actuals, ['1/ba', '1/bb']);
|
||||
return Promise.all([
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider', '1/ba').then(children => assert.equal(children.length, 0)),
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider', '1/bb').then(children => assert.equal(children.length, 0))
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider', '1/ba').then(children => assert.strictEqual(children.length, 0)),
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider', '1/bb').then(children => assert.strictEqual(children.length, 0))
|
||||
]);
|
||||
})
|
||||
]);
|
||||
@@ -146,7 +146,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
test('construct highlights tree', () => {
|
||||
return testObject.$getChildren('testNodeWithHighlightsTreeProvider')
|
||||
.then(elements => {
|
||||
assert.deepEqual(removeUnsetKeys(elements), [{
|
||||
assert.deepStrictEqual(removeUnsetKeys(elements), [{
|
||||
handle: '1/a',
|
||||
label: { label: 'a', highlights: [[0, 2], [3, 5]] },
|
||||
collapsibleState: TreeItemCollapsibleState.Collapsed
|
||||
@@ -158,7 +158,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
return Promise.all([
|
||||
testObject.$getChildren('testNodeWithHighlightsTreeProvider', '1/a')
|
||||
.then(children => {
|
||||
assert.deepEqual(removeUnsetKeys(children), [{
|
||||
assert.deepStrictEqual(removeUnsetKeys(children), [{
|
||||
handle: '1/aa',
|
||||
parentHandle: '1/a',
|
||||
label: { label: 'aa', highlights: [[0, 2], [3, 5]] },
|
||||
@@ -172,7 +172,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
}),
|
||||
testObject.$getChildren('testNodeWithHighlightsTreeProvider', '1/b')
|
||||
.then(children => {
|
||||
assert.deepEqual(removeUnsetKeys(children), [{
|
||||
assert.deepStrictEqual(removeUnsetKeys(children), [{
|
||||
handle: '1/ba',
|
||||
parentHandle: '1/b',
|
||||
label: { label: 'ba', highlights: [[0, 2], [3, 5]] },
|
||||
@@ -196,15 +196,17 @@ suite.skip('ExtHostTreeView', function () {
|
||||
'aa': {},
|
||||
'ba': {}
|
||||
};
|
||||
let caughtExpectedError = false;
|
||||
target.onRefresh.event(() => {
|
||||
testObject.$getChildren('testNodeWithIdTreeProvider')
|
||||
.then(elements => {
|
||||
const actuals = elements.map(e => e.handle);
|
||||
assert.deepEqual(actuals, ['1/a', '1/b']);
|
||||
assert.deepStrictEqual(actuals, ['1/a', '1/b']);
|
||||
return testObject.$getChildren('testNodeWithIdTreeProvider', '1/a')
|
||||
.then(() => testObject.$getChildren('testNodeWithIdTreeProvider', '1/b'))
|
||||
.then(() => assert.fail('Should fail with duplicate id'))
|
||||
.finally(done);
|
||||
.catch(() => caughtExpectedError = true)
|
||||
.finally(() => caughtExpectedError ? done() : assert.fail('Expected duplicate id error not thrown.'));
|
||||
});
|
||||
});
|
||||
onDidChangeTreeNode.fire(undefined);
|
||||
@@ -212,7 +214,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
|
||||
test('refresh root', function (done) {
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.equal(undefined, actuals);
|
||||
assert.strictEqual(undefined, actuals);
|
||||
done();
|
||||
});
|
||||
onDidChangeTreeNode.fire(undefined);
|
||||
@@ -221,8 +223,8 @@ suite.skip('ExtHostTreeView', function () {
|
||||
test('refresh a parent node', () => {
|
||||
return new Promise((c, e) => {
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.deepEqual(['0/0:b'], Object.keys(actuals));
|
||||
assert.deepEqual(removeUnsetKeys(actuals['0/0:b']), {
|
||||
assert.deepStrictEqual(['0/0:b'], Object.keys(actuals));
|
||||
assert.deepStrictEqual(removeUnsetKeys(actuals['0/0:b']), {
|
||||
handle: '0/0:b',
|
||||
label: { label: 'b' },
|
||||
collapsibleState: TreeItemCollapsibleState.Collapsed
|
||||
@@ -235,8 +237,8 @@ suite.skip('ExtHostTreeView', function () {
|
||||
|
||||
test('refresh a leaf node', function (done) {
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.deepEqual(['0/0:b/0:bb'], Object.keys(actuals));
|
||||
assert.deepEqual(removeUnsetKeys(actuals['0/0:b/0:bb']), {
|
||||
assert.deepStrictEqual(['0/0:b/0:bb'], Object.keys(actuals));
|
||||
assert.deepStrictEqual(removeUnsetKeys(actuals['0/0:b/0:bb']), {
|
||||
handle: '0/0:b/0:bb',
|
||||
parentHandle: '0/0:b',
|
||||
label: { label: 'bb' },
|
||||
@@ -262,13 +264,13 @@ suite.skip('ExtHostTreeView', function () {
|
||||
test('refresh parent and child node trigger refresh only on parent - scenario 1', async () => {
|
||||
return runWithEventMerging((resolve) => {
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.deepEqual(['0/0:b', '0/0:a/0:aa'], Object.keys(actuals));
|
||||
assert.deepEqual(removeUnsetKeys(actuals['0/0:b']), {
|
||||
assert.deepStrictEqual(['0/0:b', '0/0:a/0:aa'], Object.keys(actuals));
|
||||
assert.deepStrictEqual(removeUnsetKeys(actuals['0/0:b']), {
|
||||
handle: '0/0:b',
|
||||
label: { label: 'b' },
|
||||
collapsibleState: TreeItemCollapsibleState.Collapsed
|
||||
});
|
||||
assert.deepEqual(removeUnsetKeys(actuals['0/0:a/0:aa']), {
|
||||
assert.deepStrictEqual(removeUnsetKeys(actuals['0/0:a/0:aa']), {
|
||||
handle: '0/0:a/0:aa',
|
||||
parentHandle: '0/0:a',
|
||||
label: { label: 'aa' },
|
||||
@@ -285,13 +287,13 @@ suite.skip('ExtHostTreeView', function () {
|
||||
test('refresh parent and child node trigger refresh only on parent - scenario 2', async () => {
|
||||
return runWithEventMerging((resolve) => {
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.deepEqual(['0/0:a/0:aa', '0/0:b'], Object.keys(actuals));
|
||||
assert.deepEqual(removeUnsetKeys(actuals['0/0:b']), {
|
||||
assert.deepStrictEqual(['0/0:a/0:aa', '0/0:b'], Object.keys(actuals));
|
||||
assert.deepStrictEqual(removeUnsetKeys(actuals['0/0:b']), {
|
||||
handle: '0/0:b',
|
||||
label: { label: 'b' },
|
||||
collapsibleState: TreeItemCollapsibleState.Collapsed
|
||||
});
|
||||
assert.deepEqual(removeUnsetKeys(actuals['0/0:a/0:aa']), {
|
||||
assert.deepStrictEqual(removeUnsetKeys(actuals['0/0:a/0:aa']), {
|
||||
handle: '0/0:a/0:aa',
|
||||
parentHandle: '0/0:a',
|
||||
label: { label: 'aa' },
|
||||
@@ -308,8 +310,8 @@ suite.skip('ExtHostTreeView', function () {
|
||||
test('refresh an element for label change', function (done) {
|
||||
labels['a'] = 'aa';
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.deepEqual(['0/0:a'], Object.keys(actuals));
|
||||
assert.deepEqual(removeUnsetKeys(actuals['0/0:a']), {
|
||||
assert.deepStrictEqual(['0/0:a'], Object.keys(actuals));
|
||||
assert.deepStrictEqual(removeUnsetKeys(actuals['0/0:a']), {
|
||||
handle: '0/0:aa',
|
||||
label: { label: 'aa' },
|
||||
collapsibleState: TreeItemCollapsibleState.Collapsed
|
||||
@@ -322,7 +324,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
test('refresh calls are throttled on roots', () => {
|
||||
return runWithEventMerging((resolve) => {
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.equal(undefined, actuals);
|
||||
assert.strictEqual(undefined, actuals);
|
||||
resolve();
|
||||
});
|
||||
onDidChangeTreeNode.fire(undefined);
|
||||
@@ -335,7 +337,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
test('refresh calls are throttled on elements', () => {
|
||||
return runWithEventMerging((resolve) => {
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.deepEqual(['0/0:a', '0/0:b'], Object.keys(actuals));
|
||||
assert.deepStrictEqual(['0/0:a', '0/0:b'], Object.keys(actuals));
|
||||
resolve();
|
||||
});
|
||||
|
||||
@@ -349,7 +351,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
test('refresh calls are throttled on unknown elements', () => {
|
||||
return runWithEventMerging((resolve) => {
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.deepEqual(['0/0:a', '0/0:b'], Object.keys(actuals));
|
||||
assert.deepStrictEqual(['0/0:a', '0/0:b'], Object.keys(actuals));
|
||||
resolve();
|
||||
});
|
||||
|
||||
@@ -363,7 +365,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
test('refresh calls are throttled on unknown elements and root', () => {
|
||||
return runWithEventMerging((resolve) => {
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.equal(undefined, actuals);
|
||||
assert.strictEqual(undefined, actuals);
|
||||
resolve();
|
||||
});
|
||||
|
||||
@@ -377,7 +379,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
test('refresh calls are throttled on elements and root', () => {
|
||||
return runWithEventMerging((resolve) => {
|
||||
target.onRefresh.event(actuals => {
|
||||
assert.equal(undefined, actuals);
|
||||
assert.strictEqual(undefined, actuals);
|
||||
resolve();
|
||||
});
|
||||
|
||||
@@ -396,7 +398,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
target.onRefresh.event(() => {
|
||||
testObject.$getChildren('testNodeTreeProvider')
|
||||
.then(elements => {
|
||||
assert.deepEqual(elements.map(e => e.handle), ['0/0:a//0:b']);
|
||||
assert.deepStrictEqual(elements.map(e => e.handle), ['0/0:a//0:b']);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -439,11 +441,11 @@ suite.skip('ExtHostTreeView', function () {
|
||||
testObject.$getChildren('testNodeTreeProvider')
|
||||
.then(elements => {
|
||||
const actuals = elements.map(e => e.handle);
|
||||
assert.deepEqual(actuals, ['0/0:a', '0/0:b', '0/1:a', '0/0:d', '0/1:b', '0/0:f', '0/2:a']);
|
||||
assert.deepStrictEqual(actuals, ['0/0:a', '0/0:b', '0/1:a', '0/0:d', '0/1:b', '0/0:f', '0/2:a']);
|
||||
return testObject.$getChildren('testNodeTreeProvider', '0/1:b')
|
||||
.then(elements => {
|
||||
const actuals = elements.map(e => e.handle);
|
||||
assert.deepEqual(actuals, ['0/1:b/0:h', '0/1:b/1:h', '0/1:b/0:j', '0/1:b/1:j', '0/1:b/2:h']);
|
||||
assert.deepStrictEqual(actuals, ['0/1:b/0:h', '0/1:b/1:h', '0/1:b/0:j', '0/1:b/1:j', '0/1:b/2:h']);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -460,7 +462,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
target.onRefresh.event(() => {
|
||||
testObject.$getChildren('testNodeTreeProvider')
|
||||
.then(elements => {
|
||||
assert.deepEqual(elements.map(e => e.handle), ['0/0:c']);
|
||||
assert.deepStrictEqual(elements.map(e => e.handle), ['0/0:c']);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -475,7 +477,7 @@ suite.skip('ExtHostTreeView', function () {
|
||||
|
||||
return testObject.$getChildren('testNodeTreeProvider')
|
||||
.then(elements => {
|
||||
assert.deepEqual(elements.map(e => e.handle), ['0/0:a', '0/0:b']);
|
||||
assert.deepStrictEqual(elements.map(e => e.handle), ['0/0:a', '0/0:b']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -496,9 +498,9 @@ suite.skip('ExtHostTreeView', function () {
|
||||
return treeView.reveal({ key: 'a' })
|
||||
.then(() => {
|
||||
assert.ok(revealTarget.calledOnce);
|
||||
assert.deepEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepEqual(expected, removeUnsetKeys(revealTarget.args[0][1]));
|
||||
assert.deepEqual({ select: true, focus: false, expand: false }, revealTarget.args[0][2]);
|
||||
assert.deepStrictEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepStrictEqual(expected, removeUnsetKeys(revealTarget.args[0][1]));
|
||||
assert.deepStrictEqual({ select: true, focus: false, expand: false }, revealTarget.args[0][2]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -512,10 +514,10 @@ suite.skip('ExtHostTreeView', function () {
|
||||
return treeView.reveal({ key: 'aa' })
|
||||
.then(() => {
|
||||
assert.ok(revealTarget.calledOnce);
|
||||
assert.deepEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepEqual(expected.item, removeUnsetKeys(revealTarget.args[0][1].item));
|
||||
assert.deepEqual(expected.parentChain, (<Array<any>>(revealTarget.args[0][1].parentChain)).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepEqual({ select: true, focus: false, expand: false }, revealTarget.args[0][2]);
|
||||
assert.deepStrictEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepStrictEqual(expected.item, removeUnsetKeys(revealTarget.args[0][1].item));
|
||||
assert.deepStrictEqual(expected.parentChain, (<Array<any>>(revealTarget.args[0][1].parentChain)).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepStrictEqual({ select: true, focus: false, expand: false }, revealTarget.args[0][2]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -531,10 +533,10 @@ suite.skip('ExtHostTreeView', function () {
|
||||
.then(() => treeView.reveal({ key: 'aa' })
|
||||
.then(() => {
|
||||
assert.ok(revealTarget.calledOnce);
|
||||
assert.deepEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepEqual(expected.item, removeUnsetKeys(revealTarget.args[0][1].item));
|
||||
assert.deepEqual(expected.parentChain, (<Array<any>>(revealTarget.args[0][1].parentChain)).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepEqual({ select: true, focus: false, expand: false }, revealTarget.args[0][2]);
|
||||
assert.deepStrictEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepStrictEqual(expected.item, removeUnsetKeys(revealTarget.args[0][1].item));
|
||||
assert.deepStrictEqual(expected.parentChain, (<Array<any>>(revealTarget.args[0][1].parentChain)).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepStrictEqual({ select: true, focus: false, expand: false }, revealTarget.args[0][2]);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -558,10 +560,10 @@ suite.skip('ExtHostTreeView', function () {
|
||||
return treeView.reveal({ key: 'bac' }, { select: false, focus: false, expand: false })
|
||||
.then(() => {
|
||||
assert.ok(revealTarget.calledOnce);
|
||||
assert.deepEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepEqual(expected.item, removeUnsetKeys(revealTarget.args[0][1].item));
|
||||
assert.deepEqual(expected.parentChain, (<Array<any>>(revealTarget.args[0][1].parentChain)).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepEqual({ select: false, focus: false, expand: false }, revealTarget.args[0][2]);
|
||||
assert.deepStrictEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepStrictEqual(expected.item, removeUnsetKeys(revealTarget.args[0][1].item));
|
||||
assert.deepStrictEqual(expected.parentChain, (<Array<any>>(revealTarget.args[0][1].parentChain)).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepStrictEqual({ select: false, focus: false, expand: false }, revealTarget.args[0][2]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -589,10 +591,10 @@ suite.skip('ExtHostTreeView', function () {
|
||||
return treeView.reveal({ key: 'ac' })
|
||||
.then(() => {
|
||||
assert.ok(revealTarget.calledOnce);
|
||||
assert.deepEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepEqual(expected.item, removeUnsetKeys(revealTarget.args[0][1].item));
|
||||
assert.deepEqual(expected.parentChain, (<Array<any>>(revealTarget.args[0][1].parentChain)).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepEqual({ select: true, focus: false, expand: false }, revealTarget.args[0][2]);
|
||||
assert.deepStrictEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepStrictEqual(expected.item, removeUnsetKeys(revealTarget.args[0][1].item));
|
||||
assert.deepStrictEqual(expected.parentChain, (<Array<any>>(revealTarget.args[0][1].parentChain)).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepStrictEqual({ select: true, focus: false, expand: false }, revealTarget.args[0][2]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -630,10 +632,10 @@ suite.skip('ExtHostTreeView', function () {
|
||||
return treeView.reveal({ key: 'bc' })
|
||||
.then(() => {
|
||||
assert.ok(revealTarget.calledOnce);
|
||||
assert.deepEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepEqual({ handle: '0/0:b/0:bc', label: { label: 'bc' }, collapsibleState: TreeItemCollapsibleState.None, parentHandle: '0/0:b' }, removeUnsetKeys(revealTarget.args[0][1]));
|
||||
assert.deepEqual([{ handle: '0/0:b', label: { label: 'b' }, collapsibleState: TreeItemCollapsibleState.Collapsed }], (<Array<any>>revealTarget.args[0][2]).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepEqual({ select: true, focus: false, expand: false }, revealTarget.args[0][3]);
|
||||
assert.deepStrictEqual('treeDataProvider', revealTarget.args[0][0]);
|
||||
assert.deepStrictEqual({ handle: '0/0:b/0:bc', label: { label: 'bc' }, collapsibleState: TreeItemCollapsibleState.None, parentHandle: '0/0:b' }, removeUnsetKeys(revealTarget.args[0][1]));
|
||||
assert.deepStrictEqual([{ handle: '0/0:b', label: { label: 'b' }, collapsibleState: TreeItemCollapsibleState.Collapsed }], (<Array<any>>revealTarget.args[0][2]).map(arg => removeUnsetKeys(arg)));
|
||||
assert.deepStrictEqual({ select: true, focus: false, expand: false }, revealTarget.args[0][3]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,45 +25,45 @@ suite('ExtHostTypeConverter', function () {
|
||||
test('MarkdownConvert - uris', function () {
|
||||
|
||||
let data = MarkdownString.from('Hello');
|
||||
assert.equal(isEmptyObject(data.uris), true);
|
||||
assert.equal(data.value, 'Hello');
|
||||
assert.strictEqual(isEmptyObject(data.uris), true);
|
||||
assert.strictEqual(data.value, 'Hello');
|
||||
|
||||
data = MarkdownString.from('Hello [link](foo)');
|
||||
assert.equal(data.value, 'Hello [link](foo)');
|
||||
assert.equal(isEmptyObject(data.uris), true); // no scheme, no uri
|
||||
assert.strictEqual(data.value, 'Hello [link](foo)');
|
||||
assert.strictEqual(isEmptyObject(data.uris), true); // no scheme, no uri
|
||||
|
||||
data = MarkdownString.from('Hello [link](www.noscheme.bad)');
|
||||
assert.equal(data.value, 'Hello [link](www.noscheme.bad)');
|
||||
assert.equal(isEmptyObject(data.uris), true); // no scheme, no uri
|
||||
assert.strictEqual(data.value, 'Hello [link](www.noscheme.bad)');
|
||||
assert.strictEqual(isEmptyObject(data.uris), true); // no scheme, no uri
|
||||
|
||||
data = MarkdownString.from('Hello [link](foo:path)');
|
||||
assert.equal(data.value, 'Hello [link](foo:path)');
|
||||
assert.equal(size(data.uris!), 1);
|
||||
assert.strictEqual(data.value, 'Hello [link](foo:path)');
|
||||
assert.strictEqual(size(data.uris!), 1);
|
||||
assert.ok(!!data.uris!['foo:path']);
|
||||
|
||||
data = MarkdownString.from('hello@foo.bar');
|
||||
assert.equal(data.value, 'hello@foo.bar');
|
||||
assert.equal(size(data.uris!), 1);
|
||||
assert.strictEqual(data.value, 'hello@foo.bar');
|
||||
assert.strictEqual(size(data.uris!), 1);
|
||||
// assert.ok(!!data.uris!['mailto:hello@foo.bar']);
|
||||
|
||||
data = MarkdownString.from('*hello* [click](command:me)');
|
||||
assert.equal(data.value, '*hello* [click](command:me)');
|
||||
assert.equal(size(data.uris!), 1);
|
||||
assert.strictEqual(data.value, '*hello* [click](command:me)');
|
||||
assert.strictEqual(size(data.uris!), 1);
|
||||
assert.ok(!!data.uris!['command:me']);
|
||||
|
||||
data = MarkdownString.from('*hello* [click](file:///somepath/here). [click](file:///somepath/here)');
|
||||
assert.equal(data.value, '*hello* [click](file:///somepath/here). [click](file:///somepath/here)');
|
||||
assert.equal(size(data.uris!), 1);
|
||||
assert.strictEqual(data.value, '*hello* [click](file:///somepath/here). [click](file:///somepath/here)');
|
||||
assert.strictEqual(size(data.uris!), 1);
|
||||
assert.ok(!!data.uris!['file:///somepath/here']);
|
||||
|
||||
data = MarkdownString.from('*hello* [click](file:///somepath/here). [click](file:///somepath/here)');
|
||||
assert.equal(data.value, '*hello* [click](file:///somepath/here). [click](file:///somepath/here)');
|
||||
assert.equal(size(data.uris!), 1);
|
||||
assert.strictEqual(data.value, '*hello* [click](file:///somepath/here). [click](file:///somepath/here)');
|
||||
assert.strictEqual(size(data.uris!), 1);
|
||||
assert.ok(!!data.uris!['file:///somepath/here']);
|
||||
|
||||
data = MarkdownString.from('*hello* [click](file:///somepath/here). [click](file:///somepath/here2)');
|
||||
assert.equal(data.value, '*hello* [click](file:///somepath/here). [click](file:///somepath/here2)');
|
||||
assert.equal(size(data.uris!), 2);
|
||||
assert.strictEqual(data.value, '*hello* [click](file:///somepath/here). [click](file:///somepath/here2)');
|
||||
assert.strictEqual(size(data.uris!), 2);
|
||||
assert.ok(!!data.uris!['file:///somepath/here']);
|
||||
assert.ok(!!data.uris!['file:///somepath/here2']);
|
||||
});
|
||||
@@ -72,12 +72,12 @@ suite('ExtHostTypeConverter', function () {
|
||||
|
||||
let data = MarkdownString.from('*hello* [click](command:npm.runScriptFromHover?%7B%22documentUri%22%3A%7B%22%24mid%22%3A1%2C%22external%22%3A%22file%3A%2F%2F%2Fc%253A%2Ffoo%2Fbaz.ex%22%2C%22path%22%3A%22%2Fc%3A%2Ffoo%2Fbaz.ex%22%2C%22scheme%22%3A%22file%22%7D%2C%22script%22%3A%22dev%22%7D)');
|
||||
// assert that both uri get extracted but that the latter is only decoded once...
|
||||
assert.equal(size(data.uris!), 2);
|
||||
assert.strictEqual(size(data.uris!), 2);
|
||||
forEach(data.uris!, entry => {
|
||||
if (entry.value.scheme === 'file') {
|
||||
assert.ok(URI.revive(entry.value).toString().indexOf('file:///c%3A') === 0);
|
||||
} else {
|
||||
assert.equal(entry.value.scheme, 'command');
|
||||
assert.strictEqual(entry.value.scheme, 'command');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ import { assertType } from 'vs/base/common/types';
|
||||
function assertToJSON(a: any, expected: any) {
|
||||
const raw = JSON.stringify(a);
|
||||
const actual = JSON.parse(raw);
|
||||
assert.deepEqual(actual, expected);
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
}
|
||||
|
||||
suite('ExtHostTypes', function () {
|
||||
@@ -20,14 +20,14 @@ suite('ExtHostTypes', function () {
|
||||
test('URI, toJSON', function () {
|
||||
|
||||
let uri = URI.parse('file:///path/test.file');
|
||||
assert.deepEqual(uri.toJSON(), {
|
||||
assert.deepStrictEqual(uri.toJSON(), {
|
||||
$mid: 1,
|
||||
scheme: 'file',
|
||||
path: '/path/test.file'
|
||||
});
|
||||
|
||||
assert.ok(uri.fsPath);
|
||||
assert.deepEqual(uri.toJSON(), {
|
||||
assert.deepStrictEqual(uri.toJSON(), {
|
||||
$mid: 1,
|
||||
scheme: 'file',
|
||||
path: '/path/test.file',
|
||||
@@ -36,7 +36,7 @@ suite('ExtHostTypes', function () {
|
||||
});
|
||||
|
||||
assert.ok(uri.toString());
|
||||
assert.deepEqual(uri.toJSON(), {
|
||||
assert.deepStrictEqual(uri.toJSON(), {
|
||||
$mid: 1,
|
||||
scheme: 'file',
|
||||
path: '/path/test.file',
|
||||
@@ -54,13 +54,13 @@ suite('ExtHostTypes', function () {
|
||||
return 12;
|
||||
});
|
||||
d.dispose();
|
||||
assert.equal(count, 1);
|
||||
assert.strictEqual(count, 1);
|
||||
|
||||
d.dispose();
|
||||
assert.equal(count, 1);
|
||||
assert.strictEqual(count, 1);
|
||||
|
||||
types.Disposable.from(undefined!, { dispose() { count += 1; } }).dispose();
|
||||
assert.equal(count, 2);
|
||||
assert.strictEqual(count, 2);
|
||||
|
||||
|
||||
assert.throws(() => {
|
||||
@@ -83,8 +83,8 @@ suite('ExtHostTypes', function () {
|
||||
assert.throws(() => (pos as any).line = 12);
|
||||
|
||||
let { line, character } = pos.toJSON();
|
||||
assert.equal(line, 0);
|
||||
assert.equal(character, 0);
|
||||
assert.strictEqual(line, 0);
|
||||
assert.strictEqual(character, 0);
|
||||
});
|
||||
|
||||
test('Position, toJSON', function () {
|
||||
@@ -120,11 +120,11 @@ suite('ExtHostTypes', function () {
|
||||
let p2 = new types.Position(1, 2);
|
||||
let p3 = new types.Position(0, 4);
|
||||
|
||||
assert.equal(p1.compareTo(p1), 0);
|
||||
assert.equal(p2.compareTo(p1), -1);
|
||||
assert.equal(p1.compareTo(p2), 1);
|
||||
assert.equal(p2.compareTo(p3), 1);
|
||||
assert.equal(p1.compareTo(p3), 1);
|
||||
assert.strictEqual(p1.compareTo(p1), 0);
|
||||
assert.strictEqual(p2.compareTo(p1), -1);
|
||||
assert.strictEqual(p1.compareTo(p2), 1);
|
||||
assert.strictEqual(p2.compareTo(p3), 1);
|
||||
assert.strictEqual(p1.compareTo(p3), 1);
|
||||
});
|
||||
|
||||
test('Position, translate', function () {
|
||||
@@ -138,24 +138,24 @@ suite('ExtHostTypes', function () {
|
||||
assert.ok(p1.translate(undefined) === p1);
|
||||
|
||||
let res = p1.translate(-1);
|
||||
assert.equal(res.line, 0);
|
||||
assert.equal(res.character, 3);
|
||||
assert.strictEqual(res.line, 0);
|
||||
assert.strictEqual(res.character, 3);
|
||||
|
||||
res = p1.translate({ lineDelta: -1 });
|
||||
assert.equal(res.line, 0);
|
||||
assert.equal(res.character, 3);
|
||||
assert.strictEqual(res.line, 0);
|
||||
assert.strictEqual(res.character, 3);
|
||||
|
||||
res = p1.translate(undefined, -1);
|
||||
assert.equal(res.line, 1);
|
||||
assert.equal(res.character, 2);
|
||||
assert.strictEqual(res.line, 1);
|
||||
assert.strictEqual(res.character, 2);
|
||||
|
||||
res = p1.translate({ characterDelta: -1 });
|
||||
assert.equal(res.line, 1);
|
||||
assert.equal(res.character, 2);
|
||||
assert.strictEqual(res.line, 1);
|
||||
assert.strictEqual(res.character, 2);
|
||||
|
||||
res = p1.translate(11);
|
||||
assert.equal(res.line, 12);
|
||||
assert.equal(res.character, 3);
|
||||
assert.strictEqual(res.line, 12);
|
||||
assert.strictEqual(res.character, 3);
|
||||
|
||||
assert.throws(() => p1.translate(null!));
|
||||
assert.throws(() => p1.translate(null!, null!));
|
||||
@@ -178,8 +178,8 @@ suite('ExtHostTypes', function () {
|
||||
assert.ok(p1.with({ line: 1, character: 3 }) === p1);
|
||||
|
||||
let p2 = p1.with({ line: 0, character: 11 });
|
||||
assert.equal(p2.line, 0);
|
||||
assert.equal(p2.character, 11);
|
||||
assert.strictEqual(p2.line, 0);
|
||||
assert.strictEqual(p2.character, 11);
|
||||
|
||||
assert.throws(() => p1.with(null!));
|
||||
assert.throws(() => p1.with(-9));
|
||||
@@ -210,12 +210,12 @@ suite('ExtHostTypes', function () {
|
||||
test('Range, sorting', function () {
|
||||
// sorts start/end
|
||||
let range = new types.Range(1, 0, 0, 0);
|
||||
assert.equal(range.start.line, 0);
|
||||
assert.equal(range.end.line, 1);
|
||||
assert.strictEqual(range.start.line, 0);
|
||||
assert.strictEqual(range.end.line, 1);
|
||||
|
||||
range = new types.Range(0, 0, 1, 0);
|
||||
assert.equal(range.start.line, 0);
|
||||
assert.equal(range.end.line, 1);
|
||||
assert.strictEqual(range.start.line, 0);
|
||||
assert.strictEqual(range.end.line, 1);
|
||||
});
|
||||
|
||||
test('Range, isEmpty|isSingleLine', function () {
|
||||
@@ -254,26 +254,26 @@ suite('ExtHostTypes', function () {
|
||||
let res: types.Range;
|
||||
|
||||
res = range.intersection(range)!;
|
||||
assert.equal(res.start.line, 1);
|
||||
assert.equal(res.start.character, 1);
|
||||
assert.equal(res.end.line, 2);
|
||||
assert.equal(res.end.character, 11);
|
||||
assert.strictEqual(res.start.line, 1);
|
||||
assert.strictEqual(res.start.character, 1);
|
||||
assert.strictEqual(res.end.line, 2);
|
||||
assert.strictEqual(res.end.character, 11);
|
||||
|
||||
res = range.intersection(new types.Range(2, 12, 4, 0))!;
|
||||
assert.equal(res, undefined);
|
||||
assert.strictEqual(res, undefined);
|
||||
|
||||
res = range.intersection(new types.Range(0, 0, 1, 0))!;
|
||||
assert.equal(res, undefined);
|
||||
assert.strictEqual(res, undefined);
|
||||
|
||||
res = range.intersection(new types.Range(0, 0, 1, 1))!;
|
||||
assert.ok(res.isEmpty);
|
||||
assert.equal(res.start.line, 1);
|
||||
assert.equal(res.start.character, 1);
|
||||
assert.strictEqual(res.start.line, 1);
|
||||
assert.strictEqual(res.start.character, 1);
|
||||
|
||||
res = range.intersection(new types.Range(2, 11, 61, 1))!;
|
||||
assert.ok(res.isEmpty);
|
||||
assert.equal(res.start.line, 2);
|
||||
assert.equal(res.start.character, 11);
|
||||
assert.strictEqual(res.start.line, 2);
|
||||
assert.strictEqual(res.start.character, 11);
|
||||
|
||||
assert.throws(() => range.intersection(null!));
|
||||
assert.throws(() => range.intersection(undefined!));
|
||||
@@ -286,14 +286,14 @@ suite('ExtHostTypes', function () {
|
||||
let res: types.Range;
|
||||
res = ran1.union(new types.Range(2, 2, 9, 9));
|
||||
assert.ok(res.start === ran1.start);
|
||||
assert.equal(res.end.line, 9);
|
||||
assert.equal(res.end.character, 9);
|
||||
assert.strictEqual(res.end.line, 9);
|
||||
assert.strictEqual(res.end.character, 9);
|
||||
|
||||
ran1 = new types.Range(2, 1, 5, 3);
|
||||
res = ran1.union(new types.Range(1, 0, 4, 2));
|
||||
assert.ok(res.end === ran1.end);
|
||||
assert.equal(res.start.line, 1);
|
||||
assert.equal(res.start.character, 0);
|
||||
assert.strictEqual(res.start.line, 1);
|
||||
assert.strictEqual(res.start.character, 0);
|
||||
});
|
||||
|
||||
test('Range, with', function () {
|
||||
@@ -311,22 +311,22 @@ suite('ExtHostTypes', function () {
|
||||
assert.ok(range.with({ end: new types.Position(2, 11) }) === range);
|
||||
|
||||
let res = range.with(undefined, new types.Position(9, 8));
|
||||
assert.equal(res.end.line, 9);
|
||||
assert.equal(res.end.character, 8);
|
||||
assert.equal(res.start.line, 1);
|
||||
assert.equal(res.start.character, 1);
|
||||
assert.strictEqual(res.end.line, 9);
|
||||
assert.strictEqual(res.end.character, 8);
|
||||
assert.strictEqual(res.start.line, 1);
|
||||
assert.strictEqual(res.start.character, 1);
|
||||
|
||||
res = range.with({ end: new types.Position(9, 8) });
|
||||
assert.equal(res.end.line, 9);
|
||||
assert.equal(res.end.character, 8);
|
||||
assert.equal(res.start.line, 1);
|
||||
assert.equal(res.start.character, 1);
|
||||
assert.strictEqual(res.end.line, 9);
|
||||
assert.strictEqual(res.end.character, 8);
|
||||
assert.strictEqual(res.start.line, 1);
|
||||
assert.strictEqual(res.start.character, 1);
|
||||
|
||||
res = range.with({ end: new types.Position(9, 8), start: new types.Position(2, 3) });
|
||||
assert.equal(res.end.line, 9);
|
||||
assert.equal(res.end.character, 8);
|
||||
assert.equal(res.start.line, 2);
|
||||
assert.equal(res.start.character, 3);
|
||||
assert.strictEqual(res.end.line, 9);
|
||||
assert.strictEqual(res.end.character, 8);
|
||||
assert.strictEqual(res.start.line, 2);
|
||||
assert.strictEqual(res.start.character, 3);
|
||||
|
||||
assert.throws(() => range.with(null!));
|
||||
assert.throws(() => range.with(undefined, null!));
|
||||
@@ -336,14 +336,14 @@ suite('ExtHostTypes', function () {
|
||||
|
||||
let range = new types.Range(1, 1, 2, 11);
|
||||
let edit = new types.TextEdit(range, undefined!);
|
||||
assert.equal(edit.newText, '');
|
||||
assert.strictEqual(edit.newText, '');
|
||||
assertToJSON(edit, { range: [{ line: 1, character: 1 }, { line: 2, character: 11 }], newText: '' });
|
||||
|
||||
edit = new types.TextEdit(range, null!);
|
||||
assert.equal(edit.newText, '');
|
||||
assert.strictEqual(edit.newText, '');
|
||||
|
||||
edit = new types.TextEdit(range, '');
|
||||
assert.equal(edit.newText, '');
|
||||
assert.strictEqual(edit.newText, '');
|
||||
});
|
||||
|
||||
test('WorkspaceEdit', () => {
|
||||
@@ -356,13 +356,13 @@ suite('ExtHostTypes', function () {
|
||||
|
||||
edit.set(a, [types.TextEdit.insert(new types.Position(0, 0), 'fff')]);
|
||||
assert.ok(edit.has(a));
|
||||
assert.equal(edit.size, 1);
|
||||
assert.strictEqual(edit.size, 1);
|
||||
assertToJSON(edit, [[a.toJSON(), [{ range: [{ line: 0, character: 0 }, { line: 0, character: 0 }], newText: 'fff' }]]]);
|
||||
|
||||
edit.insert(b, new types.Position(1, 1), 'fff');
|
||||
edit.delete(b, new types.Range(0, 0, 0, 0));
|
||||
assert.ok(edit.has(b));
|
||||
assert.equal(edit.size, 2);
|
||||
assert.strictEqual(edit.size, 2);
|
||||
assertToJSON(edit, [
|
||||
[a.toJSON(), [{ range: [{ line: 0, character: 0 }, { line: 0, character: 0 }], newText: 'fff' }]],
|
||||
[b.toJSON(), [{ range: [{ line: 1, character: 1 }, { line: 1, character: 1 }], newText: 'fff' }, { range: [{ line: 0, character: 0 }, { line: 0, character: 0 }], newText: '' }]]
|
||||
@@ -370,10 +370,10 @@ suite('ExtHostTypes', function () {
|
||||
|
||||
edit.set(b, undefined!);
|
||||
assert.ok(!edit.has(b));
|
||||
assert.equal(edit.size, 1);
|
||||
assert.strictEqual(edit.size, 1);
|
||||
|
||||
edit.set(b, [types.TextEdit.insert(new types.Position(0, 0), 'ffff')]);
|
||||
assert.equal(edit.get(b).length, 1);
|
||||
assert.strictEqual(edit.get(b).length, 1);
|
||||
});
|
||||
|
||||
test('WorkspaceEdit - keep order of text and file changes', function () {
|
||||
@@ -385,21 +385,21 @@ suite('ExtHostTypes', function () {
|
||||
edit.replace(URI.parse('foo:b'), new types.Range(3, 1, 3, 1), 'bazz');
|
||||
|
||||
const all = edit._allEntries();
|
||||
assert.equal(all.length, 4);
|
||||
assert.strictEqual(all.length, 4);
|
||||
|
||||
const [first, second, third, fourth] = all;
|
||||
assertType(first._type === types.FileEditType.Text);
|
||||
assert.equal(first.uri.toString(), 'foo:a');
|
||||
assert.strictEqual(first.uri.toString(), 'foo:a');
|
||||
|
||||
assertType(second._type === types.FileEditType.File);
|
||||
assert.equal(second.from!.toString(), 'foo:a');
|
||||
assert.equal(second.to!.toString(), 'foo:b');
|
||||
assert.strictEqual(second.from!.toString(), 'foo:a');
|
||||
assert.strictEqual(second.to!.toString(), 'foo:b');
|
||||
|
||||
assertType(third._type === types.FileEditType.Text);
|
||||
assert.equal(third.uri.toString(), 'foo:a');
|
||||
assert.strictEqual(third.uri.toString(), 'foo:a');
|
||||
|
||||
assertType(fourth._type === types.FileEditType.Text);
|
||||
assert.equal(fourth.uri.toString(), 'foo:b');
|
||||
assert.strictEqual(fourth.uri.toString(), 'foo:b');
|
||||
});
|
||||
|
||||
test('WorkspaceEdit - two edits for one resource', function () {
|
||||
@@ -408,13 +408,13 @@ suite('ExtHostTypes', function () {
|
||||
edit.insert(uri, new types.Position(0, 0), 'Hello');
|
||||
edit.insert(uri, new types.Position(0, 0), 'Foo');
|
||||
|
||||
assert.equal(edit._allEntries().length, 2);
|
||||
assert.strictEqual(edit._allEntries().length, 2);
|
||||
let [first, second] = edit._allEntries();
|
||||
|
||||
assertType(first._type === types.FileEditType.Text);
|
||||
assertType(second._type === types.FileEditType.Text);
|
||||
assert.equal(first.edit.newText, 'Hello');
|
||||
assert.equal(second.edit.newText, 'Foo');
|
||||
assert.strictEqual(first.edit.newText, 'Hello');
|
||||
assert.strictEqual(second.edit.newText, 'Foo');
|
||||
});
|
||||
|
||||
test('DocumentLink', () => {
|
||||
@@ -463,7 +463,7 @@ suite('ExtHostTypes', function () {
|
||||
|
||||
let info = new types.SymbolInformation('foo', types.SymbolKind.Array, new types.Range(1, 1, 2, 3));
|
||||
assert.ok(info.location instanceof types.Location);
|
||||
assert.equal(info.location.uri, undefined);
|
||||
assert.strictEqual(info.location.uri, undefined);
|
||||
});
|
||||
|
||||
test('SnippetString, builder-methods', function () {
|
||||
@@ -471,78 +471,78 @@ suite('ExtHostTypes', function () {
|
||||
let string: types.SnippetString;
|
||||
|
||||
string = new types.SnippetString();
|
||||
assert.equal(string.appendText('I need $ and $').value, 'I need \\$ and \\$');
|
||||
assert.strictEqual(string.appendText('I need $ and $').value, 'I need \\$ and \\$');
|
||||
|
||||
string = new types.SnippetString();
|
||||
assert.equal(string.appendText('I need \\$').value, 'I need \\\\\\$');
|
||||
assert.strictEqual(string.appendText('I need \\$').value, 'I need \\\\\\$');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendPlaceholder('fo$o}');
|
||||
assert.equal(string.value, '${1:fo\\$o\\}}');
|
||||
assert.strictEqual(string.value, '${1:fo\\$o\\}}');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendText('foo').appendTabstop(0).appendText('bar');
|
||||
assert.equal(string.value, 'foo$0bar');
|
||||
assert.strictEqual(string.value, 'foo$0bar');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendText('foo').appendTabstop().appendText('bar');
|
||||
assert.equal(string.value, 'foo$1bar');
|
||||
assert.strictEqual(string.value, 'foo$1bar');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendText('foo').appendTabstop(42).appendText('bar');
|
||||
assert.equal(string.value, 'foo$42bar');
|
||||
assert.strictEqual(string.value, 'foo$42bar');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendText('foo').appendPlaceholder('farboo').appendText('bar');
|
||||
assert.equal(string.value, 'foo${1:farboo}bar');
|
||||
assert.strictEqual(string.value, 'foo${1:farboo}bar');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendText('foo').appendPlaceholder('far$boo').appendText('bar');
|
||||
assert.equal(string.value, 'foo${1:far\\$boo}bar');
|
||||
assert.strictEqual(string.value, 'foo${1:far\\$boo}bar');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendText('foo').appendPlaceholder(b => b.appendText('abc').appendPlaceholder('nested')).appendText('bar');
|
||||
assert.equal(string.value, 'foo${1:abc${2:nested}}bar');
|
||||
assert.strictEqual(string.value, 'foo${1:abc${2:nested}}bar');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendVariable('foo');
|
||||
assert.equal(string.value, '${foo}');
|
||||
assert.strictEqual(string.value, '${foo}');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendText('foo').appendVariable('TM_SELECTED_TEXT').appendText('bar');
|
||||
assert.equal(string.value, 'foo${TM_SELECTED_TEXT}bar');
|
||||
assert.strictEqual(string.value, 'foo${TM_SELECTED_TEXT}bar');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendVariable('BAR', b => b.appendPlaceholder('ops'));
|
||||
assert.equal(string.value, '${BAR:${1:ops}}');
|
||||
assert.strictEqual(string.value, '${BAR:${1:ops}}');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendVariable('BAR', b => { });
|
||||
assert.equal(string.value, '${BAR}');
|
||||
assert.strictEqual(string.value, '${BAR}');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendChoice(['b', 'a', 'r']);
|
||||
assert.equal(string.value, '${1|b,a,r|}');
|
||||
assert.strictEqual(string.value, '${1|b,a,r|}');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendChoice(['b,1', 'a,2', 'r,3']);
|
||||
assert.equal(string.value, '${1|b\\,1,a\\,2,r\\,3|}');
|
||||
assert.strictEqual(string.value, '${1|b\\,1,a\\,2,r\\,3|}');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendChoice(['b', 'a', 'r'], 0);
|
||||
assert.equal(string.value, '${0|b,a,r|}');
|
||||
assert.strictEqual(string.value, '${0|b,a,r|}');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendText('foo').appendChoice(['far', 'boo']).appendText('bar');
|
||||
assert.equal(string.value, 'foo${1|far,boo|}bar');
|
||||
assert.strictEqual(string.value, 'foo${1|far,boo|}bar');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendText('foo').appendChoice(['far', '$boo']).appendText('bar');
|
||||
assert.equal(string.value, 'foo${1|far,\\$boo|}bar');
|
||||
assert.strictEqual(string.value, 'foo${1|far,\\$boo|}bar');
|
||||
|
||||
string = new types.SnippetString();
|
||||
string.appendText('foo').appendPlaceholder('farboo').appendChoice(['far', 'boo']).appendText('bar');
|
||||
assert.equal(string.value, 'foo${1:farboo}${2|far,boo|}bar');
|
||||
assert.strictEqual(string.value, 'foo${1:farboo}${2|far,boo|}bar');
|
||||
});
|
||||
|
||||
test('instanceof doesn\'t work for FileSystemError #49386', function () {
|
||||
@@ -584,7 +584,7 @@ suite('ExtHostTypes', function () {
|
||||
builder.push(1, 0, 5, 1, 1);
|
||||
builder.push(1, 10, 4, 2, 2);
|
||||
builder.push(2, 2, 3, 2, 2);
|
||||
assert.deepEqual(toArr(builder.build().data), [
|
||||
assert.deepStrictEqual(toArr(builder.build().data), [
|
||||
1, 0, 5, 1, 1,
|
||||
0, 10, 4, 2, 2,
|
||||
1, 2, 3, 2, 2
|
||||
@@ -596,7 +596,7 @@ suite('ExtHostTypes', function () {
|
||||
builder.push(1, 0, 5, 1);
|
||||
builder.push(1, 10, 4, 2);
|
||||
builder.push(2, 2, 3, 2);
|
||||
assert.deepEqual(toArr(builder.build().data), [
|
||||
assert.deepStrictEqual(toArr(builder.build().data), [
|
||||
1, 0, 5, 1, 0,
|
||||
0, 10, 4, 2, 0,
|
||||
1, 2, 3, 2, 0
|
||||
@@ -609,7 +609,7 @@ suite('ExtHostTypes', function () {
|
||||
builder.push(2, 10, 1, 2, 2);
|
||||
builder.push(2, 15, 2, 3, 3);
|
||||
builder.push(1, 0, 4, 4, 4);
|
||||
assert.deepEqual(toArr(builder.build().data), [
|
||||
assert.deepStrictEqual(toArr(builder.build().data), [
|
||||
1, 0, 4, 4, 4,
|
||||
1, 0, 5, 1, 1,
|
||||
0, 10, 1, 2, 2,
|
||||
@@ -621,7 +621,7 @@ suite('ExtHostTypes', function () {
|
||||
const builder = new types.SemanticTokensBuilder();
|
||||
builder.push(2, 10, 5, 1, 1);
|
||||
builder.push(2, 2, 4, 2, 2);
|
||||
assert.deepEqual(toArr(builder.build().data), [
|
||||
assert.deepStrictEqual(toArr(builder.build().data), [
|
||||
2, 2, 4, 2, 2,
|
||||
0, 8, 5, 1, 1
|
||||
]);
|
||||
@@ -636,7 +636,7 @@ suite('ExtHostTypes', function () {
|
||||
builder.push(new types.Range(1, 0, 1, 5), 'bType');
|
||||
builder.push(new types.Range(2, 0, 2, 4), 'cType', ['mod0', 'mod5']);
|
||||
builder.push(new types.Range(3, 0, 3, 3), 'dType', ['mod2', 'mod4']);
|
||||
assert.deepEqual(toArr(builder.build().data), [
|
||||
assert.deepStrictEqual(toArr(builder.build().data), [
|
||||
1, 0, 5, 1, 0,
|
||||
1, 0, 4, 2, 1 | (1 << 5),
|
||||
1, 0, 3, 3, (1 << 2) | (1 << 4)
|
||||
@@ -645,7 +645,7 @@ suite('ExtHostTypes', function () {
|
||||
|
||||
test('Markdown codeblock rendering is swapped #111604', function () {
|
||||
const md = new types.MarkdownString().appendCodeblock('<img src=0 onerror="alert(1)">', 'html');
|
||||
assert.deepEqual(md.value, '\n```html\n<img src=0 onerror="alert(1)">\n```\n');
|
||||
assert.deepStrictEqual(md.value, '\n```html\n<img src=0 onerror="alert(1)">\n```\n');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ suite('ExtHostWorkspace', function () {
|
||||
|
||||
function assertAsRelativePath(workspace: ExtHostWorkspace, input: string, expected: string, includeWorkspace?: boolean) {
|
||||
const actual = workspace.getRelativePath(input, includeWorkspace);
|
||||
assert.equal(actual, expected);
|
||||
assert.strictEqual(actual, expected);
|
||||
}
|
||||
|
||||
test('asRelativePath', () => {
|
||||
@@ -116,19 +116,19 @@ suite('ExtHostWorkspace', function () {
|
||||
|
||||
test('getPath, legacy', function () {
|
||||
let ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [] }, new NullLogService());
|
||||
assert.equal(ws.getPath(), undefined);
|
||||
assert.strictEqual(ws.getPath(), undefined);
|
||||
|
||||
ws = createExtHostWorkspace(new TestRPCProtocol(), null!, new NullLogService());
|
||||
assert.equal(ws.getPath(), undefined);
|
||||
assert.strictEqual(ws.getPath(), undefined);
|
||||
|
||||
ws = createExtHostWorkspace(new TestRPCProtocol(), undefined!, new NullLogService());
|
||||
assert.equal(ws.getPath(), undefined);
|
||||
assert.strictEqual(ws.getPath(), undefined);
|
||||
|
||||
ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.file('Folder'), 0), aWorkspaceFolderData(URI.file('Another/Folder'), 1)] }, new NullLogService());
|
||||
assert.equal(ws.getPath()!.replace(/\\/g, '/'), '/Folder');
|
||||
assert.strictEqual(ws.getPath()!.replace(/\\/g, '/'), '/Folder');
|
||||
|
||||
ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.file('/Folder'), 0)] }, new NullLogService());
|
||||
assert.equal(ws.getPath()!.replace(/\\/g, '/'), '/Folder');
|
||||
assert.strictEqual(ws.getPath()!.replace(/\\/g, '/'), '/Folder');
|
||||
});
|
||||
|
||||
test('WorkspaceFolder has name and index', function () {
|
||||
@@ -136,10 +136,10 @@ suite('ExtHostWorkspace', function () {
|
||||
|
||||
const [one, two] = ws.getWorkspaceFolders()!;
|
||||
|
||||
assert.equal(one.name, 'One');
|
||||
assert.equal(one.index, 0);
|
||||
assert.equal(two.name, 'Two');
|
||||
assert.equal(two.index, 1);
|
||||
assert.strictEqual(one.name, 'One');
|
||||
assert.strictEqual(one.index, 0);
|
||||
assert.strictEqual(two.name, 'Two');
|
||||
assert.strictEqual(two.index, 1);
|
||||
});
|
||||
|
||||
test('getContainingWorkspaceFolder', () => {
|
||||
@@ -154,40 +154,40 @@ suite('ExtHostWorkspace', function () {
|
||||
}, new NullLogService());
|
||||
|
||||
let folder = ws.getWorkspaceFolder(URI.file('/foo/bar'));
|
||||
assert.equal(folder, undefined);
|
||||
assert.strictEqual(folder, undefined);
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/One/file/path.txt'))!;
|
||||
assert.equal(folder.name, 'One');
|
||||
assert.strictEqual(folder.name, 'One');
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/Two/file/path.txt'))!;
|
||||
assert.equal(folder.name, 'Two');
|
||||
assert.strictEqual(folder.name, 'Two');
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/Two/Nest'))!;
|
||||
assert.equal(folder.name, 'Two');
|
||||
assert.strictEqual(folder.name, 'Two');
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/Two/Nested/file'))!;
|
||||
assert.equal(folder.name, 'Nested');
|
||||
assert.strictEqual(folder.name, 'Nested');
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/Two/Nested/f'))!;
|
||||
assert.equal(folder.name, 'Nested');
|
||||
assert.strictEqual(folder.name, 'Nested');
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/Two/Nested'), true)!;
|
||||
assert.equal(folder.name, 'Two');
|
||||
assert.strictEqual(folder.name, 'Two');
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/Two/Nested/'), true)!;
|
||||
assert.equal(folder.name, 'Two');
|
||||
assert.strictEqual(folder.name, 'Two');
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/Two/Nested'))!;
|
||||
assert.equal(folder.name, 'Nested');
|
||||
assert.strictEqual(folder.name, 'Nested');
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/Two/Nested/'))!;
|
||||
assert.equal(folder.name, 'Nested');
|
||||
assert.strictEqual(folder.name, 'Nested');
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/Two'), true)!;
|
||||
assert.equal(folder, undefined);
|
||||
assert.strictEqual(folder, undefined);
|
||||
|
||||
folder = ws.getWorkspaceFolder(URI.file('/Coding/Two'), false)!;
|
||||
assert.equal(folder.name, 'Two');
|
||||
assert.strictEqual(folder.name, 'Two');
|
||||
});
|
||||
|
||||
test('Multiroot change event should have a delta, #29641', function (done) {
|
||||
@@ -203,8 +203,8 @@ suite('ExtHostWorkspace', function () {
|
||||
|
||||
let sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.deepEqual(e.added, []);
|
||||
assert.deepEqual(e.removed, []);
|
||||
assert.deepStrictEqual(e.added, []);
|
||||
assert.deepStrictEqual(e.removed, []);
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
}
|
||||
@@ -214,9 +214,9 @@ suite('ExtHostWorkspace', function () {
|
||||
|
||||
sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.deepEqual(e.removed, []);
|
||||
assert.equal(e.added.length, 1);
|
||||
assert.equal(e.added[0].uri.toString(), 'foo:bar');
|
||||
assert.deepStrictEqual(e.removed, []);
|
||||
assert.strictEqual(e.added.length, 1);
|
||||
assert.strictEqual(e.added[0].uri.toString(), 'foo:bar');
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
}
|
||||
@@ -226,9 +226,9 @@ suite('ExtHostWorkspace', function () {
|
||||
|
||||
sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.deepEqual(e.removed, []);
|
||||
assert.equal(e.added.length, 1);
|
||||
assert.equal(e.added[0].uri.toString(), 'foo:bar2');
|
||||
assert.deepStrictEqual(e.removed, []);
|
||||
assert.strictEqual(e.added.length, 1);
|
||||
assert.strictEqual(e.added[0].uri.toString(), 'foo:bar2');
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
}
|
||||
@@ -238,12 +238,12 @@ suite('ExtHostWorkspace', function () {
|
||||
|
||||
sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.equal(e.removed.length, 2);
|
||||
assert.equal(e.removed[0].uri.toString(), 'foo:bar');
|
||||
assert.equal(e.removed[1].uri.toString(), 'foo:bar2');
|
||||
assert.strictEqual(e.removed.length, 2);
|
||||
assert.strictEqual(e.removed[0].uri.toString(), 'foo:bar');
|
||||
assert.strictEqual(e.removed[1].uri.toString(), 'foo:bar2');
|
||||
|
||||
assert.equal(e.added.length, 1);
|
||||
assert.equal(e.added[0].uri.toString(), 'foo:bar3');
|
||||
assert.strictEqual(e.added.length, 1);
|
||||
assert.strictEqual(e.added[0].uri.toString(), 'foo:bar3');
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
}
|
||||
@@ -259,13 +259,13 @@ suite('ExtHostWorkspace', function () {
|
||||
let firstFolder = ws.getWorkspaceFolders()![0];
|
||||
ws.$acceptWorkspaceData({ id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar2'), 0), aWorkspaceFolderData(URI.parse('foo:bar'), 1, 'renamed')] });
|
||||
|
||||
assert.equal(ws.getWorkspaceFolders()![1], firstFolder);
|
||||
assert.equal(firstFolder.index, 1);
|
||||
assert.equal(firstFolder.name, 'renamed');
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![1], firstFolder);
|
||||
assert.strictEqual(firstFolder.index, 1);
|
||||
assert.strictEqual(firstFolder.name, 'renamed');
|
||||
|
||||
ws.$acceptWorkspaceData({ id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar3'), 0), aWorkspaceFolderData(URI.parse('foo:bar2'), 1), aWorkspaceFolderData(URI.parse('foo:bar'), 2)] });
|
||||
assert.equal(ws.getWorkspaceFolders()![2], firstFolder);
|
||||
assert.equal(firstFolder.index, 2);
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![2], firstFolder);
|
||||
assert.strictEqual(firstFolder.index, 2);
|
||||
|
||||
ws.$acceptWorkspaceData({ id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar3'), 0)] });
|
||||
ws.$acceptWorkspaceData({ id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar3'), 0), aWorkspaceFolderData(URI.parse('foo:bar'), 1)] });
|
||||
@@ -276,18 +276,18 @@ suite('ExtHostWorkspace', function () {
|
||||
test('updateWorkspaceFolders - invalid arguments', function () {
|
||||
let ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [] }, new NullLogService());
|
||||
|
||||
assert.equal(false, ws.updateWorkspaceFolders(extensionDescriptor, null!, null!));
|
||||
assert.equal(false, ws.updateWorkspaceFolders(extensionDescriptor, 0, 0));
|
||||
assert.equal(false, ws.updateWorkspaceFolders(extensionDescriptor, 0, 1));
|
||||
assert.equal(false, ws.updateWorkspaceFolders(extensionDescriptor, 1, 0));
|
||||
assert.equal(false, ws.updateWorkspaceFolders(extensionDescriptor, -1, 0));
|
||||
assert.equal(false, ws.updateWorkspaceFolders(extensionDescriptor, -1, -1));
|
||||
assert.strictEqual(false, ws.updateWorkspaceFolders(extensionDescriptor, null!, null!));
|
||||
assert.strictEqual(false, ws.updateWorkspaceFolders(extensionDescriptor, 0, 0));
|
||||
assert.strictEqual(false, ws.updateWorkspaceFolders(extensionDescriptor, 0, 1));
|
||||
assert.strictEqual(false, ws.updateWorkspaceFolders(extensionDescriptor, 1, 0));
|
||||
assert.strictEqual(false, ws.updateWorkspaceFolders(extensionDescriptor, -1, 0));
|
||||
assert.strictEqual(false, ws.updateWorkspaceFolders(extensionDescriptor, -1, -1));
|
||||
|
||||
ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar'), 0)] }, new NullLogService());
|
||||
|
||||
assert.equal(false, ws.updateWorkspaceFolders(extensionDescriptor, 1, 1));
|
||||
assert.equal(false, ws.updateWorkspaceFolders(extensionDescriptor, 0, 2));
|
||||
assert.equal(false, ws.updateWorkspaceFolders(extensionDescriptor, 0, 1, asUpdateWorkspaceFolderData(URI.parse('foo:bar'))));
|
||||
assert.strictEqual(false, ws.updateWorkspaceFolders(extensionDescriptor, 1, 1));
|
||||
assert.strictEqual(false, ws.updateWorkspaceFolders(extensionDescriptor, 0, 2));
|
||||
assert.strictEqual(false, ws.updateWorkspaceFolders(extensionDescriptor, 0, 1, asUpdateWorkspaceFolderData(URI.parse('foo:bar'))));
|
||||
});
|
||||
|
||||
test('updateWorkspaceFolders - valid arguments', function (done) {
|
||||
@@ -312,38 +312,38 @@ suite('ExtHostWorkspace', function () {
|
||||
// Add one folder
|
||||
//
|
||||
|
||||
assert.equal(true, ws.updateWorkspaceFolders(extensionDescriptor, 0, 0, asUpdateWorkspaceFolderData(URI.parse('foo:bar'))));
|
||||
assert.equal(1, ws.workspace!.folders.length);
|
||||
assert.equal(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar').toString());
|
||||
assert.strictEqual(true, ws.updateWorkspaceFolders(extensionDescriptor, 0, 0, asUpdateWorkspaceFolderData(URI.parse('foo:bar'))));
|
||||
assert.strictEqual(1, ws.workspace!.folders.length);
|
||||
assert.strictEqual(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar').toString());
|
||||
|
||||
const firstAddedFolder = ws.getWorkspaceFolders()![0];
|
||||
|
||||
let gotEvent = false;
|
||||
let sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.deepEqual(e.removed, []);
|
||||
assert.equal(e.added.length, 1);
|
||||
assert.equal(e.added[0].uri.toString(), 'foo:bar');
|
||||
assert.equal(e.added[0], firstAddedFolder); // verify object is still live
|
||||
assert.deepStrictEqual(e.removed, []);
|
||||
assert.strictEqual(e.added.length, 1);
|
||||
assert.strictEqual(e.added[0].uri.toString(), 'foo:bar');
|
||||
assert.strictEqual(e.added[0], firstAddedFolder); // verify object is still live
|
||||
gotEvent = true;
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
}
|
||||
});
|
||||
ws.$acceptWorkspaceData({ id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar'), 0)] }); // simulate acknowledgement from main side
|
||||
assert.equal(gotEvent, true);
|
||||
assert.strictEqual(gotEvent, true);
|
||||
sub.dispose();
|
||||
assert.equal(ws.getWorkspaceFolders()![0], firstAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![0], firstAddedFolder); // verify object is still live
|
||||
|
||||
//
|
||||
// Add two more folders
|
||||
//
|
||||
|
||||
assert.equal(true, ws.updateWorkspaceFolders(extensionDescriptor, 1, 0, asUpdateWorkspaceFolderData(URI.parse('foo:bar1')), asUpdateWorkspaceFolderData(URI.parse('foo:bar2'))));
|
||||
assert.equal(3, ws.workspace!.folders.length);
|
||||
assert.equal(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar').toString());
|
||||
assert.equal(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar1').toString());
|
||||
assert.equal(ws.workspace!.folders[2].uri.toString(), URI.parse('foo:bar2').toString());
|
||||
assert.strictEqual(true, ws.updateWorkspaceFolders(extensionDescriptor, 1, 0, asUpdateWorkspaceFolderData(URI.parse('foo:bar1')), asUpdateWorkspaceFolderData(URI.parse('foo:bar2'))));
|
||||
assert.strictEqual(3, ws.workspace!.folders.length);
|
||||
assert.strictEqual(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar').toString());
|
||||
assert.strictEqual(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar1').toString());
|
||||
assert.strictEqual(ws.workspace!.folders[2].uri.toString(), URI.parse('foo:bar2').toString());
|
||||
|
||||
const secondAddedFolder = ws.getWorkspaceFolders()![1];
|
||||
const thirdAddedFolder = ws.getWorkspaceFolders()![2];
|
||||
@@ -351,91 +351,91 @@ suite('ExtHostWorkspace', function () {
|
||||
gotEvent = false;
|
||||
sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.deepEqual(e.removed, []);
|
||||
assert.equal(e.added.length, 2);
|
||||
assert.equal(e.added[0].uri.toString(), 'foo:bar1');
|
||||
assert.equal(e.added[1].uri.toString(), 'foo:bar2');
|
||||
assert.equal(e.added[0], secondAddedFolder);
|
||||
assert.equal(e.added[1], thirdAddedFolder);
|
||||
assert.deepStrictEqual(e.removed, []);
|
||||
assert.strictEqual(e.added.length, 2);
|
||||
assert.strictEqual(e.added[0].uri.toString(), 'foo:bar1');
|
||||
assert.strictEqual(e.added[1].uri.toString(), 'foo:bar2');
|
||||
assert.strictEqual(e.added[0], secondAddedFolder);
|
||||
assert.strictEqual(e.added[1], thirdAddedFolder);
|
||||
gotEvent = true;
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
}
|
||||
});
|
||||
ws.$acceptWorkspaceData({ id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar'), 0), aWorkspaceFolderData(URI.parse('foo:bar1'), 1), aWorkspaceFolderData(URI.parse('foo:bar2'), 2)] }); // simulate acknowledgement from main side
|
||||
assert.equal(gotEvent, true);
|
||||
assert.strictEqual(gotEvent, true);
|
||||
sub.dispose();
|
||||
assert.equal(ws.getWorkspaceFolders()![0], firstAddedFolder); // verify object is still live
|
||||
assert.equal(ws.getWorkspaceFolders()![1], secondAddedFolder); // verify object is still live
|
||||
assert.equal(ws.getWorkspaceFolders()![2], thirdAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![0], firstAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![1], secondAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![2], thirdAddedFolder); // verify object is still live
|
||||
|
||||
//
|
||||
// Remove one folder
|
||||
//
|
||||
|
||||
assert.equal(true, ws.updateWorkspaceFolders(extensionDescriptor, 2, 1));
|
||||
assert.equal(2, ws.workspace!.folders.length);
|
||||
assert.equal(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar').toString());
|
||||
assert.equal(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar1').toString());
|
||||
assert.strictEqual(true, ws.updateWorkspaceFolders(extensionDescriptor, 2, 1));
|
||||
assert.strictEqual(2, ws.workspace!.folders.length);
|
||||
assert.strictEqual(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar').toString());
|
||||
assert.strictEqual(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar1').toString());
|
||||
|
||||
gotEvent = false;
|
||||
sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.deepEqual(e.added, []);
|
||||
assert.equal(e.removed.length, 1);
|
||||
assert.equal(e.removed[0], thirdAddedFolder);
|
||||
assert.deepStrictEqual(e.added, []);
|
||||
assert.strictEqual(e.removed.length, 1);
|
||||
assert.strictEqual(e.removed[0], thirdAddedFolder);
|
||||
gotEvent = true;
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
}
|
||||
});
|
||||
ws.$acceptWorkspaceData({ id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar'), 0), aWorkspaceFolderData(URI.parse('foo:bar1'), 1)] }); // simulate acknowledgement from main side
|
||||
assert.equal(gotEvent, true);
|
||||
assert.strictEqual(gotEvent, true);
|
||||
sub.dispose();
|
||||
assert.equal(ws.getWorkspaceFolders()![0], firstAddedFolder); // verify object is still live
|
||||
assert.equal(ws.getWorkspaceFolders()![1], secondAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![0], firstAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![1], secondAddedFolder); // verify object is still live
|
||||
|
||||
//
|
||||
// Rename folder
|
||||
//
|
||||
|
||||
assert.equal(true, ws.updateWorkspaceFolders(extensionDescriptor, 0, 2, asUpdateWorkspaceFolderData(URI.parse('foo:bar'), 'renamed 1'), asUpdateWorkspaceFolderData(URI.parse('foo:bar1'), 'renamed 2')));
|
||||
assert.equal(2, ws.workspace!.folders.length);
|
||||
assert.equal(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar').toString());
|
||||
assert.equal(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar1').toString());
|
||||
assert.equal(ws.workspace!.folders[0].name, 'renamed 1');
|
||||
assert.equal(ws.workspace!.folders[1].name, 'renamed 2');
|
||||
assert.equal(ws.getWorkspaceFolders()![0].name, 'renamed 1');
|
||||
assert.equal(ws.getWorkspaceFolders()![1].name, 'renamed 2');
|
||||
assert.strictEqual(true, ws.updateWorkspaceFolders(extensionDescriptor, 0, 2, asUpdateWorkspaceFolderData(URI.parse('foo:bar'), 'renamed 1'), asUpdateWorkspaceFolderData(URI.parse('foo:bar1'), 'renamed 2')));
|
||||
assert.strictEqual(2, ws.workspace!.folders.length);
|
||||
assert.strictEqual(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar').toString());
|
||||
assert.strictEqual(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar1').toString());
|
||||
assert.strictEqual(ws.workspace!.folders[0].name, 'renamed 1');
|
||||
assert.strictEqual(ws.workspace!.folders[1].name, 'renamed 2');
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![0].name, 'renamed 1');
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![1].name, 'renamed 2');
|
||||
|
||||
gotEvent = false;
|
||||
sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.deepEqual(e.added, []);
|
||||
assert.equal(e.removed.length, []);
|
||||
assert.deepStrictEqual(e.added, []);
|
||||
assert.strictEqual(e.removed.length, 0);
|
||||
gotEvent = true;
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
}
|
||||
});
|
||||
ws.$acceptWorkspaceData({ id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar'), 0, 'renamed 1'), aWorkspaceFolderData(URI.parse('foo:bar1'), 1, 'renamed 2')] }); // simulate acknowledgement from main side
|
||||
assert.equal(gotEvent, true);
|
||||
assert.strictEqual(gotEvent, true);
|
||||
sub.dispose();
|
||||
assert.equal(ws.getWorkspaceFolders()![0], firstAddedFolder); // verify object is still live
|
||||
assert.equal(ws.getWorkspaceFolders()![1], secondAddedFolder); // verify object is still live
|
||||
assert.equal(ws.workspace!.folders[0].name, 'renamed 1');
|
||||
assert.equal(ws.workspace!.folders[1].name, 'renamed 2');
|
||||
assert.equal(ws.getWorkspaceFolders()![0].name, 'renamed 1');
|
||||
assert.equal(ws.getWorkspaceFolders()![1].name, 'renamed 2');
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![0], firstAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![1], secondAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.workspace!.folders[0].name, 'renamed 1');
|
||||
assert.strictEqual(ws.workspace!.folders[1].name, 'renamed 2');
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![0].name, 'renamed 1');
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![1].name, 'renamed 2');
|
||||
|
||||
//
|
||||
// Add and remove folders
|
||||
//
|
||||
|
||||
assert.equal(true, ws.updateWorkspaceFolders(extensionDescriptor, 0, 2, asUpdateWorkspaceFolderData(URI.parse('foo:bar3')), asUpdateWorkspaceFolderData(URI.parse('foo:bar4'))));
|
||||
assert.equal(2, ws.workspace!.folders.length);
|
||||
assert.equal(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar3').toString());
|
||||
assert.equal(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar4').toString());
|
||||
assert.strictEqual(true, ws.updateWorkspaceFolders(extensionDescriptor, 0, 2, asUpdateWorkspaceFolderData(URI.parse('foo:bar3')), asUpdateWorkspaceFolderData(URI.parse('foo:bar4'))));
|
||||
assert.strictEqual(2, ws.workspace!.folders.length);
|
||||
assert.strictEqual(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar3').toString());
|
||||
assert.strictEqual(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar4').toString());
|
||||
|
||||
const fourthAddedFolder = ws.getWorkspaceFolders()![0];
|
||||
const fifthAddedFolder = ws.getWorkspaceFolders()![1];
|
||||
@@ -443,71 +443,71 @@ suite('ExtHostWorkspace', function () {
|
||||
gotEvent = false;
|
||||
sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.equal(e.added.length, 2);
|
||||
assert.equal(e.added[0], fourthAddedFolder);
|
||||
assert.equal(e.added[1], fifthAddedFolder);
|
||||
assert.equal(e.removed.length, 2);
|
||||
assert.equal(e.removed[0], firstAddedFolder);
|
||||
assert.equal(e.removed[1], secondAddedFolder);
|
||||
assert.strictEqual(e.added.length, 2);
|
||||
assert.strictEqual(e.added[0], fourthAddedFolder);
|
||||
assert.strictEqual(e.added[1], fifthAddedFolder);
|
||||
assert.strictEqual(e.removed.length, 2);
|
||||
assert.strictEqual(e.removed[0], firstAddedFolder);
|
||||
assert.strictEqual(e.removed[1], secondAddedFolder);
|
||||
gotEvent = true;
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
}
|
||||
});
|
||||
ws.$acceptWorkspaceData({ id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar3'), 0), aWorkspaceFolderData(URI.parse('foo:bar4'), 1)] }); // simulate acknowledgement from main side
|
||||
assert.equal(gotEvent, true);
|
||||
assert.strictEqual(gotEvent, true);
|
||||
sub.dispose();
|
||||
assert.equal(ws.getWorkspaceFolders()![0], fourthAddedFolder); // verify object is still live
|
||||
assert.equal(ws.getWorkspaceFolders()![1], fifthAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![0], fourthAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![1], fifthAddedFolder); // verify object is still live
|
||||
|
||||
//
|
||||
// Swap folders
|
||||
//
|
||||
|
||||
assert.equal(true, ws.updateWorkspaceFolders(extensionDescriptor, 0, 2, asUpdateWorkspaceFolderData(URI.parse('foo:bar4')), asUpdateWorkspaceFolderData(URI.parse('foo:bar3'))));
|
||||
assert.equal(2, ws.workspace!.folders.length);
|
||||
assert.equal(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar4').toString());
|
||||
assert.equal(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar3').toString());
|
||||
assert.strictEqual(true, ws.updateWorkspaceFolders(extensionDescriptor, 0, 2, asUpdateWorkspaceFolderData(URI.parse('foo:bar4')), asUpdateWorkspaceFolderData(URI.parse('foo:bar3'))));
|
||||
assert.strictEqual(2, ws.workspace!.folders.length);
|
||||
assert.strictEqual(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar4').toString());
|
||||
assert.strictEqual(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar3').toString());
|
||||
|
||||
assert.equal(ws.getWorkspaceFolders()![0], fifthAddedFolder); // verify object is still live
|
||||
assert.equal(ws.getWorkspaceFolders()![1], fourthAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![0], fifthAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![1], fourthAddedFolder); // verify object is still live
|
||||
|
||||
gotEvent = false;
|
||||
sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.equal(e.added.length, 0);
|
||||
assert.equal(e.removed.length, 0);
|
||||
assert.strictEqual(e.added.length, 0);
|
||||
assert.strictEqual(e.removed.length, 0);
|
||||
gotEvent = true;
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
}
|
||||
});
|
||||
ws.$acceptWorkspaceData({ id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar4'), 0), aWorkspaceFolderData(URI.parse('foo:bar3'), 1)] }); // simulate acknowledgement from main side
|
||||
assert.equal(gotEvent, true);
|
||||
assert.strictEqual(gotEvent, true);
|
||||
sub.dispose();
|
||||
assert.equal(ws.getWorkspaceFolders()![0], fifthAddedFolder); // verify object is still live
|
||||
assert.equal(ws.getWorkspaceFolders()![1], fourthAddedFolder); // verify object is still live
|
||||
assert.equal(fifthAddedFolder.index, 0);
|
||||
assert.equal(fourthAddedFolder.index, 1);
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![0], fifthAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![1], fourthAddedFolder); // verify object is still live
|
||||
assert.strictEqual(fifthAddedFolder.index, 0);
|
||||
assert.strictEqual(fourthAddedFolder.index, 1);
|
||||
|
||||
//
|
||||
// Add one folder after the other without waiting for confirmation (not supported currently)
|
||||
//
|
||||
|
||||
assert.equal(true, ws.updateWorkspaceFolders(extensionDescriptor, 2, 0, asUpdateWorkspaceFolderData(URI.parse('foo:bar5'))));
|
||||
assert.strictEqual(true, ws.updateWorkspaceFolders(extensionDescriptor, 2, 0, asUpdateWorkspaceFolderData(URI.parse('foo:bar5'))));
|
||||
|
||||
assert.equal(3, ws.workspace!.folders.length);
|
||||
assert.equal(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar4').toString());
|
||||
assert.equal(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar3').toString());
|
||||
assert.equal(ws.workspace!.folders[2].uri.toString(), URI.parse('foo:bar5').toString());
|
||||
assert.strictEqual(3, ws.workspace!.folders.length);
|
||||
assert.strictEqual(ws.workspace!.folders[0].uri.toString(), URI.parse('foo:bar4').toString());
|
||||
assert.strictEqual(ws.workspace!.folders[1].uri.toString(), URI.parse('foo:bar3').toString());
|
||||
assert.strictEqual(ws.workspace!.folders[2].uri.toString(), URI.parse('foo:bar5').toString());
|
||||
|
||||
const sixthAddedFolder = ws.getWorkspaceFolders()![2];
|
||||
|
||||
gotEvent = false;
|
||||
sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.equal(e.added.length, 1);
|
||||
assert.equal(e.added[0], sixthAddedFolder);
|
||||
assert.strictEqual(e.added.length, 1);
|
||||
assert.strictEqual(e.added[0], sixthAddedFolder);
|
||||
gotEvent = true;
|
||||
} catch (error) {
|
||||
finish(error);
|
||||
@@ -520,12 +520,12 @@ suite('ExtHostWorkspace', function () {
|
||||
aWorkspaceFolderData(URI.parse('foo:bar5'), 2)
|
||||
]
|
||||
}); // simulate acknowledgement from main side
|
||||
assert.equal(gotEvent, true);
|
||||
assert.strictEqual(gotEvent, true);
|
||||
sub.dispose();
|
||||
|
||||
assert.equal(ws.getWorkspaceFolders()![0], fifthAddedFolder); // verify object is still live
|
||||
assert.equal(ws.getWorkspaceFolders()![1], fourthAddedFolder); // verify object is still live
|
||||
assert.equal(ws.getWorkspaceFolders()![2], sixthAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![0], fifthAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![1], fourthAddedFolder); // verify object is still live
|
||||
assert.strictEqual(ws.getWorkspaceFolders()![2], sixthAddedFolder); // verify object is still live
|
||||
|
||||
finish();
|
||||
});
|
||||
@@ -591,10 +591,10 @@ suite('ExtHostWorkspace', function () {
|
||||
rpcProtocol.set(MainContext.MainThreadWorkspace, new class extends mock<MainThreadWorkspace>() {
|
||||
$startFileSearch(includePattern: string, _includeFolder: UriComponents | null, excludePatternOrDisregardExcludes: string | false, maxResults: number, token: CancellationToken): Promise<URI[] | null> {
|
||||
mainThreadCalled = true;
|
||||
assert.equal(includePattern, 'foo');
|
||||
assert.equal(_includeFolder, null);
|
||||
assert.equal(excludePatternOrDisregardExcludes, null);
|
||||
assert.equal(maxResults, 10);
|
||||
assert.strictEqual(includePattern, 'foo');
|
||||
assert.strictEqual(_includeFolder, null);
|
||||
assert.strictEqual(excludePatternOrDisregardExcludes, null);
|
||||
assert.strictEqual(maxResults, 10);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
});
|
||||
@@ -613,9 +613,9 @@ suite('ExtHostWorkspace', function () {
|
||||
rpcProtocol.set(MainContext.MainThreadWorkspace, new class extends mock<MainThreadWorkspace>() {
|
||||
$startFileSearch(includePattern: string, _includeFolder: UriComponents | null, excludePatternOrDisregardExcludes: string | false, maxResults: number, token: CancellationToken): Promise<URI[] | null> {
|
||||
mainThreadCalled = true;
|
||||
assert.equal(includePattern, 'glob/**');
|
||||
assert.deepEqual(_includeFolder ? URI.from(_includeFolder).toJSON() : null, URI.file('/other/folder').toJSON());
|
||||
assert.equal(excludePatternOrDisregardExcludes, null);
|
||||
assert.strictEqual(includePattern, 'glob/**');
|
||||
assert.deepStrictEqual(_includeFolder ? URI.from(_includeFolder).toJSON() : null, URI.file('/other/folder').toJSON());
|
||||
assert.strictEqual(excludePatternOrDisregardExcludes, null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
});
|
||||
@@ -642,9 +642,9 @@ suite('ExtHostWorkspace', function () {
|
||||
rpcProtocol.set(MainContext.MainThreadWorkspace, new class extends mock<MainThreadWorkspace>() {
|
||||
$startFileSearch(includePattern: string, _includeFolder: UriComponents | null, excludePatternOrDisregardExcludes: string | false, maxResults: number, token: CancellationToken): Promise<URI[] | null> {
|
||||
mainThreadCalled = true;
|
||||
assert.equal(includePattern, 'glob/**');
|
||||
assert.deepEqual(_includeFolder, URI.file('/other/folder').toJSON());
|
||||
assert.equal(excludePatternOrDisregardExcludes, false);
|
||||
assert.strictEqual(includePattern, 'glob/**');
|
||||
assert.deepStrictEqual(_includeFolder, URI.file('/other/folder').toJSON());
|
||||
assert.strictEqual(excludePatternOrDisregardExcludes, false);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
});
|
||||
@@ -702,10 +702,10 @@ suite('ExtHostWorkspace', function () {
|
||||
rpcProtocol.set(MainContext.MainThreadWorkspace, new class extends mock<MainThreadWorkspace>() {
|
||||
async $startTextSearch(query: IPatternInfo, folder: UriComponents | null, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise<ITextSearchComplete | null> {
|
||||
mainThreadCalled = true;
|
||||
assert.equal(query.pattern, 'foo');
|
||||
assert.equal(folder, null);
|
||||
assert.equal(options.includePattern, null);
|
||||
assert.equal(options.excludePattern, null);
|
||||
assert.strictEqual(query.pattern, 'foo');
|
||||
assert.strictEqual(folder, null);
|
||||
assert.strictEqual(options.includePattern, undefined);
|
||||
assert.strictEqual(options.excludePattern, undefined);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@@ -723,10 +723,10 @@ suite('ExtHostWorkspace', function () {
|
||||
rpcProtocol.set(MainContext.MainThreadWorkspace, new class extends mock<MainThreadWorkspace>() {
|
||||
async $startTextSearch(query: IPatternInfo, folder: UriComponents | null, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise<ITextSearchComplete | null> {
|
||||
mainThreadCalled = true;
|
||||
assert.equal(query.pattern, 'foo');
|
||||
assert.equal(folder, null);
|
||||
assert.equal(options.includePattern, '**/files');
|
||||
assert.equal(options.excludePattern, null);
|
||||
assert.strictEqual(query.pattern, 'foo');
|
||||
assert.strictEqual(folder, null);
|
||||
assert.strictEqual(options.includePattern, '**/files');
|
||||
assert.strictEqual(options.excludePattern, undefined);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@@ -744,10 +744,10 @@ suite('ExtHostWorkspace', function () {
|
||||
rpcProtocol.set(MainContext.MainThreadWorkspace, new class extends mock<MainThreadWorkspace>() {
|
||||
async $startTextSearch(query: IPatternInfo, folder: UriComponents | null, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise<ITextSearchComplete | null> {
|
||||
mainThreadCalled = true;
|
||||
assert.equal(query.pattern, 'foo');
|
||||
assert.deepEqual(folder, URI.file('/other/folder').toJSON());
|
||||
assert.equal(options.includePattern, 'glob/**');
|
||||
assert.equal(options.excludePattern, null);
|
||||
assert.strictEqual(query.pattern, 'foo');
|
||||
assert.deepStrictEqual(folder, URI.file('/other/folder').toJSON());
|
||||
assert.strictEqual(options.includePattern, 'glob/**');
|
||||
assert.strictEqual(options.excludePattern, undefined);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@@ -783,10 +783,10 @@ suite('ExtHostWorkspace', function () {
|
||||
rpcProtocol.set(MainContext.MainThreadWorkspace, new class extends mock<MainThreadWorkspace>() {
|
||||
async $startTextSearch(query: IPatternInfo, folder: UriComponents | null, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise<ITextSearchComplete | null> {
|
||||
mainThreadCalled = true;
|
||||
assert.equal(query.pattern, 'foo');
|
||||
assert.deepEqual(folder, null);
|
||||
assert.equal(options.includePattern, null);
|
||||
assert.equal(options.excludePattern, 'glob/**'); // exclude folder is ignored...
|
||||
assert.strictEqual(query.pattern, 'foo');
|
||||
assert.deepStrictEqual(folder, null);
|
||||
assert.strictEqual(options.includePattern, undefined);
|
||||
assert.strictEqual(options.excludePattern, 'glob/**'); // exclude folder is ignored...
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@ suite('MainThreadCommands', function () {
|
||||
test('dispose on unregister', function () {
|
||||
|
||||
const commands = new MainThreadCommands(SingleProxyRPCProtocol(null), undefined!, new class extends mock<IExtensionService>() { });
|
||||
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
|
||||
assert.strictEqual(CommandsRegistry.getCommand('foo'), undefined);
|
||||
|
||||
// register
|
||||
commands.$registerCommand('foo');
|
||||
@@ -23,13 +23,13 @@ suite('MainThreadCommands', function () {
|
||||
|
||||
// unregister
|
||||
commands.$unregisterCommand('foo');
|
||||
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
|
||||
assert.strictEqual(CommandsRegistry.getCommand('foo'), undefined);
|
||||
});
|
||||
|
||||
test('unregister all on dispose', function () {
|
||||
|
||||
const commands = new MainThreadCommands(SingleProxyRPCProtocol(null), undefined!, new class extends mock<IExtensionService>() { });
|
||||
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
|
||||
assert.strictEqual(CommandsRegistry.getCommand('foo'), undefined);
|
||||
|
||||
commands.$registerCommand('foo');
|
||||
commands.$registerCommand('bar');
|
||||
@@ -39,8 +39,8 @@ suite('MainThreadCommands', function () {
|
||||
|
||||
commands.dispose();
|
||||
|
||||
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
|
||||
assert.equal(CommandsRegistry.getCommand('bar'), undefined);
|
||||
assert.strictEqual(CommandsRegistry.getCommand('foo'), undefined);
|
||||
assert.strictEqual(CommandsRegistry.getCommand('bar'), undefined);
|
||||
});
|
||||
|
||||
test('activate and throw when needed', async function () {
|
||||
@@ -70,18 +70,18 @@ suite('MainThreadCommands', function () {
|
||||
await commands.$executeCommand('bazz', [1, 2, { n: 3 }], true);
|
||||
assert.ok(false);
|
||||
} catch (e) {
|
||||
assert.deepEqual(activations, ['onCommand:bazz']);
|
||||
assert.equal((<Error>e).message, '$executeCommand:retry');
|
||||
assert.deepStrictEqual(activations, ['onCommand:bazz']);
|
||||
assert.strictEqual((<Error>e).message, '$executeCommand:retry');
|
||||
}
|
||||
|
||||
// case 2: no arguments and retry
|
||||
runs.length = 0;
|
||||
await commands.$executeCommand('bazz', [], true);
|
||||
assert.deepEqual(runs, ['bazz']);
|
||||
assert.deepStrictEqual(runs, ['bazz']);
|
||||
|
||||
// case 3: arguments and no retry
|
||||
runs.length = 0;
|
||||
await commands.$executeCommand('bazz', [1, 2, true], false);
|
||||
assert.deepEqual(runs, ['bazz']);
|
||||
assert.deepStrictEqual(runs, ['bazz']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('update resource configuration without configuration target defaults to workspace in folder workspace when resource is provider', function () {
|
||||
@@ -74,7 +74,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('update resource configuration without configuration target defaults to workspace in folder workspace when no resource is provider', function () {
|
||||
@@ -83,7 +83,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('update window configuration without configuration target defaults to workspace in multi root workspace when no resource is provided', function () {
|
||||
@@ -92,7 +92,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('update window configuration without configuration target defaults to workspace in multi root workspace when resource is provided', function () {
|
||||
@@ -101,7 +101,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('update window configuration without configuration target defaults to workspace in folder workspace when resource is provider', function () {
|
||||
@@ -110,7 +110,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('update window configuration without configuration target defaults to workspace in folder workspace when no resource is provider', function () {
|
||||
@@ -119,7 +119,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.window', 'value', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('update resource configuration without configuration target defaults to folder', function () {
|
||||
@@ -128,7 +128,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(null, 'extHostConfiguration.resource', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('update configuration with user configuration target', function () {
|
||||
@@ -137,7 +137,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(ConfigurationTarget.USER, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.USER, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.USER, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('update configuration with workspace configuration target', function () {
|
||||
@@ -146,7 +146,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(ConfigurationTarget.WORKSPACE, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('update configuration with folder configuration target', function () {
|
||||
@@ -155,7 +155,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$updateConfigurationOption(ConfigurationTarget.WORKSPACE_FOLDER, 'extHostConfiguration.window', 'value', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('remove resource configuration without configuration target defaults to workspace in multi root workspace when no resource is provided', function () {
|
||||
@@ -164,7 +164,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('remove resource configuration without configuration target defaults to workspace in folder workspace when resource is provider', function () {
|
||||
@@ -173,7 +173,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('remove resource configuration without configuration target defaults to workspace in folder workspace when no resource is provider', function () {
|
||||
@@ -182,7 +182,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('remove window configuration without configuration target defaults to workspace in multi root workspace when no resource is provided', function () {
|
||||
@@ -191,7 +191,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('remove window configuration without configuration target defaults to workspace in multi root workspace when resource is provided', function () {
|
||||
@@ -200,7 +200,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('remove window configuration without configuration target defaults to workspace in folder workspace when resource is provider', function () {
|
||||
@@ -209,7 +209,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('remove window configuration without configuration target defaults to workspace in folder workspace when no resource is provider', function () {
|
||||
@@ -218,7 +218,7 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.window', undefined, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE, target.args[0][3]);
|
||||
});
|
||||
|
||||
test('remove configuration without configuration target defaults to folder', function () {
|
||||
@@ -227,6 +227,6 @@ suite('MainThreadConfiguration', function () {
|
||||
|
||||
testObject.$removeConfigurationOption(null, 'extHostConfiguration.resource', { resource: URI.file('abc') }, undefined);
|
||||
|
||||
assert.equal(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]);
|
||||
assert.strictEqual(ConfigurationTarget.WORKSPACE_FOLDER, target.args[0][3]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,6 +10,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { mock } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
|
||||
import { ExtensionHostKind } from 'vs/workbench/services/extensions/common/extensions';
|
||||
|
||||
|
||||
suite('MainThreadDiagnostics', function () {
|
||||
@@ -25,6 +26,7 @@ suite('MainThreadDiagnostics', function () {
|
||||
let diag = new MainThreadDiagnostics(
|
||||
new class implements IExtHostContext {
|
||||
remoteAuthority = '';
|
||||
extensionHostKind = ExtensionHostKind.LocalProcess;
|
||||
assertRegistered() { }
|
||||
set(v: any): any { return null; }
|
||||
getProxy(): any {
|
||||
@@ -51,8 +53,8 @@ suite('MainThreadDiagnostics', function () {
|
||||
source: 'me'
|
||||
}]]]);
|
||||
|
||||
assert.equal(markerService.read().length, 1);
|
||||
assert.strictEqual(markerService.read().length, 1);
|
||||
diag.dispose();
|
||||
assert.equal(markerService.read().length, 0);
|
||||
assert.strictEqual(markerService.read().length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -23,13 +23,13 @@ suite('MainThreadDocumentContentProviders', function () {
|
||||
let providers = new MainThreadDocumentContentProviders(new TestRPCProtocol(), null!, null!,
|
||||
new class extends mock<IModelService>() {
|
||||
getModel(_uri: URI) {
|
||||
assert.equal(uri.toString(), _uri.toString());
|
||||
assert.strictEqual(uri.toString(), _uri.toString());
|
||||
return model;
|
||||
}
|
||||
},
|
||||
new class extends mock<IEditorWorkerService>() {
|
||||
computeMoreMinimalEdits(_uri: URI, data: TextEdit[] | undefined) {
|
||||
assert.equal(model.getValue(), '1');
|
||||
assert.strictEqual(model.getValue(), '1');
|
||||
return Promise.resolve(data);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -32,7 +32,7 @@ suite('BoundModelReferenceCollection', () => {
|
||||
});
|
||||
|
||||
await timeout(30);
|
||||
assert.equal(didDispose, true);
|
||||
assert.strictEqual(didDispose, true);
|
||||
});
|
||||
|
||||
test('max size', () => {
|
||||
@@ -66,7 +66,7 @@ suite('BoundModelReferenceCollection', () => {
|
||||
}
|
||||
});
|
||||
|
||||
assert.deepEqual(disposed, [0, 1]);
|
||||
assert.deepStrictEqual(disposed, [0, 1]);
|
||||
});
|
||||
|
||||
test('dispose uri', () => {
|
||||
@@ -119,15 +119,15 @@ suite('BoundModelReferenceCollection', () => {
|
||||
});
|
||||
|
||||
col.remove(URI.parse('test:///unknown'));
|
||||
assert.equal(disposed.length, 0);
|
||||
assert.strictEqual(disposed.length, 0);
|
||||
|
||||
col.remove(URI.parse('test:///farboo'));
|
||||
assert.deepEqual(disposed, [0]);
|
||||
assert.deepStrictEqual(disposed, [0]);
|
||||
|
||||
disposed = [];
|
||||
|
||||
col.remove(URI.parse('test:///boo'));
|
||||
assert.deepEqual(disposed, [2, 3]);
|
||||
assert.deepStrictEqual(disposed, [2, 3]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -110,14 +110,14 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
|
||||
modelService.createModel('farboo', null);
|
||||
|
||||
assert.equal(deltas.length, 1);
|
||||
assert.strictEqual(deltas.length, 1);
|
||||
const [delta] = deltas;
|
||||
|
||||
assert.equal(delta.addedDocuments!.length, 1);
|
||||
assert.equal(delta.removedDocuments, undefined);
|
||||
assert.equal(delta.addedEditors, undefined);
|
||||
assert.equal(delta.removedEditors, undefined);
|
||||
assert.equal(delta.newActiveEditor, null);
|
||||
assert.strictEqual(delta.addedDocuments!.length, 1);
|
||||
assert.strictEqual(delta.removedDocuments, undefined);
|
||||
assert.strictEqual(delta.addedEditors, undefined);
|
||||
assert.strictEqual(delta.removedEditors, undefined);
|
||||
assert.strictEqual(delta.newActiveEditor, undefined);
|
||||
});
|
||||
|
||||
test('ignore huge model', function () {
|
||||
@@ -126,13 +126,13 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
const model = modelService.createModel(hugeModelString, null);
|
||||
assert.ok(model.isTooLargeForSyncing());
|
||||
|
||||
assert.equal(deltas.length, 1);
|
||||
assert.strictEqual(deltas.length, 1);
|
||||
const [delta] = deltas;
|
||||
assert.equal(delta.newActiveEditor, null);
|
||||
assert.equal(delta.addedDocuments, undefined);
|
||||
assert.equal(delta.removedDocuments, undefined);
|
||||
assert.equal(delta.addedEditors, undefined);
|
||||
assert.equal(delta.removedEditors, undefined);
|
||||
assert.strictEqual(delta.newActiveEditor, null);
|
||||
assert.strictEqual(delta.addedDocuments, undefined);
|
||||
assert.strictEqual(delta.removedDocuments, undefined);
|
||||
assert.strictEqual(delta.addedEditors, undefined);
|
||||
assert.strictEqual(delta.removedEditors, undefined);
|
||||
});
|
||||
|
||||
test('ignore simple widget model', function () {
|
||||
@@ -141,13 +141,13 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
const model = modelService.createModel('test', null, undefined, true);
|
||||
assert.ok(model.isForSimpleWidget);
|
||||
|
||||
assert.equal(deltas.length, 1);
|
||||
assert.strictEqual(deltas.length, 1);
|
||||
const [delta] = deltas;
|
||||
assert.equal(delta.newActiveEditor, null);
|
||||
assert.equal(delta.addedDocuments, undefined);
|
||||
assert.equal(delta.removedDocuments, undefined);
|
||||
assert.equal(delta.addedEditors, undefined);
|
||||
assert.equal(delta.removedEditors, undefined);
|
||||
assert.strictEqual(delta.newActiveEditor, null);
|
||||
assert.strictEqual(delta.addedDocuments, undefined);
|
||||
assert.strictEqual(delta.removedDocuments, undefined);
|
||||
assert.strictEqual(delta.addedEditors, undefined);
|
||||
assert.strictEqual(delta.removedEditors, undefined);
|
||||
});
|
||||
|
||||
test('ignore huge model from editor', function () {
|
||||
@@ -156,22 +156,22 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
const model = modelService.createModel(hugeModelString, null);
|
||||
const editor = myCreateTestCodeEditor(model);
|
||||
|
||||
assert.equal(deltas.length, 1);
|
||||
assert.strictEqual(deltas.length, 1);
|
||||
deltas.length = 0;
|
||||
assert.equal(deltas.length, 0);
|
||||
assert.strictEqual(deltas.length, 0);
|
||||
|
||||
editor.dispose();
|
||||
});
|
||||
|
||||
test('ignore editor w/o model', () => {
|
||||
const editor = myCreateTestCodeEditor(undefined);
|
||||
assert.equal(deltas.length, 1);
|
||||
assert.strictEqual(deltas.length, 1);
|
||||
const [delta] = deltas;
|
||||
assert.equal(delta.newActiveEditor, null);
|
||||
assert.equal(delta.addedDocuments, undefined);
|
||||
assert.equal(delta.removedDocuments, undefined);
|
||||
assert.equal(delta.addedEditors, undefined);
|
||||
assert.equal(delta.removedEditors, undefined);
|
||||
assert.strictEqual(delta.newActiveEditor, null);
|
||||
assert.strictEqual(delta.addedDocuments, undefined);
|
||||
assert.strictEqual(delta.removedDocuments, undefined);
|
||||
assert.strictEqual(delta.addedEditors, undefined);
|
||||
assert.strictEqual(delta.removedEditors, undefined);
|
||||
|
||||
editor.dispose();
|
||||
});
|
||||
@@ -182,19 +182,19 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
const model = modelService.createModel('farboo', null);
|
||||
const editor = myCreateTestCodeEditor(model);
|
||||
|
||||
assert.equal(deltas.length, 2);
|
||||
assert.strictEqual(deltas.length, 2);
|
||||
const [first, second] = deltas;
|
||||
assert.equal(first.addedDocuments!.length, 1);
|
||||
assert.equal(first.newActiveEditor, null);
|
||||
assert.equal(first.removedDocuments, undefined);
|
||||
assert.equal(first.addedEditors, undefined);
|
||||
assert.equal(first.removedEditors, undefined);
|
||||
assert.strictEqual(first.addedDocuments!.length, 1);
|
||||
assert.strictEqual(first.newActiveEditor, undefined);
|
||||
assert.strictEqual(first.removedDocuments, undefined);
|
||||
assert.strictEqual(first.addedEditors, undefined);
|
||||
assert.strictEqual(first.removedEditors, undefined);
|
||||
|
||||
assert.equal(second.addedEditors!.length, 1);
|
||||
assert.equal(second.addedDocuments, undefined);
|
||||
assert.equal(second.removedDocuments, undefined);
|
||||
assert.equal(second.removedEditors, undefined);
|
||||
assert.equal(second.newActiveEditor, undefined);
|
||||
assert.strictEqual(second.addedEditors!.length, 1);
|
||||
assert.strictEqual(second.addedDocuments, undefined);
|
||||
assert.strictEqual(second.removedDocuments, undefined);
|
||||
assert.strictEqual(second.removedEditors, undefined);
|
||||
assert.strictEqual(second.newActiveEditor, undefined);
|
||||
|
||||
editor.dispose();
|
||||
});
|
||||
@@ -208,14 +208,14 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
deltas.length = 0;
|
||||
|
||||
modelService.destroyModel(model.uri);
|
||||
assert.equal(deltas.length, 1);
|
||||
assert.strictEqual(deltas.length, 1);
|
||||
const [first] = deltas;
|
||||
|
||||
assert.equal(first.newActiveEditor, null);
|
||||
assert.equal(first.removedEditors!.length, 1);
|
||||
assert.equal(first.removedDocuments!.length, 1);
|
||||
assert.equal(first.addedDocuments, undefined);
|
||||
assert.equal(first.addedEditors, undefined);
|
||||
assert.strictEqual(first.newActiveEditor, undefined);
|
||||
assert.strictEqual(first.removedEditors!.length, 1);
|
||||
assert.strictEqual(first.removedDocuments!.length, 1);
|
||||
assert.strictEqual(first.addedDocuments, undefined);
|
||||
assert.strictEqual(first.addedEditors, undefined);
|
||||
|
||||
editor.dispose();
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ import { Range } from 'vs/editor/common/core/range';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import { TestFileService, TestEditorService, TestEditorGroupsService, TestEnvironmentService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestFileService, TestEditorService, TestEditorGroupsService, TestEnvironmentService, TestLifecycleService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { BulkEditService } from 'vs/workbench/contrib/bulkEdit/browser/bulkEditService';
|
||||
import { NullLogService, ILogService } from 'vs/platform/log/common/log';
|
||||
import { ITextModelService, IResolvedTextEditorModel } from 'vs/editor/common/services/resolverService';
|
||||
@@ -40,7 +40,7 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IWorkingCopyFileService } from 'vs/workbench/services/workingCopy/common/workingCopyFileService';
|
||||
import { IWorkingCopyFileService, IMoveOperation, IDeleteOperation, ICopyOperation, ICreateFileOperation, ICreateOperation } from 'vs/workbench/services/workingCopy/common/workingCopyFileService';
|
||||
import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService';
|
||||
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
@@ -50,6 +50,9 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
|
||||
import { TestTextResourcePropertiesService, TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
|
||||
import { extUri } from 'vs/base/common/resources';
|
||||
import { ITextSnapshot } from 'vs/editor/common/model';
|
||||
import { VSBuffer, VSBufferReadable } from 'vs/base/common/buffer';
|
||||
import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
|
||||
suite('MainThreadEditors', () => {
|
||||
|
||||
@@ -92,6 +95,7 @@ suite('MainThreadEditors', () => {
|
||||
services.set(ICodeEditorService, new TestCodeEditorService());
|
||||
services.set(IFileService, new TestFileService());
|
||||
services.set(IEditorService, new TestEditorService());
|
||||
services.set(ILifecycleService, new TestLifecycleService());
|
||||
services.set(IEditorGroupsService, new TestEditorGroupsService());
|
||||
services.set(ITextFileService, new class extends mock<ITextFileService>() {
|
||||
isDirty() { return false; }
|
||||
@@ -100,26 +104,40 @@ suite('MainThreadEditors', () => {
|
||||
onDidRevert: Event.None,
|
||||
onDidChangeDirty: Event.None
|
||||
};
|
||||
create(operations: { resource: URI }[]) {
|
||||
for (const o of operations) {
|
||||
createdResources.add(o.resource);
|
||||
}
|
||||
return Promise.resolve(Object.create(null));
|
||||
}
|
||||
async getEncodedReadable(resource: URI, value?: string | ITextSnapshot): Promise<VSBuffer | VSBufferReadable | undefined> {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
services.set(IWorkingCopyFileService, new class extends mock<IWorkingCopyFileService>() {
|
||||
onDidRunWorkingCopyFileOperation = Event.None;
|
||||
create(resource: URI) {
|
||||
createdResources.add(resource);
|
||||
createFolder(operations: ICreateOperation[]): any {
|
||||
this.create(operations);
|
||||
}
|
||||
create(operations: ICreateFileOperation[]) {
|
||||
for (const operation of operations) {
|
||||
createdResources.add(operation.resource);
|
||||
}
|
||||
return Promise.resolve(Object.create(null));
|
||||
}
|
||||
move(files: { source: URI, target: URI }[]) {
|
||||
const { source, target } = files[0];
|
||||
move(operations: IMoveOperation[]) {
|
||||
const { source, target } = operations[0].file;
|
||||
movedResources.set(source, target);
|
||||
return Promise.resolve(Object.create(null));
|
||||
}
|
||||
copy(files: { source: URI, target: URI }[]) {
|
||||
const { source, target } = files[0];
|
||||
copy(operations: ICopyOperation[]) {
|
||||
const { source, target } = operations[0].file;
|
||||
copiedResources.set(source, target);
|
||||
return Promise.resolve(Object.create(null));
|
||||
}
|
||||
delete(resources: URI[]) {
|
||||
for (const resource of resources) {
|
||||
deletedResources.add(resource);
|
||||
delete(operations: IDeleteOperation[]) {
|
||||
for (const operation of operations) {
|
||||
deletedResources.add(operation.resource);
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
@@ -183,7 +201,7 @@ suite('MainThreadEditors', () => {
|
||||
model.applyEdits([EditOperation.insert(new Position(0, 0), 'something')]);
|
||||
|
||||
return editors.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit] }).then((result) => {
|
||||
assert.equal(result, false);
|
||||
assert.strictEqual(result, false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -212,11 +230,11 @@ suite('MainThreadEditors', () => {
|
||||
|
||||
let p1 = editors.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit1] }).then((result) => {
|
||||
// first edit request succeeds
|
||||
assert.equal(result, true);
|
||||
assert.strictEqual(result, true);
|
||||
});
|
||||
let p2 = editors.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit2] }).then((result) => {
|
||||
// second edit request fails
|
||||
assert.equal(result, false);
|
||||
assert.strictEqual(result, false);
|
||||
});
|
||||
return Promise.all([p1, p2]);
|
||||
});
|
||||
@@ -229,10 +247,10 @@ suite('MainThreadEditors', () => {
|
||||
{ _type: WorkspaceEditType.File, oldUri: resource, newUri: undefined, options: undefined }
|
||||
]
|
||||
}).then((result) => {
|
||||
assert.equal(result, true);
|
||||
assert.equal(movedResources.get(resource), resource);
|
||||
assert.equal(createdResources.has(resource), true);
|
||||
assert.equal(deletedResources.has(resource), true);
|
||||
assert.strictEqual(result, true);
|
||||
assert.strictEqual(movedResources.get(resource), resource);
|
||||
assert.strictEqual(createdResources.has(resource), true);
|
||||
assert.strictEqual(deletedResources.has(resource), true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { ViewDescriptorService } from 'vs/workbench/services/views/browser/viewDescriptorService';
|
||||
import { CustomTreeView } from 'vs/workbench/browser/parts/views/treeView';
|
||||
import { ExtensionHostKind } from 'vs/workbench/services/extensions/common/extensions';
|
||||
|
||||
suite('MainThreadHostTreeView', function () {
|
||||
const testTreeViewId = 'testTreeView';
|
||||
@@ -47,7 +48,7 @@ suite('MainThreadHostTreeView', function () {
|
||||
const instantiationService: TestInstantiationService = <TestInstantiationService>workbenchInstantiationService();
|
||||
const viewDescriptorService = instantiationService.createInstance(ViewDescriptorService);
|
||||
instantiationService.stub(IViewDescriptorService, viewDescriptorService);
|
||||
container = Registry.as<IViewContainersRegistry>(Extensions.ViewContainersRegistry).registerViewContainer({ id: 'testContainer', name: 'test', ctorDescriptor: new SyncDescriptor(<any>{}) }, ViewContainerLocation.Sidebar);
|
||||
container = Registry.as<IViewContainersRegistry>(Extensions.ViewContainersRegistry).registerViewContainer({ id: 'testContainer', title: 'test', ctorDescriptor: new SyncDescriptor(<any>{}) }, ViewContainerLocation.Sidebar);
|
||||
const viewDescriptor: ITreeViewDescriptor = {
|
||||
id: testTreeViewId,
|
||||
ctorDescriptor: null!,
|
||||
@@ -61,6 +62,7 @@ suite('MainThreadHostTreeView', function () {
|
||||
mainThreadTreeViews = new MainThreadTreeViews(
|
||||
new class implements IExtHostContext {
|
||||
remoteAuthority = '';
|
||||
extensionHostKind = ExtensionHostKind.LocalProcess;
|
||||
assertRegistered() { }
|
||||
set(v: any): any { return null; }
|
||||
getProxy(): any {
|
||||
|
||||
@@ -8,6 +8,7 @@ import { CharCode } from 'vs/base/common/charCode';
|
||||
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { isThenable } from 'vs/base/common/async';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { ExtensionHostKind } from 'vs/workbench/services/extensions/common/extensions';
|
||||
|
||||
export function SingleProxyRPCProtocol(thing: any): IExtHostContext & IExtHostRpcService {
|
||||
return {
|
||||
@@ -20,7 +21,8 @@ export function SingleProxyRPCProtocol(thing: any): IExtHostContext & IExtHostRp
|
||||
return value;
|
||||
},
|
||||
assertRegistered: undefined!,
|
||||
drain: undefined!
|
||||
drain: undefined!,
|
||||
extensionHostKind: ExtensionHostKind.LocalProcess
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,6 +30,7 @@ export class TestRPCProtocol implements IExtHostContext, IExtHostRpcService {
|
||||
|
||||
public _serviceBrand: undefined;
|
||||
public remoteAuthority = null!;
|
||||
public extensionHostKind = ExtensionHostKind.LocalProcess;
|
||||
|
||||
private _callCountValue: number = 0;
|
||||
private _idle?: Promise<any>;
|
||||
|
||||
Reference in New Issue
Block a user