mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 09:38:38 +01:00
Merge branch 'main' into notebook/dev
This commit is contained in:
@@ -52,8 +52,8 @@ suite('vscode API - commands', () => {
|
||||
await commands.executeCommand('t1', 'start');
|
||||
registration.dispose();
|
||||
assert.ok(args!);
|
||||
assert.equal(args!.length, 1);
|
||||
assert.equal(args![0], 'start');
|
||||
assert.strictEqual(args!.length, 1);
|
||||
assert.strictEqual(args![0], 'start');
|
||||
});
|
||||
|
||||
test('editorCommand with extra args', function () {
|
||||
@@ -68,7 +68,7 @@ suite('vscode API - commands', () => {
|
||||
return commands.executeCommand('t1', 12345, commands);
|
||||
}).then(() => {
|
||||
assert.ok(args);
|
||||
assert.equal(args.length, 4);
|
||||
assert.strictEqual(args.length, 4);
|
||||
assert.ok(args[2] === 12345);
|
||||
assert.ok(args[3] === commands);
|
||||
registration.dispose();
|
||||
|
||||
@@ -15,7 +15,7 @@ suite('vscode API - configuration', () => {
|
||||
test('configurations, language defaults', function () {
|
||||
const defaultLanguageSettings = vscode.workspace.getConfiguration().get('[abcLang]');
|
||||
|
||||
assert.deepEqual(defaultLanguageSettings, {
|
||||
assert.deepStrictEqual(defaultLanguageSettings, {
|
||||
'editor.lineNumbers': 'off',
|
||||
'editor.tabSize': 2
|
||||
});
|
||||
@@ -25,25 +25,25 @@ suite('vscode API - configuration', () => {
|
||||
const config = vscode.workspace.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.throws(() => (<any>config)['config4'] = 'valuevalue');
|
||||
|
||||
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.');
|
||||
});
|
||||
|
||||
test('configuration, name vs property', () => {
|
||||
const config = vscode.workspace.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');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ suite('vscode API - debug', function () {
|
||||
teardown(assertNoRpc);
|
||||
|
||||
test('breakpoints', async function () {
|
||||
assert.equal(debug.breakpoints.length, 0);
|
||||
assert.strictEqual(debug.breakpoints.length, 0);
|
||||
let onDidChangeBreakpointsCounter = 0;
|
||||
const toDispose: Disposable[] = [];
|
||||
|
||||
@@ -22,19 +22,19 @@ suite('vscode API - debug', function () {
|
||||
}));
|
||||
|
||||
debug.addBreakpoints([{ id: '1', enabled: true }, { id: '2', enabled: false, condition: '2 < 5' }]);
|
||||
assert.equal(onDidChangeBreakpointsCounter, 1);
|
||||
assert.equal(debug.breakpoints.length, 2);
|
||||
assert.equal(debug.breakpoints[0].id, '1');
|
||||
assert.equal(debug.breakpoints[1].id, '2');
|
||||
assert.equal(debug.breakpoints[1].condition, '2 < 5');
|
||||
assert.strictEqual(onDidChangeBreakpointsCounter, 1);
|
||||
assert.strictEqual(debug.breakpoints.length, 2);
|
||||
assert.strictEqual(debug.breakpoints[0].id, '1');
|
||||
assert.strictEqual(debug.breakpoints[1].id, '2');
|
||||
assert.strictEqual(debug.breakpoints[1].condition, '2 < 5');
|
||||
|
||||
debug.removeBreakpoints([{ id: '1', enabled: true }]);
|
||||
assert.equal(onDidChangeBreakpointsCounter, 2);
|
||||
assert.equal(debug.breakpoints.length, 1);
|
||||
assert.strictEqual(onDidChangeBreakpointsCounter, 2);
|
||||
assert.strictEqual(debug.breakpoints.length, 1);
|
||||
|
||||
debug.removeBreakpoints([{ id: '2', enabled: false }]);
|
||||
assert.equal(onDidChangeBreakpointsCounter, 3);
|
||||
assert.equal(debug.breakpoints.length, 0);
|
||||
assert.strictEqual(onDidChangeBreakpointsCounter, 3);
|
||||
assert.strictEqual(debug.breakpoints.length, 0);
|
||||
|
||||
disposeAll(toDispose);
|
||||
});
|
||||
@@ -79,36 +79,36 @@ suite('vscode API - debug', function () {
|
||||
const initializedPromise = new Promise<void>(resolve => initializedReceived = resolve);
|
||||
const configurationDonePromise = new Promise<void>(resolve => configurationDoneReceived = resolve);
|
||||
const success = await debug.startDebugging(workspace.workspaceFolders![0], 'Launch debug.js');
|
||||
assert.equal(success, true);
|
||||
assert.strictEqual(success, true);
|
||||
await initializedPromise;
|
||||
await configurationDonePromise;
|
||||
|
||||
await firstVariablesRetrieved;
|
||||
assert.notEqual(debug.activeDebugSession, undefined);
|
||||
assert.equal(stoppedEvents, 1);
|
||||
assert.notStrictEqual(debug.activeDebugSession, undefined);
|
||||
assert.strictEqual(stoppedEvents, 1);
|
||||
|
||||
const secondVariablesRetrieved = new Promise<void>(resolve => variablesReceived = resolve);
|
||||
await commands.executeCommand('workbench.action.debug.stepOver');
|
||||
await secondVariablesRetrieved;
|
||||
assert.equal(stoppedEvents, 2);
|
||||
assert.strictEqual(stoppedEvents, 2);
|
||||
const editor = window.activeTextEditor;
|
||||
assert.notEqual(editor, undefined);
|
||||
assert.equal(basename(editor!.document.fileName), 'debug.js');
|
||||
assert.notStrictEqual(editor, undefined);
|
||||
assert.strictEqual(basename(editor!.document.fileName), 'debug.js');
|
||||
|
||||
const thirdVariablesRetrieved = new Promise<void>(resolve => variablesReceived = resolve);
|
||||
await commands.executeCommand('workbench.action.debug.stepOver');
|
||||
await thirdVariablesRetrieved;
|
||||
assert.equal(stoppedEvents, 3);
|
||||
assert.strictEqual(stoppedEvents, 3);
|
||||
|
||||
const fourthVariablesRetrieved = new Promise<void>(resolve => variablesReceived = resolve);
|
||||
await commands.executeCommand('workbench.action.debug.stepInto');
|
||||
await fourthVariablesRetrieved;
|
||||
assert.equal(stoppedEvents, 4);
|
||||
assert.strictEqual(stoppedEvents, 4);
|
||||
|
||||
const fifthVariablesRetrieved = new Promise<void>(resolve => variablesReceived = resolve);
|
||||
await commands.executeCommand('workbench.action.debug.stepOut');
|
||||
await fifthVariablesRetrieved;
|
||||
assert.equal(stoppedEvents, 5);
|
||||
assert.strictEqual(stoppedEvents, 5);
|
||||
|
||||
let sessionTerminated: () => void;
|
||||
toDispose.push(debug.onDidTerminateDebugSession(() => {
|
||||
@@ -127,6 +127,6 @@ suite('vscode API - debug', function () {
|
||||
} catch (e) {
|
||||
errorCount++;
|
||||
}
|
||||
assert.equal(errorCount, 1);
|
||||
assert.strictEqual(errorCount, 1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ suite('vscode API - editors', () => {
|
||||
return withRandomFileEditor('', (editor, doc) => {
|
||||
return editor.insertSnippet(snippetString).then(inserted => {
|
||||
assert.ok(inserted);
|
||||
assert.equal(doc.getText(), 'This is a placeholder snippet');
|
||||
assert.strictEqual(doc.getText(), 'This is a placeholder snippet');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
});
|
||||
@@ -69,7 +69,7 @@ suite('vscode API - editors', () => {
|
||||
await withRandomFileEditor('', async (editor, doc) => {
|
||||
const inserted = await editor.insertSnippet(snippetString);
|
||||
assert.ok(inserted);
|
||||
assert.equal(doc.getText(), 'running: INTEGRATION-TESTS');
|
||||
assert.strictEqual(doc.getText(), 'running: INTEGRATION-TESTS');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
|
||||
@@ -88,7 +88,7 @@ suite('vscode API - editors', () => {
|
||||
|
||||
return editor.insertSnippet(snippetString).then(inserted => {
|
||||
assert.ok(inserted);
|
||||
assert.equal(doc.getText(), 'This has been replaced');
|
||||
assert.strictEqual(doc.getText(), 'This has been replaced');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
});
|
||||
@@ -106,7 +106,7 @@ suite('vscode API - editors', () => {
|
||||
|
||||
return editor.insertSnippet(snippetString, selection).then(inserted => {
|
||||
assert.ok(inserted);
|
||||
assert.equal(doc.getText(), 'This has been replaced');
|
||||
assert.strictEqual(doc.getText(), 'This has been replaced');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
});
|
||||
@@ -118,7 +118,7 @@ suite('vscode API - editors', () => {
|
||||
builder.insert(new Position(0, 0), 'Hello World');
|
||||
}).then(applied => {
|
||||
assert.ok(applied);
|
||||
assert.equal(doc.getText(), 'Hello World');
|
||||
assert.strictEqual(doc.getText(), 'Hello World');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
});
|
||||
@@ -130,7 +130,7 @@ suite('vscode API - editors', () => {
|
||||
builder.replace(new Range(0, 0, Number.MAX_VALUE, Number.MAX_VALUE), 'new');
|
||||
}).then(applied => {
|
||||
assert.ok(applied);
|
||||
assert.equal(doc.getText(), 'new');
|
||||
assert.strictEqual(doc.getText(), 'new');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
});
|
||||
@@ -146,12 +146,12 @@ suite('vscode API - editors', () => {
|
||||
return withRandomFileEditor('Hello world!', async (editor, doc) => {
|
||||
const applied1 = await executeReplace(editor, new Range(0, 0, 0, 1), 'h', false, false);
|
||||
assert.ok(applied1);
|
||||
assert.equal(doc.getText(), 'hello world!');
|
||||
assert.strictEqual(doc.getText(), 'hello world!');
|
||||
assert.ok(doc.isDirty);
|
||||
|
||||
const applied2 = await executeReplace(editor, new Range(0, 1, 0, 5), 'ELLO', false, false);
|
||||
assert.ok(applied2);
|
||||
assert.equal(doc.getText(), 'hELLO world!');
|
||||
assert.strictEqual(doc.getText(), 'hELLO world!');
|
||||
assert.ok(doc.isDirty);
|
||||
|
||||
await commands.executeCommand('undo');
|
||||
@@ -161,7 +161,7 @@ suite('vscode API - editors', () => {
|
||||
// it is unclear why this happens, but it can happen for a multitude of reasons
|
||||
await commands.executeCommand('undo');
|
||||
}
|
||||
assert.equal(doc.getText(), 'Hello world!');
|
||||
assert.strictEqual(doc.getText(), 'Hello world!');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -169,16 +169,16 @@ suite('vscode API - editors', () => {
|
||||
return withRandomFileEditor('Hello world!', (editor, doc) => {
|
||||
return executeReplace(editor, new Range(0, 0, 0, 1), 'h', false, false).then(applied => {
|
||||
assert.ok(applied);
|
||||
assert.equal(doc.getText(), 'hello world!');
|
||||
assert.strictEqual(doc.getText(), 'hello world!');
|
||||
assert.ok(doc.isDirty);
|
||||
return executeReplace(editor, new Range(0, 1, 0, 5), 'ELLO', true, false);
|
||||
}).then(applied => {
|
||||
assert.ok(applied);
|
||||
assert.equal(doc.getText(), 'hELLO world!');
|
||||
assert.strictEqual(doc.getText(), 'hELLO world!');
|
||||
assert.ok(doc.isDirty);
|
||||
return commands.executeCommand('undo');
|
||||
}).then(_ => {
|
||||
assert.equal(doc.getText(), 'hello world!');
|
||||
assert.strictEqual(doc.getText(), 'hello world!');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -186,26 +186,26 @@ suite('vscode API - editors', () => {
|
||||
test('issue #16573: Extension API: insertSpaces and tabSize are undefined', () => {
|
||||
return withRandomFileEditor('Hello world!\n\tHello world!', (editor, _doc) => {
|
||||
|
||||
assert.equal(editor.options.tabSize, 4);
|
||||
assert.equal(editor.options.insertSpaces, false);
|
||||
assert.equal(editor.options.cursorStyle, TextEditorCursorStyle.Line);
|
||||
assert.equal(editor.options.lineNumbers, TextEditorLineNumbersStyle.On);
|
||||
assert.strictEqual(editor.options.tabSize, 4);
|
||||
assert.strictEqual(editor.options.insertSpaces, false);
|
||||
assert.strictEqual(editor.options.cursorStyle, TextEditorCursorStyle.Line);
|
||||
assert.strictEqual(editor.options.lineNumbers, TextEditorLineNumbersStyle.On);
|
||||
|
||||
editor.options = {
|
||||
tabSize: 2
|
||||
};
|
||||
|
||||
assert.equal(editor.options.tabSize, 2);
|
||||
assert.equal(editor.options.insertSpaces, false);
|
||||
assert.equal(editor.options.cursorStyle, TextEditorCursorStyle.Line);
|
||||
assert.equal(editor.options.lineNumbers, TextEditorLineNumbersStyle.On);
|
||||
assert.strictEqual(editor.options.tabSize, 2);
|
||||
assert.strictEqual(editor.options.insertSpaces, false);
|
||||
assert.strictEqual(editor.options.cursorStyle, TextEditorCursorStyle.Line);
|
||||
assert.strictEqual(editor.options.lineNumbers, TextEditorLineNumbersStyle.On);
|
||||
|
||||
editor.options.tabSize = 'invalid';
|
||||
|
||||
assert.equal(editor.options.tabSize, 2);
|
||||
assert.equal(editor.options.insertSpaces, false);
|
||||
assert.equal(editor.options.cursorStyle, TextEditorCursorStyle.Line);
|
||||
assert.equal(editor.options.lineNumbers, TextEditorLineNumbersStyle.On);
|
||||
assert.strictEqual(editor.options.tabSize, 2);
|
||||
assert.strictEqual(editor.options.insertSpaces, false);
|
||||
assert.strictEqual(editor.options.cursorStyle, TextEditorCursorStyle.Line);
|
||||
assert.strictEqual(editor.options.lineNumbers, TextEditorLineNumbersStyle.On);
|
||||
|
||||
return Promise.resolve();
|
||||
});
|
||||
@@ -262,6 +262,6 @@ suite('vscode API - editors', () => {
|
||||
const file = Uri.parse(root.toString() + relativePath);
|
||||
const document = await workspace.openTextDocument(file);
|
||||
|
||||
assert.equal(document.getText(), Buffer.from(await workspace.fs.readFile(file)).toString());
|
||||
assert.strictEqual(document.getText(), Buffer.from(await workspace.fs.readFile(file)).toString());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -12,12 +12,12 @@ suite('vscode API - env', () => {
|
||||
teardown(assertNoRpc);
|
||||
|
||||
test('env is set', function () {
|
||||
assert.equal(typeof env.language, 'string');
|
||||
assert.equal(typeof env.appRoot, 'string');
|
||||
assert.equal(typeof env.appName, 'string');
|
||||
assert.equal(typeof env.machineId, 'string');
|
||||
assert.equal(typeof env.sessionId, 'string');
|
||||
assert.equal(typeof env.shell, 'string');
|
||||
assert.strictEqual(typeof env.language, 'string');
|
||||
assert.strictEqual(typeof env.appRoot, 'string');
|
||||
assert.strictEqual(typeof env.appName, 'string');
|
||||
assert.strictEqual(typeof env.machineId, 'string');
|
||||
assert.strictEqual(typeof env.sessionId, 'string');
|
||||
assert.strictEqual(typeof env.shell, 'string');
|
||||
});
|
||||
|
||||
test('env is readonly', function () {
|
||||
@@ -37,7 +37,7 @@ suite('vscode API - env', () => {
|
||||
// not running in remote, so we expect both extensions
|
||||
assert.ok(knownWorkspaceExtension);
|
||||
assert.ok(knownUiAndWorkspaceExtension);
|
||||
assert.equal(ExtensionKind.UI, knownUiAndWorkspaceExtension!.extensionKind);
|
||||
assert.strictEqual(ExtensionKind.UI, knownUiAndWorkspaceExtension!.extensionKind);
|
||||
} else if (typeof remoteName === 'string') {
|
||||
// running in remote, so we only expect workspace extensions
|
||||
assert.ok(knownWorkspaceExtension);
|
||||
@@ -46,7 +46,7 @@ suite('vscode API - env', () => {
|
||||
} else {
|
||||
assert.ok(knownUiAndWorkspaceExtension);
|
||||
}
|
||||
assert.equal(ExtensionKind.Workspace, knownWorkspaceExtension!.extensionKind);
|
||||
assert.strictEqual(ExtensionKind.Workspace, knownWorkspaceExtension!.extensionKind);
|
||||
} else {
|
||||
assert.fail();
|
||||
}
|
||||
@@ -58,9 +58,9 @@ suite('vscode API - env', () => {
|
||||
|
||||
const kind = env.uiKind;
|
||||
if (result.scheme === 'http' || result.scheme === 'https') {
|
||||
assert.equal(kind, UIKind.Web);
|
||||
assert.strictEqual(kind, UIKind.Web);
|
||||
} else {
|
||||
assert.equal(kind, UIKind.Desktop);
|
||||
assert.strictEqual(kind, UIKind.Desktop);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -70,9 +70,9 @@ suite('vscode API - env', () => {
|
||||
assert.ok(result);
|
||||
|
||||
if (env.uiKind === UIKind.Desktop) {
|
||||
assert.equal(uri.scheme, result.scheme);
|
||||
assert.equal(uri.authority, result.authority);
|
||||
assert.equal(uri.path, result.path);
|
||||
assert.strictEqual(uri.scheme, result.scheme);
|
||||
assert.strictEqual(uri.authority, result.authority);
|
||||
assert.strictEqual(uri.path, result.path);
|
||||
} else {
|
||||
assert.ok(result.scheme === 'http' || result.scheme === 'https');
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ suite('vscode API - languages', () => {
|
||||
}
|
||||
|
||||
function assertEqualRange(actual: vscode.Range, expected: vscode.Range, message?: string) {
|
||||
assert.equal(rangeToString(actual), rangeToString(expected), message);
|
||||
assert.strictEqual(rangeToString(actual), rangeToString(expected), message);
|
||||
}
|
||||
|
||||
test('setTextDocumentLanguage -> close/open event', async function () {
|
||||
@@ -36,8 +36,8 @@ suite('vscode API - languages', () => {
|
||||
let close = new Promise<void>(resolve => {
|
||||
disposables.push(vscode.workspace.onDidCloseTextDocument(e => {
|
||||
if (e === doc) {
|
||||
assert.equal(doc.languageId, langIdNow);
|
||||
assert.equal(clock, 0);
|
||||
assert.strictEqual(doc.languageId, langIdNow);
|
||||
assert.strictEqual(clock, 0);
|
||||
clock += 1;
|
||||
resolve();
|
||||
}
|
||||
@@ -46,8 +46,8 @@ suite('vscode API - languages', () => {
|
||||
let open = new Promise<void>(resolve => {
|
||||
disposables.push(vscode.workspace.onDidOpenTextDocument(e => {
|
||||
if (e === doc) { // same instance!
|
||||
assert.equal(doc.languageId, 'json');
|
||||
assert.equal(clock, 1);
|
||||
assert.strictEqual(doc.languageId, 'json');
|
||||
assert.strictEqual(clock, 1);
|
||||
clock += 1;
|
||||
resolve();
|
||||
}
|
||||
@@ -55,8 +55,8 @@ suite('vscode API - languages', () => {
|
||||
});
|
||||
let change = vscode.languages.setTextDocumentLanguage(doc, 'json');
|
||||
await Promise.all([change, close, open]);
|
||||
assert.equal(clock, 2);
|
||||
assert.equal(doc.languageId, 'json');
|
||||
assert.strictEqual(clock, 2);
|
||||
assert.strictEqual(doc.languageId, 'json');
|
||||
disposables.forEach(disposable => disposable.dispose());
|
||||
disposables.length = 0;
|
||||
});
|
||||
@@ -82,7 +82,7 @@ suite('vscode API - languages', () => {
|
||||
col2.set(uri, [new vscode.Diagnostic(new vscode.Range(0, 0, 0, 12), 'error1')]);
|
||||
|
||||
let diag = vscode.languages.getDiagnostics(uri);
|
||||
assert.equal(diag.length, 2);
|
||||
assert.strictEqual(diag.length, 2);
|
||||
|
||||
let tuples = vscode.languages.getDiagnostics();
|
||||
let found = false;
|
||||
@@ -111,13 +111,13 @@ suite('vscode API - languages', () => {
|
||||
vscode.languages.registerDocumentLinkProvider({ language: 'java', scheme: testFs.scheme }, linkProvider);
|
||||
|
||||
const links = await vscode.commands.executeCommand<vscode.DocumentLink[]>('vscode.executeLinkProvider', doc.uri);
|
||||
assert.equal(2, links && links.length);
|
||||
assert.strictEqual(2, links && links.length);
|
||||
let [link1, link2] = links!.sort((l1, l2) => l1.range.start.compareTo(l2.range.start));
|
||||
|
||||
assert.equal(target.toString(), link1.target && link1.target.toString());
|
||||
assert.strictEqual(target.toString(), link1.target && link1.target.toString());
|
||||
assertEqualRange(range, link1.range);
|
||||
|
||||
assert.equal('http://a.com/', link2.target && link2.target.toString());
|
||||
assert.strictEqual('http://a.com/', link2.target && link2.target.toString());
|
||||
assertEqualRange(new vscode.Range(new vscode.Position(0, 13), new vscode.Position(0, 25)), link2.range);
|
||||
});
|
||||
|
||||
@@ -139,7 +139,7 @@ suite('vscode API - languages', () => {
|
||||
let r1 = vscode.languages.registerCodeActionsProvider({ pattern: '*.far', scheme: 'ttt' }, {
|
||||
provideCodeActions(_document, _range, ctx): vscode.Command[] {
|
||||
|
||||
assert.equal(ctx.diagnostics.length, 2);
|
||||
assert.strictEqual(ctx.diagnostics.length, 2);
|
||||
let [first, second] = ctx.diagnostics;
|
||||
assert.ok(first === diag1);
|
||||
assert.ok(second === diag2);
|
||||
|
||||
@@ -522,7 +522,7 @@ suite('Notebook API tests', function () {
|
||||
|
||||
await vscode.commands.executeCommand('notebook.cell.insertCodeCellAbove');
|
||||
const activeCell = getFocusedCell(vscode.window.activeNotebookEditor);
|
||||
assert.notEqual(getFocusedCell(vscode.window.activeNotebookEditor), undefined);
|
||||
assert.notStrictEqual(getFocusedCell(vscode.window.activeNotebookEditor), undefined);
|
||||
assert.strictEqual(activeCell!.document.getText(), '');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 1);
|
||||
@@ -545,7 +545,7 @@ suite('Notebook API tests', function () {
|
||||
// ---- insert cell above and focus ---- //
|
||||
await vscode.commands.executeCommand('notebook.cell.insertCodeCellAbove');
|
||||
let activeCell = getFocusedCell(vscode.window.activeNotebookEditor);
|
||||
assert.notEqual(getFocusedCell(vscode.window.activeNotebookEditor), undefined);
|
||||
assert.notStrictEqual(getFocusedCell(vscode.window.activeNotebookEditor), undefined);
|
||||
assert.strictEqual(activeCell!.document.getText(), '');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 1);
|
||||
@@ -1049,7 +1049,7 @@ suite('Notebook API tests', function () {
|
||||
assert.strictEqual(getFocusedCell(vscode.window.activeNotebookEditor!)?.document.getText(), 'test');
|
||||
assert.strictEqual(getFocusedCell(vscode.window.activeNotebookEditor!)?.document.languageId, 'typescript');
|
||||
|
||||
assert.notEqual(firstNotebookEditor, secondNotebookEditor);
|
||||
assert.notStrictEqual(firstNotebookEditor, secondNotebookEditor);
|
||||
assert.strictEqual(firstNotebookEditor?.document, secondNotebookEditor?.document, 'split notebook editors share the same document');
|
||||
|
||||
await saveAllFilesAndCloseAll(resource);
|
||||
@@ -1151,15 +1151,15 @@ suite('Notebook API tests', function () {
|
||||
|
||||
// now it's dirty, open the resource with notebook editor should open a new one
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
assert.notEqual(vscode.window.activeNotebookEditor, undefined, 'notebook first');
|
||||
// assert.notEqual(vscode.window.activeTextEditor, undefined);
|
||||
assert.notStrictEqual(vscode.window.activeNotebookEditor, undefined, 'notebook first');
|
||||
// assert.notStrictEqual(vscode.window.activeTextEditor, undefined);
|
||||
|
||||
await closeAllEditors();
|
||||
});
|
||||
|
||||
test('#102411 - untitled notebook creation failed', async function () {
|
||||
await vscode.commands.executeCommand('workbench.action.files.newUntitledFile', { viewType: 'notebookCoreTest' });
|
||||
assert.notEqual(vscode.window.activeNotebookEditor, undefined, 'untitled notebook editor is not undefined');
|
||||
assert.notStrictEqual(vscode.window.activeNotebookEditor, undefined, 'untitled notebook editor is not undefined');
|
||||
|
||||
await closeAllEditors();
|
||||
});
|
||||
@@ -1182,7 +1182,7 @@ suite('Notebook API tests', function () {
|
||||
await vscode.workspace.applyEdit(edit);
|
||||
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().length, 3);
|
||||
assert.notEqual(vscode.window.activeNotebookEditor!.document.cellAt(0).document.getText(), vscode.window.activeNotebookEditor!.document.cellAt(1).document.getText());
|
||||
assert.notStrictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0).document.getText(), vscode.window.activeNotebookEditor!.document.cellAt(1).document.getText());
|
||||
|
||||
await closeAllEditors();
|
||||
});
|
||||
|
||||
@@ -216,10 +216,10 @@ function createQuickPick(expected: QuickPickExpected, done: (err?: any) => void,
|
||||
}
|
||||
try {
|
||||
eventIndex++;
|
||||
assert.equal('active', expected.events.shift(), `onDidChangeActive (event ${eventIndex})`);
|
||||
assert.strictEqual('active', expected.events.shift(), `onDidChangeActive (event ${eventIndex})`);
|
||||
const expectedItems = expected.activeItems.shift();
|
||||
assert.deepEqual(items.map(item => item.label), expectedItems, `onDidChangeActive event items (event ${eventIndex})`);
|
||||
assert.deepEqual(quickPick.activeItems.map(item => item.label), expectedItems, `onDidChangeActive active items (event ${eventIndex})`);
|
||||
assert.deepStrictEqual(items.map(item => item.label), expectedItems, `onDidChangeActive event items (event ${eventIndex})`);
|
||||
assert.deepStrictEqual(quickPick.activeItems.map(item => item.label), expectedItems, `onDidChangeActive active items (event ${eventIndex})`);
|
||||
} catch (err) {
|
||||
done(err);
|
||||
}
|
||||
@@ -231,10 +231,10 @@ function createQuickPick(expected: QuickPickExpected, done: (err?: any) => void,
|
||||
}
|
||||
try {
|
||||
eventIndex++;
|
||||
assert.equal('selection', expected.events.shift(), `onDidChangeSelection (event ${eventIndex})`);
|
||||
assert.strictEqual('selection', expected.events.shift(), `onDidChangeSelection (event ${eventIndex})`);
|
||||
const expectedItems = expected.selectionItems.shift();
|
||||
assert.deepEqual(items.map(item => item.label), expectedItems, `onDidChangeSelection event items (event ${eventIndex})`);
|
||||
assert.deepEqual(quickPick.selectedItems.map(item => item.label), expectedItems, `onDidChangeSelection selected items (event ${eventIndex})`);
|
||||
assert.deepStrictEqual(items.map(item => item.label), expectedItems, `onDidChangeSelection event items (event ${eventIndex})`);
|
||||
assert.deepStrictEqual(quickPick.selectedItems.map(item => item.label), expectedItems, `onDidChangeSelection selected items (event ${eventIndex})`);
|
||||
} catch (err) {
|
||||
done(err);
|
||||
}
|
||||
@@ -246,11 +246,11 @@ function createQuickPick(expected: QuickPickExpected, done: (err?: any) => void,
|
||||
}
|
||||
try {
|
||||
eventIndex++;
|
||||
assert.equal('accept', expected.events.shift(), `onDidAccept (event ${eventIndex})`);
|
||||
assert.strictEqual('accept', expected.events.shift(), `onDidAccept (event ${eventIndex})`);
|
||||
const expectedActive = expected.acceptedItems.active.shift();
|
||||
assert.deepEqual(quickPick.activeItems.map(item => item.label), expectedActive, `onDidAccept active items (event ${eventIndex})`);
|
||||
assert.deepStrictEqual(quickPick.activeItems.map(item => item.label), expectedActive, `onDidAccept active items (event ${eventIndex})`);
|
||||
const expectedSelection = expected.acceptedItems.selection.shift();
|
||||
assert.deepEqual(quickPick.selectedItems.map(item => item.label), expectedSelection, `onDidAccept selected items (event ${eventIndex})`);
|
||||
assert.deepStrictEqual(quickPick.selectedItems.map(item => item.label), expectedSelection, `onDidAccept selected items (event ${eventIndex})`);
|
||||
if (expected.acceptedItems.dispose.shift()) {
|
||||
quickPick.dispose();
|
||||
}
|
||||
@@ -265,7 +265,7 @@ function createQuickPick(expected: QuickPickExpected, done: (err?: any) => void,
|
||||
return;
|
||||
}
|
||||
try {
|
||||
assert.equal('hide', expected.events.shift());
|
||||
assert.strictEqual('hide', expected.events.shift());
|
||||
done();
|
||||
} catch (err) {
|
||||
done(err);
|
||||
|
||||
@@ -504,6 +504,41 @@ import { assertNoRpc } from '../utils';
|
||||
const terminal = window.createTerminal({ name: 'foo', pty });
|
||||
});
|
||||
|
||||
test('should change terminal name', (done) => {
|
||||
disposables.push(window.onDidOpenTerminal(term => {
|
||||
try {
|
||||
equal(terminal, term);
|
||||
equal(terminal.name, 'foo');
|
||||
} catch (e) {
|
||||
done(e);
|
||||
return;
|
||||
}
|
||||
disposables.push(window.onDidCloseTerminal(t => {
|
||||
try {
|
||||
equal(terminal, t);
|
||||
equal(terminal.name, 'bar');
|
||||
} catch (e) {
|
||||
done(e);
|
||||
return;
|
||||
}
|
||||
done();
|
||||
}));
|
||||
}));
|
||||
const changeNameEmitter = new EventEmitter<string>();
|
||||
const closeEmitter = new EventEmitter<number | undefined>();
|
||||
const pty: Pseudoterminal = {
|
||||
onDidWrite: new EventEmitter<string>().event,
|
||||
onDidChangeName: changeNameEmitter.event,
|
||||
onDidClose: closeEmitter.event,
|
||||
open: () => {
|
||||
changeNameEmitter.fire('bar');
|
||||
closeEmitter.fire(undefined);
|
||||
},
|
||||
close: () => { }
|
||||
};
|
||||
const terminal = window.createTerminal({ name: 'foo', pty });
|
||||
});
|
||||
|
||||
test('exitStatus.code should be set to the exit code (undefined)', (done) => {
|
||||
disposables.push(window.onDidOpenTerminal(term => {
|
||||
try {
|
||||
|
||||
@@ -34,20 +34,20 @@ suite('vscode API - window', () => {
|
||||
});
|
||||
|
||||
// test('editor, UN-active text editor', () => {
|
||||
// assert.equal(window.visibleTextEditors.length, 0);
|
||||
// assert.strictEqual(window.visibleTextEditors.length, 0);
|
||||
// assert.ok(window.activeTextEditor === undefined);
|
||||
// });
|
||||
|
||||
test('editor, assign and check view columns', async () => {
|
||||
const doc = await workspace.openTextDocument(join(workspace.rootPath || '', './far.js'));
|
||||
let p1 = window.showTextDocument(doc, ViewColumn.One).then(editor => {
|
||||
assert.equal(editor.viewColumn, ViewColumn.One);
|
||||
assert.strictEqual(editor.viewColumn, ViewColumn.One);
|
||||
});
|
||||
let p2 = window.showTextDocument(doc, ViewColumn.Two).then(editor_1 => {
|
||||
assert.equal(editor_1.viewColumn, ViewColumn.Two);
|
||||
assert.strictEqual(editor_1.viewColumn, ViewColumn.Two);
|
||||
});
|
||||
let p3 = window.showTextDocument(doc, ViewColumn.Three).then(editor_2 => {
|
||||
assert.equal(editor_2.viewColumn, ViewColumn.Three);
|
||||
assert.strictEqual(editor_2.viewColumn, ViewColumn.Three);
|
||||
});
|
||||
return Promise.all([p1, p2, p3]);
|
||||
});
|
||||
@@ -60,13 +60,13 @@ suite('vscode API - window', () => {
|
||||
|
||||
const doc = await workspace.openTextDocument(join(workspace.rootPath || '', './far.js'));
|
||||
await window.showTextDocument(doc, ViewColumn.One);
|
||||
assert.equal(eventCounter, 1);
|
||||
assert.strictEqual(eventCounter, 1);
|
||||
|
||||
await window.showTextDocument(doc, ViewColumn.Two);
|
||||
assert.equal(eventCounter, 2);
|
||||
assert.strictEqual(eventCounter, 2);
|
||||
|
||||
await window.showTextDocument(doc, ViewColumn.Three);
|
||||
assert.equal(eventCounter, 3);
|
||||
assert.strictEqual(eventCounter, 3);
|
||||
|
||||
reg.dispose();
|
||||
});
|
||||
@@ -138,10 +138,10 @@ suite('vscode API - window', () => {
|
||||
return commands.executeCommand('workbench.action.moveActiveEditorGroupLeft');
|
||||
|
||||
}).then(() => {
|
||||
assert.equal(actualEvents.length, 2);
|
||||
assert.strictEqual(actualEvents.length, 2);
|
||||
|
||||
for (const event of actualEvents) {
|
||||
assert.equal(event.viewColumn, event.textEditor.viewColumn);
|
||||
assert.strictEqual(event.viewColumn, event.textEditor.viewColumn);
|
||||
}
|
||||
|
||||
registration1.dispose();
|
||||
@@ -202,7 +202,7 @@ suite('vscode API - window', () => {
|
||||
|
||||
assert.ok(window.activeTextEditor);
|
||||
assert.ok(window.activeTextEditor!.document === docB);
|
||||
assert.equal(window.activeTextEditor!.viewColumn, ViewColumn.Two);
|
||||
assert.strictEqual(window.activeTextEditor!.viewColumn, ViewColumn.Two);
|
||||
|
||||
const editor = await window.showTextDocument(docC);
|
||||
assert.ok(
|
||||
@@ -210,7 +210,7 @@ suite('vscode API - window', () => {
|
||||
`wanted fileName:${editor.document.fileName}/viewColumn:${editor.viewColumn} but got fileName:${window.activeTextEditor!.document.fileName}/viewColumn:${window.activeTextEditor!.viewColumn}. a:${docA.fileName}, b:${docB.fileName}, c:${docC.fileName}`
|
||||
);
|
||||
assert.ok(window.activeTextEditor!.document === docC);
|
||||
assert.equal(window.activeTextEditor!.viewColumn, ViewColumn.Two);
|
||||
assert.strictEqual(window.activeTextEditor!.viewColumn, ViewColumn.Two);
|
||||
});
|
||||
|
||||
test('showTextDocument ViewColumn.BESIDE', async () => {
|
||||
@@ -225,12 +225,12 @@ suite('vscode API - window', () => {
|
||||
|
||||
assert.ok(window.activeTextEditor);
|
||||
assert.ok(window.activeTextEditor!.document === docB);
|
||||
assert.equal(window.activeTextEditor!.viewColumn, ViewColumn.Two);
|
||||
assert.strictEqual(window.activeTextEditor!.viewColumn, ViewColumn.Two);
|
||||
|
||||
await window.showTextDocument(docC, ViewColumn.Beside);
|
||||
|
||||
assert.ok(window.activeTextEditor!.document === docC);
|
||||
assert.equal(window.activeTextEditor!.viewColumn, ViewColumn.Three);
|
||||
assert.strictEqual(window.activeTextEditor!.viewColumn, ViewColumn.Three);
|
||||
});
|
||||
|
||||
test('showTextDocument ViewColumn is always defined (even when opening > ViewColumn.Nine)', async () => {
|
||||
@@ -260,7 +260,7 @@ suite('vscode API - window', () => {
|
||||
|
||||
assert.ok(window.activeTextEditor);
|
||||
assert.ok(window.activeTextEditor!.document === doc10);
|
||||
assert.equal(window.activeTextEditor!.viewColumn, 10);
|
||||
assert.strictEqual(window.activeTextEditor!.viewColumn, 10);
|
||||
});
|
||||
|
||||
test('issue #27408 - showTextDocument & vscode.diff always default to ViewColumn.One', async () => {
|
||||
@@ -275,12 +275,12 @@ suite('vscode API - window', () => {
|
||||
|
||||
assert.ok(window.activeTextEditor);
|
||||
assert.ok(window.activeTextEditor!.document === docB);
|
||||
assert.equal(window.activeTextEditor!.viewColumn, ViewColumn.Two);
|
||||
assert.strictEqual(window.activeTextEditor!.viewColumn, ViewColumn.Two);
|
||||
|
||||
await window.showTextDocument(docC, ViewColumn.Active);
|
||||
|
||||
assert.ok(window.activeTextEditor!.document === docC);
|
||||
assert.equal(window.activeTextEditor!.viewColumn, ViewColumn.Two);
|
||||
assert.strictEqual(window.activeTextEditor!.viewColumn, ViewColumn.Two);
|
||||
});
|
||||
|
||||
test('issue #5362 - Incorrect TextEditor passed by onDidChangeTextEditorSelection', (done) => {
|
||||
@@ -359,7 +359,7 @@ suite('vscode API - window', () => {
|
||||
const p = window.showInputBox(undefined, source.token);
|
||||
source.cancel();
|
||||
const value = await p;
|
||||
assert.equal(value, undefined);
|
||||
assert.strictEqual(value, undefined);
|
||||
});
|
||||
|
||||
test('showInputBox - cancel early', async function () {
|
||||
@@ -367,21 +367,21 @@ suite('vscode API - window', () => {
|
||||
source.cancel();
|
||||
const p = window.showInputBox(undefined, source.token);
|
||||
const value = await p;
|
||||
assert.equal(value, undefined);
|
||||
assert.strictEqual(value, undefined);
|
||||
});
|
||||
|
||||
test('showInputBox - \'\' on Enter', function () {
|
||||
const p = window.showInputBox();
|
||||
return Promise.all<any>([
|
||||
commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem'),
|
||||
p.then(value => assert.equal(value, ''))
|
||||
p.then(value => assert.strictEqual(value, ''))
|
||||
]);
|
||||
});
|
||||
|
||||
test('showInputBox - default value on Enter', function () {
|
||||
const p = window.showInputBox({ value: 'farboo' });
|
||||
return Promise.all<any>([
|
||||
p.then(value => assert.equal(value, 'farboo')),
|
||||
p.then(value => assert.strictEqual(value, 'farboo')),
|
||||
commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem'),
|
||||
]);
|
||||
});
|
||||
@@ -390,7 +390,7 @@ suite('vscode API - window', () => {
|
||||
const p = window.showInputBox();
|
||||
return Promise.all<any>([
|
||||
commands.executeCommand('workbench.action.closeQuickOpen'),
|
||||
p.then(value => assert.equal(value, undefined))
|
||||
p.then(value => assert.strictEqual(value, undefined))
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -398,17 +398,17 @@ suite('vscode API - window', () => {
|
||||
const p = window.showInputBox({ value: 'farboo' });
|
||||
return Promise.all<any>([
|
||||
commands.executeCommand('workbench.action.closeQuickOpen'),
|
||||
p.then(value => assert.equal(value, undefined))
|
||||
p.then(value => assert.strictEqual(value, undefined))
|
||||
]);
|
||||
});
|
||||
|
||||
test('showInputBox - value not empty on second try', async function () {
|
||||
const one = window.showInputBox({ value: 'notempty' });
|
||||
await commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem');
|
||||
assert.equal(await one, 'notempty');
|
||||
assert.strictEqual(await one, 'notempty');
|
||||
const two = window.showInputBox({ value: 'notempty' });
|
||||
await commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem');
|
||||
assert.equal(await two, 'notempty');
|
||||
assert.strictEqual(await two, 'notempty');
|
||||
});
|
||||
|
||||
test('showQuickPick, accept first', async function () {
|
||||
@@ -417,9 +417,9 @@ suite('vscode API - window', () => {
|
||||
const pick = window.showQuickPick(['eins', 'zwei', 'drei'], {
|
||||
onDidSelectItem: tracker.onDidSelectItem
|
||||
});
|
||||
assert.equal(await first, 'eins');
|
||||
assert.strictEqual(await first, 'eins');
|
||||
await commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem');
|
||||
assert.equal(await pick, 'eins');
|
||||
assert.strictEqual(await pick, 'eins');
|
||||
return tracker.done();
|
||||
});
|
||||
|
||||
@@ -429,12 +429,12 @@ suite('vscode API - window', () => {
|
||||
const pick = window.showQuickPick(['eins', 'zwei', 'drei'], {
|
||||
onDidSelectItem: tracker.onDidSelectItem
|
||||
});
|
||||
assert.equal(await first, 'eins');
|
||||
assert.strictEqual(await first, 'eins');
|
||||
const second = tracker.nextItem();
|
||||
await commands.executeCommand('workbench.action.quickOpenSelectNext');
|
||||
assert.equal(await second, 'zwei');
|
||||
assert.strictEqual(await second, 'zwei');
|
||||
await commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem');
|
||||
assert.equal(await pick, 'zwei');
|
||||
assert.strictEqual(await pick, 'zwei');
|
||||
return tracker.done();
|
||||
});
|
||||
|
||||
@@ -457,14 +457,14 @@ suite('vscode API - window', () => {
|
||||
// console.log(`${label}: ${++i}`);
|
||||
await commands.executeCommand('workbench.action.quickOpenSelectNext');
|
||||
// console.log(`${label}: ${++i}`);
|
||||
assert.equal(await first, 'eins');
|
||||
assert.strictEqual(await first, 'eins');
|
||||
// console.log(`${label}: ${++i}`);
|
||||
await commands.executeCommand('workbench.action.quickPickManyToggle');
|
||||
// console.log(`${label}: ${++i}`);
|
||||
const second = new Promise(resolve => resolves.push(resolve));
|
||||
await commands.executeCommand('workbench.action.quickOpenSelectNext');
|
||||
// console.log(`${label}: ${++i}`);
|
||||
assert.equal(await second, 'zwei');
|
||||
assert.strictEqual(await second, 'zwei');
|
||||
// console.log(`${label}: ${++i}`);
|
||||
await commands.executeCommand('workbench.action.quickPickManyToggle');
|
||||
// console.log(`${label}: ${++i}`);
|
||||
@@ -503,7 +503,7 @@ suite('vscode API - window', () => {
|
||||
const p = window.showQuickPick(['eins', 'zwei', 'drei'], undefined, source.token);
|
||||
source.cancel();
|
||||
return p.then(value => {
|
||||
assert.equal(value, undefined);
|
||||
assert.strictEqual(value, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -512,7 +512,7 @@ suite('vscode API - window', () => {
|
||||
source.cancel();
|
||||
const p = window.showQuickPick(['eins', 'zwei', 'drei'], undefined, source.token);
|
||||
return p.then(value => {
|
||||
assert.equal(value, undefined);
|
||||
assert.strictEqual(value, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -522,7 +522,7 @@ suite('vscode API - window', () => {
|
||||
|
||||
const result = window.showQuickPick(['eins', 'zwei', 'drei'], { ignoreFocusOut: true }).then(result => {
|
||||
source.cancel();
|
||||
assert.equal(result, undefined);
|
||||
assert.strictEqual(result, undefined);
|
||||
});
|
||||
|
||||
window.showQuickPick(['eins', 'zwei', 'drei'], undefined, source.token);
|
||||
@@ -533,7 +533,7 @@ suite('vscode API - window', () => {
|
||||
test('showQuickPick, canceled by input', function () {
|
||||
|
||||
const result = window.showQuickPick(['eins', 'zwei', 'drei'], { ignoreFocusOut: true }).then(result => {
|
||||
assert.equal(result, undefined);
|
||||
assert.strictEqual(result, undefined);
|
||||
});
|
||||
|
||||
const source = new CancellationTokenSource();
|
||||
@@ -553,7 +553,7 @@ suite('vscode API - window', () => {
|
||||
const result = window.showQuickPick(data, undefined, source.token);
|
||||
source.cancel();
|
||||
const value_1 = await result;
|
||||
assert.equal(value_1, undefined);
|
||||
assert.strictEqual(value_1, undefined);
|
||||
});
|
||||
|
||||
test('showQuickPick, never resolve promise and cancel - #22453', function () {
|
||||
@@ -561,7 +561,7 @@ suite('vscode API - window', () => {
|
||||
const result = window.showQuickPick(new Promise<string[]>(_resolve => { }));
|
||||
|
||||
const a = result.then(value => {
|
||||
assert.equal(value, undefined);
|
||||
assert.strictEqual(value, undefined);
|
||||
});
|
||||
const b = commands.executeCommand('workbench.action.closeQuickOpen');
|
||||
return Promise.all([a, b]);
|
||||
@@ -598,7 +598,7 @@ suite('vscode API - window', () => {
|
||||
|
||||
await commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem');
|
||||
await commands.executeCommand('workbench.action.closeQuickOpen');
|
||||
assert.equal(await result, undefined);
|
||||
assert.strictEqual(await result, undefined);
|
||||
});
|
||||
|
||||
function createQuickPickTracker<T extends string | QuickPickItem>() {
|
||||
@@ -627,7 +627,7 @@ suite('vscode API - window', () => {
|
||||
|
||||
let subscription = window.onDidChangeTextEditorSelection(e => {
|
||||
assert.ok(e.textEditor === editor);
|
||||
assert.equal(e.kind, TextEditorSelectionChangeKind.Command);
|
||||
assert.strictEqual(e.kind, TextEditorSelectionChangeKind.Command);
|
||||
|
||||
subscription.dispose();
|
||||
resolve();
|
||||
|
||||
@@ -35,12 +35,12 @@ suite('vscode API - workspace events', () => {
|
||||
assert.ok(success);
|
||||
|
||||
assert.ok(onWillCreate);
|
||||
assert.equal(onWillCreate?.files.length, 1);
|
||||
assert.equal(onWillCreate?.files[0].toString(), newUri.toString());
|
||||
assert.strictEqual(onWillCreate?.files.length, 1);
|
||||
assert.strictEqual(onWillCreate?.files[0].toString(), newUri.toString());
|
||||
|
||||
assert.ok(onDidCreate);
|
||||
assert.equal(onDidCreate?.files.length, 1);
|
||||
assert.equal(onDidCreate?.files[0].toString(), newUri.toString());
|
||||
assert.strictEqual(onDidCreate?.files.length, 1);
|
||||
assert.strictEqual(onDidCreate?.files[0].toString(), newUri.toString());
|
||||
}));
|
||||
|
||||
test('onWillCreate/onDidCreate, make changes, edit another file', withLogDisabled(async function () {
|
||||
@@ -62,7 +62,7 @@ suite('vscode API - workspace events', () => {
|
||||
const success = await vscode.workspace.applyEdit(edit);
|
||||
assert.ok(success);
|
||||
|
||||
assert.equal(baseDoc.getText(), 'HALLO_NEW');
|
||||
assert.strictEqual(baseDoc.getText(), 'HALLO_NEW');
|
||||
}));
|
||||
|
||||
test('onWillCreate/onDidCreate, make changes, edit new file fails', withLogDisabled(async function () {
|
||||
@@ -83,8 +83,8 @@ suite('vscode API - workspace events', () => {
|
||||
const success = await vscode.workspace.applyEdit(edit);
|
||||
assert.ok(success);
|
||||
|
||||
assert.equal((await vscode.workspace.fs.readFile(newUri)).toString(), '');
|
||||
assert.equal((await vscode.workspace.openTextDocument(newUri)).getText(), '');
|
||||
assert.strictEqual((await vscode.workspace.fs.readFile(newUri)).toString(), '');
|
||||
assert.strictEqual((await vscode.workspace.openTextDocument(newUri)).getText(), '');
|
||||
}));
|
||||
|
||||
test('onWillDelete/onDidDelete', withLogDisabled(async function () {
|
||||
@@ -104,12 +104,12 @@ suite('vscode API - workspace events', () => {
|
||||
assert.ok(success);
|
||||
|
||||
assert.ok(onWilldelete);
|
||||
assert.equal(onWilldelete?.files.length, 1);
|
||||
assert.equal(onWilldelete?.files[0].toString(), base.toString());
|
||||
assert.strictEqual(onWilldelete?.files.length, 1);
|
||||
assert.strictEqual(onWilldelete?.files[0].toString(), base.toString());
|
||||
|
||||
assert.ok(onDiddelete);
|
||||
assert.equal(onDiddelete?.files.length, 1);
|
||||
assert.equal(onDiddelete?.files[0].toString(), base.toString());
|
||||
assert.strictEqual(onDiddelete?.files.length, 1);
|
||||
assert.strictEqual(onDiddelete?.files[0].toString(), base.toString());
|
||||
}));
|
||||
|
||||
test('onWillDelete/onDidDelete, make changes', withLogDisabled(async function () {
|
||||
@@ -190,14 +190,14 @@ suite('vscode API - workspace events', () => {
|
||||
assert.ok(success);
|
||||
|
||||
assert.ok(onWillRename);
|
||||
assert.equal(onWillRename?.files.length, 1);
|
||||
assert.equal(onWillRename?.files[0].oldUri.toString(), oldUri.toString());
|
||||
assert.equal(onWillRename?.files[0].newUri.toString(), newUri.toString());
|
||||
assert.strictEqual(onWillRename?.files.length, 1);
|
||||
assert.strictEqual(onWillRename?.files[0].oldUri.toString(), oldUri.toString());
|
||||
assert.strictEqual(onWillRename?.files[0].newUri.toString(), newUri.toString());
|
||||
|
||||
assert.ok(onDidRename);
|
||||
assert.equal(onDidRename?.files.length, 1);
|
||||
assert.equal(onDidRename?.files[0].oldUri.toString(), oldUri.toString());
|
||||
assert.equal(onDidRename?.files[0].newUri.toString(), newUri.toString());
|
||||
assert.strictEqual(onDidRename?.files.length, 1);
|
||||
assert.strictEqual(onDidRename?.files[0].oldUri.toString(), oldUri.toString());
|
||||
assert.strictEqual(onDidRename?.files[0].newUri.toString(), newUri.toString());
|
||||
}));
|
||||
|
||||
test('onWillRename - make changes (saved file)', withLogDisabled(function () {
|
||||
@@ -244,15 +244,15 @@ suite('vscode API - workspace events', () => {
|
||||
assert.ok(success);
|
||||
|
||||
assert.ok(onWillRename);
|
||||
assert.equal(onWillRename?.files.length, 1);
|
||||
assert.equal(onWillRename?.files[0].oldUri.toString(), oldUri.toString());
|
||||
assert.equal(onWillRename?.files[0].newUri.toString(), newUri.toString());
|
||||
assert.strictEqual(onWillRename?.files.length, 1);
|
||||
assert.strictEqual(onWillRename?.files[0].oldUri.toString(), oldUri.toString());
|
||||
assert.strictEqual(onWillRename?.files[0].newUri.toString(), newUri.toString());
|
||||
|
||||
const newDocument = await vscode.workspace.openTextDocument(newUri);
|
||||
const anotherDocument = await vscode.workspace.openTextDocument(anotherFile);
|
||||
|
||||
assert.equal(newDocument.getText(), withDirtyFile ? 'FOOBARBAR' : 'FOOBAR');
|
||||
assert.equal(anotherDocument.getText(), 'FARBOO');
|
||||
assert.strictEqual(newDocument.getText(), withDirtyFile ? 'FOOBARBAR' : 'FOOBAR');
|
||||
assert.strictEqual(anotherDocument.getText(), 'FARBOO');
|
||||
|
||||
assert.ok(newDocument.isDirty);
|
||||
assert.ok(anotherDocument.isDirty);
|
||||
|
||||
@@ -20,11 +20,11 @@ suite('vscode API - workspace-fs', () => {
|
||||
|
||||
test('fs.stat', async function () {
|
||||
const stat = await vscode.workspace.fs.stat(root);
|
||||
assert.equal(stat.type, vscode.FileType.Directory);
|
||||
assert.strictEqual(stat.type, vscode.FileType.Directory);
|
||||
|
||||
assert.equal(typeof stat.size, 'number');
|
||||
assert.equal(typeof stat.mtime, 'number');
|
||||
assert.equal(typeof stat.ctime, 'number');
|
||||
assert.strictEqual(typeof stat.size, 'number');
|
||||
assert.strictEqual(typeof stat.mtime, 'number');
|
||||
assert.strictEqual(typeof stat.ctime, 'number');
|
||||
|
||||
assert.ok(stat.mtime > 0);
|
||||
assert.ok(stat.ctime > 0);
|
||||
@@ -35,8 +35,8 @@ suite('vscode API - workspace-fs', () => {
|
||||
// find far.js
|
||||
const tuple = entries.find(tuple => tuple[0] === 'far.js')!;
|
||||
assert.ok(tuple);
|
||||
assert.equal(tuple[0], 'far.js');
|
||||
assert.equal(tuple[1], vscode.FileType.File);
|
||||
assert.strictEqual(tuple[0], 'far.js');
|
||||
assert.strictEqual(tuple[1], vscode.FileType.File);
|
||||
});
|
||||
|
||||
test('fs.stat - bad scheme', async function () {
|
||||
@@ -63,7 +63,7 @@ suite('vscode API - workspace-fs', () => {
|
||||
await vscode.workspace.fs.writeFile(uri, Buffer.from('HELLO'));
|
||||
|
||||
const stat = await vscode.workspace.fs.stat(uri);
|
||||
assert.equal(stat.type, vscode.FileType.File);
|
||||
assert.strictEqual(stat.type, vscode.FileType.File);
|
||||
|
||||
await vscode.workspace.fs.delete(uri);
|
||||
|
||||
@@ -129,7 +129,7 @@ suite('vscode API - workspace-fs', () => {
|
||||
assert.ok(false);
|
||||
} catch (e) {
|
||||
assert.ok(e instanceof vscode.FileSystemError);
|
||||
assert.equal(e.name, vscode.FileSystemError.FileNotFound().name);
|
||||
assert.strictEqual(e.name, vscode.FileSystemError.FileNotFound().name);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -140,7 +140,7 @@ suite('vscode API - workspace-fs', () => {
|
||||
assert.ok(false);
|
||||
} catch (e) {
|
||||
assert.ok(e instanceof vscode.FileSystemError);
|
||||
assert.equal(e.name, vscode.FileSystemError.Unavailable().name);
|
||||
assert.strictEqual(e.name, vscode.FileSystemError.Unavailable().name);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
test('MarkdownString', function () {
|
||||
let md = new vscode.MarkdownString();
|
||||
assert.equal(md.value, '');
|
||||
assert.equal(md.isTrusted, undefined);
|
||||
assert.strictEqual(md.value, '');
|
||||
assert.strictEqual(md.isTrusted, undefined);
|
||||
|
||||
md = new vscode.MarkdownString('**bold**');
|
||||
assert.equal(md.value, '**bold**');
|
||||
assert.strictEqual(md.value, '**bold**');
|
||||
|
||||
md.appendText('**bold?**');
|
||||
assert.equal(md.value, '**bold**\\*\\*bold?\\*\\*');
|
||||
assert.strictEqual(md.value, '**bold**\\*\\*bold?\\*\\*');
|
||||
|
||||
md.appendMarkdown('**bold**');
|
||||
assert.equal(md.value, '**bold**\\*\\*bold?\\*\\***bold**');
|
||||
assert.strictEqual(md.value, '**bold**\\*\\*bold?\\*\\***bold**');
|
||||
});
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
test('workspaceFolders', () => {
|
||||
if (vscode.workspace.workspaceFolders) {
|
||||
assert.equal(vscode.workspace.workspaceFolders.length, 1);
|
||||
assert.strictEqual(vscode.workspace.workspaceFolders.length, 1);
|
||||
assert.ok(pathEquals(vscode.workspace.workspaceFolders[0].uri.fsPath, join(__dirname, '../../testWorkspace')));
|
||||
}
|
||||
});
|
||||
@@ -68,14 +68,14 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
// not yet there
|
||||
const existing1 = vscode.workspace.textDocuments.find(doc => doc.uri.toString() === uri.toString());
|
||||
assert.equal(existing1, undefined);
|
||||
assert.strictEqual(existing1, undefined);
|
||||
|
||||
// open and assert its there
|
||||
const doc = await vscode.workspace.openTextDocument(uri);
|
||||
assert.ok(doc);
|
||||
assert.equal(doc.uri.toString(), uri.toString());
|
||||
assert.strictEqual(doc.uri.toString(), uri.toString());
|
||||
const existing2 = vscode.workspace.textDocuments.find(doc => doc.uri.toString() === uri.toString());
|
||||
assert.equal(existing2 === doc, true);
|
||||
assert.strictEqual(existing2 === doc, true);
|
||||
});
|
||||
|
||||
test('openTextDocument, illegal path', () => {
|
||||
@@ -88,7 +88,7 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
test('openTextDocument, untitled is dirty', async function () {
|
||||
return vscode.workspace.openTextDocument(vscode.workspace.workspaceFolders![0].uri.with({ scheme: 'untitled', path: posix.join(vscode.workspace.workspaceFolders![0].uri.path, 'newfile.txt') })).then(doc => {
|
||||
assert.equal(doc.uri.scheme, 'untitled');
|
||||
assert.strictEqual(doc.uri.scheme, 'untitled');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
});
|
||||
@@ -96,31 +96,31 @@ suite('vscode API - workspace', () => {
|
||||
test('openTextDocument, untitled with host', function () {
|
||||
const uri = vscode.Uri.parse('untitled://localhost/c%24/Users/jrieken/code/samples/foobar.txt');
|
||||
return vscode.workspace.openTextDocument(uri).then(doc => {
|
||||
assert.equal(doc.uri.scheme, 'untitled');
|
||||
assert.strictEqual(doc.uri.scheme, 'untitled');
|
||||
});
|
||||
});
|
||||
|
||||
test('openTextDocument, untitled without path', function () {
|
||||
return vscode.workspace.openTextDocument().then(doc => {
|
||||
assert.equal(doc.uri.scheme, 'untitled');
|
||||
assert.strictEqual(doc.uri.scheme, 'untitled');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
});
|
||||
|
||||
test('openTextDocument, untitled without path but language ID', function () {
|
||||
return vscode.workspace.openTextDocument({ language: 'xml' }).then(doc => {
|
||||
assert.equal(doc.uri.scheme, 'untitled');
|
||||
assert.equal(doc.languageId, 'xml');
|
||||
assert.strictEqual(doc.uri.scheme, 'untitled');
|
||||
assert.strictEqual(doc.languageId, 'xml');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
});
|
||||
|
||||
test('openTextDocument, untitled without path but language ID and content', function () {
|
||||
return vscode.workspace.openTextDocument({ language: 'html', content: '<h1>Hello world!</h1>' }).then(doc => {
|
||||
assert.equal(doc.uri.scheme, 'untitled');
|
||||
assert.equal(doc.languageId, 'html');
|
||||
assert.strictEqual(doc.uri.scheme, 'untitled');
|
||||
assert.strictEqual(doc.languageId, 'html');
|
||||
assert.ok(doc.isDirty);
|
||||
assert.equal(doc.getText(), '<h1>Hello world!</h1>');
|
||||
assert.strictEqual(doc.getText(), '<h1>Hello world!</h1>');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -128,7 +128,7 @@ suite('vscode API - workspace', () => {
|
||||
const path = join(vscode.workspace.rootPath || '', './newfile.txt');
|
||||
|
||||
return vscode.workspace.openTextDocument(vscode.Uri.parse('untitled:' + path)).then(doc => {
|
||||
assert.equal(doc.uri.scheme, 'untitled');
|
||||
assert.strictEqual(doc.uri.scheme, 'untitled');
|
||||
assert.ok(doc.isDirty);
|
||||
|
||||
let closed: vscode.TextDocument;
|
||||
@@ -137,7 +137,7 @@ suite('vscode API - workspace', () => {
|
||||
return vscode.window.showTextDocument(doc).then(() => {
|
||||
return doc.save().then((didSave: boolean) => {
|
||||
|
||||
assert.equal(didSave, true, `FAILED to save${doc.uri.toString()}`);
|
||||
assert.strictEqual(didSave, true, `FAILED to save${doc.uri.toString()}`);
|
||||
|
||||
assert.ok(closed === doc);
|
||||
assert.ok(!doc.isDirty);
|
||||
@@ -161,16 +161,16 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
return Promise.all([
|
||||
vscode.workspace.openTextDocument(vscode.Uri.parse('sc://auth')).then(doc => {
|
||||
assert.equal(doc.uri.authority, 'auth');
|
||||
assert.equal(doc.uri.path, '');
|
||||
assert.strictEqual(doc.uri.authority, 'auth');
|
||||
assert.strictEqual(doc.uri.path, '');
|
||||
}),
|
||||
vscode.workspace.openTextDocument(vscode.Uri.parse('sc:///path')).then(doc => {
|
||||
assert.equal(doc.uri.authority, '');
|
||||
assert.equal(doc.uri.path, '/path');
|
||||
assert.strictEqual(doc.uri.authority, '');
|
||||
assert.strictEqual(doc.uri.path, '/path');
|
||||
}),
|
||||
vscode.workspace.openTextDocument(vscode.Uri.parse('sc://auth/path')).then(doc => {
|
||||
assert.equal(doc.uri.authority, 'auth');
|
||||
assert.equal(doc.uri.path, '/path');
|
||||
assert.strictEqual(doc.uri.authority, 'auth');
|
||||
assert.strictEqual(doc.uri.path, '/path');
|
||||
})
|
||||
]).then(() => {
|
||||
registration.dispose();
|
||||
@@ -192,21 +192,21 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
// lower case (actual case) comes first
|
||||
let docOne = await vscode.workspace.openTextDocument(uriOne);
|
||||
assert.equal(docOne.uri.toString(), uriOne.toString());
|
||||
assert.strictEqual(docOne.uri.toString(), uriOne.toString());
|
||||
|
||||
let docONE = await vscode.workspace.openTextDocument(uriONE);
|
||||
assert.equal(docONE === docOne, true);
|
||||
assert.equal(docONE.uri.toString(), uriOne.toString());
|
||||
assert.equal(docONE.uri.toString() !== uriONE.toString(), true); // yep
|
||||
assert.strictEqual(docONE === docOne, true);
|
||||
assert.strictEqual(docONE.uri.toString(), uriOne.toString());
|
||||
assert.strictEqual(docONE.uri.toString() !== uriONE.toString(), true); // yep
|
||||
|
||||
// upper case (NOT the actual case) comes first
|
||||
let docTWO = await vscode.workspace.openTextDocument(uriTWO);
|
||||
assert.equal(docTWO.uri.toString(), uriTWO.toString());
|
||||
assert.strictEqual(docTWO.uri.toString(), uriTWO.toString());
|
||||
|
||||
let docTwo = await vscode.workspace.openTextDocument(uriTwo);
|
||||
assert.equal(docTWO === docTwo, true);
|
||||
assert.equal(docTwo.uri.toString(), uriTWO.toString());
|
||||
assert.equal(docTwo.uri.toString() !== uriTwo.toString(), true); // yep
|
||||
assert.strictEqual(docTWO === docTwo, true);
|
||||
assert.strictEqual(docTwo.uri.toString(), uriTWO.toString());
|
||||
assert.strictEqual(docTwo.uri.toString() !== uriTwo.toString(), true); // yep
|
||||
|
||||
reg.dispose();
|
||||
});
|
||||
@@ -214,17 +214,17 @@ suite('vscode API - workspace', () => {
|
||||
test('eol, read', () => {
|
||||
const a = createRandomFile('foo\nbar\nbar').then(file => {
|
||||
return vscode.workspace.openTextDocument(file).then(doc => {
|
||||
assert.equal(doc.eol, vscode.EndOfLine.LF);
|
||||
assert.strictEqual(doc.eol, vscode.EndOfLine.LF);
|
||||
});
|
||||
});
|
||||
const b = createRandomFile('foo\nbar\nbar\r\nbaz').then(file => {
|
||||
return vscode.workspace.openTextDocument(file).then(doc => {
|
||||
assert.equal(doc.eol, vscode.EndOfLine.LF);
|
||||
assert.strictEqual(doc.eol, vscode.EndOfLine.LF);
|
||||
});
|
||||
});
|
||||
const c = createRandomFile('foo\r\nbar\r\nbar').then(file => {
|
||||
return vscode.workspace.openTextDocument(file).then(doc => {
|
||||
assert.equal(doc.eol, vscode.EndOfLine.CRLF);
|
||||
assert.strictEqual(doc.eol, vscode.EndOfLine.CRLF);
|
||||
});
|
||||
});
|
||||
return Promise.all([a, b, c]);
|
||||
@@ -233,14 +233,14 @@ suite('vscode API - workspace', () => {
|
||||
test('eol, change via editor', () => {
|
||||
return createRandomFile('foo\nbar\nbar').then(file => {
|
||||
return vscode.workspace.openTextDocument(file).then(doc => {
|
||||
assert.equal(doc.eol, vscode.EndOfLine.LF);
|
||||
assert.strictEqual(doc.eol, vscode.EndOfLine.LF);
|
||||
return vscode.window.showTextDocument(doc).then(editor => {
|
||||
return editor.edit(builder => builder.setEndOfLine(vscode.EndOfLine.CRLF));
|
||||
|
||||
}).then(value => {
|
||||
assert.ok(value);
|
||||
assert.ok(doc.isDirty);
|
||||
assert.equal(doc.eol, vscode.EndOfLine.CRLF);
|
||||
assert.strictEqual(doc.eol, vscode.EndOfLine.CRLF);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -249,14 +249,14 @@ suite('vscode API - workspace', () => {
|
||||
test('eol, change via applyEdit', () => {
|
||||
return createRandomFile('foo\nbar\nbar').then(file => {
|
||||
return vscode.workspace.openTextDocument(file).then(doc => {
|
||||
assert.equal(doc.eol, vscode.EndOfLine.LF);
|
||||
assert.strictEqual(doc.eol, vscode.EndOfLine.LF);
|
||||
|
||||
const edit = new vscode.WorkspaceEdit();
|
||||
edit.set(file, [vscode.TextEdit.setEndOfLine(vscode.EndOfLine.CRLF)]);
|
||||
return vscode.workspace.applyEdit(edit).then(value => {
|
||||
assert.ok(value);
|
||||
assert.ok(doc.isDirty);
|
||||
assert.equal(doc.eol, vscode.EndOfLine.CRLF);
|
||||
assert.strictEqual(doc.eol, vscode.EndOfLine.CRLF);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -271,7 +271,7 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
const file = await createRandomFile('foo\r\nbar\r\nbar');
|
||||
const doc = await vscode.workspace.openTextDocument(file);
|
||||
assert.equal(doc.eol, vscode.EndOfLine.CRLF);
|
||||
assert.strictEqual(doc.eol, vscode.EndOfLine.CRLF);
|
||||
|
||||
const edit = new vscode.WorkspaceEdit();
|
||||
edit.set(file, [vscode.TextEdit.insert(new vscode.Position(0, 0), '-changes-')]);
|
||||
@@ -282,7 +282,7 @@ suite('vscode API - workspace', () => {
|
||||
assert.ok(successSave);
|
||||
assert.ok(called);
|
||||
assert.ok(!doc.isDirty);
|
||||
assert.equal(doc.eol, vscode.EndOfLine.LF);
|
||||
assert.strictEqual(doc.eol, vscode.EndOfLine.LF);
|
||||
sub.dispose();
|
||||
});
|
||||
|
||||
@@ -358,10 +358,10 @@ suite('vscode API - workspace', () => {
|
||||
return createRandomFile('foo\nbar\nbar').then(file => {
|
||||
return vscode.workspace.openTextDocument(file).then(doc => {
|
||||
return vscode.window.showTextDocument(doc, { selection: new vscode.Range(new vscode.Position(1, 1), new vscode.Position(1, 2)) }).then(editor => {
|
||||
assert.equal(editor.selection.start.line, 1);
|
||||
assert.equal(editor.selection.start.character, 1);
|
||||
assert.equal(editor.selection.end.line, 1);
|
||||
assert.equal(editor.selection.end.character, 2);
|
||||
assert.strictEqual(editor.selection.start.line, 1);
|
||||
assert.strictEqual(editor.selection.start.character, 1);
|
||||
assert.strictEqual(editor.selection.end.line, 1);
|
||||
assert.strictEqual(editor.selection.end.character, 2);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -377,9 +377,9 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
const uri = vscode.Uri.parse('foo://testing/virtual.js');
|
||||
return vscode.workspace.openTextDocument(uri).then(doc => {
|
||||
assert.equal(doc.getText(), uri.toString());
|
||||
assert.equal(doc.isDirty, false);
|
||||
assert.equal(doc.uri.toString(), uri.toString());
|
||||
assert.strictEqual(doc.getText(), uri.toString());
|
||||
assert.strictEqual(doc.isDirty, false);
|
||||
assert.strictEqual(doc.uri.toString(), uri.toString());
|
||||
registration.dispose();
|
||||
});
|
||||
});
|
||||
@@ -424,8 +424,8 @@ suite('vscode API - workspace', () => {
|
||||
});
|
||||
|
||||
return Promise.all([
|
||||
vscode.workspace.openTextDocument(vscode.Uri.parse('foo://foo/bla')).then(doc => { assert.equal(doc.getText(), '1'); }),
|
||||
vscode.workspace.openTextDocument(vscode.Uri.parse('foo://bar/bla')).then(doc => { assert.equal(doc.getText(), '2'); })
|
||||
vscode.workspace.openTextDocument(vscode.Uri.parse('foo://foo/bla')).then(doc => { assert.strictEqual(doc.getText(), '1'); }),
|
||||
vscode.workspace.openTextDocument(vscode.Uri.parse('foo://bar/bla')).then(doc => { assert.strictEqual(doc.getText(), '2'); })
|
||||
]).then(() => {
|
||||
registration1.dispose();
|
||||
registration2.dispose();
|
||||
@@ -447,7 +447,7 @@ suite('vscode API - workspace', () => {
|
||||
});
|
||||
|
||||
return vscode.workspace.openTextDocument(vscode.Uri.parse('foo://foo/bla')).then(doc => {
|
||||
assert.equal(doc.getText(), '1');
|
||||
assert.strictEqual(doc.getText(), '1');
|
||||
registration1.dispose();
|
||||
registration2.dispose();
|
||||
});
|
||||
@@ -480,7 +480,7 @@ suite('vscode API - workspace', () => {
|
||||
return vscode.window.showTextDocument(doc).then(editor => {
|
||||
|
||||
assert.ok(editor.document === doc);
|
||||
assert.equal(editor.document.getText(), 'I am virtual');
|
||||
assert.strictEqual(editor.document.getText(), 'I am virtual');
|
||||
registration.dispose();
|
||||
});
|
||||
});
|
||||
@@ -502,7 +502,7 @@ suite('vscode API - workspace', () => {
|
||||
let [first, second] = docs;
|
||||
assert.ok(first === second);
|
||||
assert.ok(vscode.workspace.textDocuments.some(doc => doc.uri.toString() === uri.toString()));
|
||||
assert.equal(callCount, 1);
|
||||
assert.strictEqual(callCount, 1);
|
||||
registration.dispose();
|
||||
});
|
||||
});
|
||||
@@ -518,8 +518,8 @@ suite('vscode API - workspace', () => {
|
||||
const uri = vscode.Uri.parse('foo:doc/empty');
|
||||
|
||||
return vscode.workspace.openTextDocument(uri).then(doc => {
|
||||
assert.equal(doc.getText(), '');
|
||||
assert.equal(doc.uri.toString(), uri.toString());
|
||||
assert.strictEqual(doc.getText(), '');
|
||||
assert.strictEqual(doc.uri.toString(), uri.toString());
|
||||
registration.dispose();
|
||||
});
|
||||
});
|
||||
@@ -539,14 +539,14 @@ suite('vscode API - workspace', () => {
|
||||
const uri = vscode.Uri.parse('foo://testing/path3');
|
||||
const doc = await vscode.workspace.openTextDocument(uri);
|
||||
|
||||
assert.equal(callCount, 1);
|
||||
assert.equal(doc.getText(), 'call0');
|
||||
assert.strictEqual(callCount, 1);
|
||||
assert.strictEqual(doc.getText(), 'call0');
|
||||
|
||||
return new Promise<void>(resolve => {
|
||||
|
||||
let subscription = vscode.workspace.onDidChangeTextDocument(event => {
|
||||
assert.ok(event.document === doc);
|
||||
assert.equal(event.document.getText(), 'call1');
|
||||
assert.strictEqual(event.document.getText(), 'call1');
|
||||
subscription.dispose();
|
||||
registration.dispose();
|
||||
resolve();
|
||||
@@ -558,36 +558,36 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
test('findFiles', () => {
|
||||
return vscode.workspace.findFiles('**/image.png').then((res) => {
|
||||
assert.equal(res.length, 2);
|
||||
assert.equal(basename(vscode.workspace.asRelativePath(res[0])), 'image.png');
|
||||
assert.strictEqual(res.length, 2);
|
||||
assert.strictEqual(basename(vscode.workspace.asRelativePath(res[0])), 'image.png');
|
||||
});
|
||||
});
|
||||
|
||||
test('findFiles - null exclude', async () => {
|
||||
await vscode.workspace.findFiles('**/file.txt').then((res) => {
|
||||
// search.exclude folder is still searched, files.exclude folder is not
|
||||
assert.equal(res.length, 1);
|
||||
assert.equal(basename(vscode.workspace.asRelativePath(res[0])), 'file.txt');
|
||||
assert.strictEqual(res.length, 1);
|
||||
assert.strictEqual(basename(vscode.workspace.asRelativePath(res[0])), 'file.txt');
|
||||
});
|
||||
|
||||
await vscode.workspace.findFiles('**/file.txt', null).then((res) => {
|
||||
// search.exclude and files.exclude folders are both searched
|
||||
assert.equal(res.length, 2);
|
||||
assert.equal(basename(vscode.workspace.asRelativePath(res[0])), 'file.txt');
|
||||
assert.strictEqual(res.length, 2);
|
||||
assert.strictEqual(basename(vscode.workspace.asRelativePath(res[0])), 'file.txt');
|
||||
});
|
||||
});
|
||||
|
||||
test('findFiles - exclude', () => {
|
||||
return vscode.workspace.findFiles('**/image.png').then((res) => {
|
||||
assert.equal(res.length, 2);
|
||||
assert.equal(basename(vscode.workspace.asRelativePath(res[0])), 'image.png');
|
||||
assert.strictEqual(res.length, 2);
|
||||
assert.strictEqual(basename(vscode.workspace.asRelativePath(res[0])), 'image.png');
|
||||
});
|
||||
});
|
||||
|
||||
test('findFiles, exclude', () => {
|
||||
return vscode.workspace.findFiles('**/image.png', '**/sub/**').then((res) => {
|
||||
assert.equal(res.length, 1);
|
||||
assert.equal(basename(vscode.workspace.asRelativePath(res[0])), 'image.png');
|
||||
assert.strictEqual(res.length, 1);
|
||||
assert.strictEqual(basename(vscode.workspace.asRelativePath(res[0])), 'image.png');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -598,7 +598,7 @@ suite('vscode API - workspace', () => {
|
||||
source.cancel();
|
||||
|
||||
return vscode.workspace.findFiles('*.js', null, 100, token).then((res) => {
|
||||
assert.deepEqual(res, []);
|
||||
assert.deepStrictEqual(res, []);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -616,10 +616,10 @@ suite('vscode API - workspace', () => {
|
||||
results.push(result);
|
||||
});
|
||||
|
||||
assert.equal(results.length, 1);
|
||||
assert.strictEqual(results.length, 1);
|
||||
const match = <vscode.TextSearchMatch>results[0];
|
||||
assert(match.preview.text.indexOf('foo') >= 0);
|
||||
assert.equal(basename(vscode.workspace.asRelativePath(match.uri)), '10linefile.ts');
|
||||
assert.strictEqual(basename(vscode.workspace.asRelativePath(match.uri)), '10linefile.ts');
|
||||
});
|
||||
|
||||
test('findTextInFiles, cancellation', async () => {
|
||||
@@ -639,8 +639,8 @@ suite('vscode API - workspace', () => {
|
||||
edit.insert(doc.uri, new vscode.Position(0, 0), new Array(1000).join('Hello World'));
|
||||
|
||||
let success = await vscode.workspace.applyEdit(edit);
|
||||
assert.equal(success, true);
|
||||
assert.equal(doc.isDirty, true);
|
||||
assert.strictEqual(success, true);
|
||||
assert.strictEqual(doc.isDirty, true);
|
||||
});
|
||||
|
||||
test('applyEdit should fail when editing deleted resource', withLogDisabled(async () => {
|
||||
@@ -651,7 +651,7 @@ suite('vscode API - workspace', () => {
|
||||
edit.insert(resource, new vscode.Position(0, 0), '');
|
||||
|
||||
let success = await vscode.workspace.applyEdit(edit);
|
||||
assert.equal(success, false);
|
||||
assert.strictEqual(success, false);
|
||||
}));
|
||||
|
||||
test('applyEdit should fail when renaming deleted resource', withLogDisabled(async () => {
|
||||
@@ -662,7 +662,7 @@ suite('vscode API - workspace', () => {
|
||||
edit.renameFile(resource, resource);
|
||||
|
||||
let success = await vscode.workspace.applyEdit(edit);
|
||||
assert.equal(success, false);
|
||||
assert.strictEqual(success, false);
|
||||
}));
|
||||
|
||||
test('applyEdit should fail when editing renamed from resource', withLogDisabled(async () => {
|
||||
@@ -673,7 +673,7 @@ suite('vscode API - workspace', () => {
|
||||
edit.insert(resource, new vscode.Position(0, 0), '');
|
||||
|
||||
let success = await vscode.workspace.applyEdit(edit);
|
||||
assert.equal(success, false);
|
||||
assert.strictEqual(success, false);
|
||||
}));
|
||||
|
||||
test('applyEdit "edit A -> rename A to B -> edit B"', async () => {
|
||||
@@ -699,8 +699,8 @@ suite('vscode API - workspace', () => {
|
||||
assert.ok(await vscode.workspace.applyEdit(edit));
|
||||
|
||||
let doc = await vscode.workspace.openTextDocument(newUri);
|
||||
assert.equal(doc.getText(), 'AFTERBEFORE');
|
||||
assert.equal(doc.isDirty, true);
|
||||
assert.strictEqual(doc.getText(), 'AFTERBEFORE');
|
||||
assert.strictEqual(doc.isDirty, true);
|
||||
}
|
||||
|
||||
function nameWithUnderscore(uri: vscode.Uri) {
|
||||
@@ -719,7 +719,7 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
assert.ok(await vscode.workspace.applyEdit(we));
|
||||
let doc = await vscode.workspace.openTextDocument(newUri);
|
||||
assert.equal(doc.getText(), 'BarHelloFoo');
|
||||
assert.strictEqual(doc.getText(), 'BarHelloFoo');
|
||||
}));
|
||||
|
||||
test('WorkspaceEdit: Problem recreating a renamed resource #42634', withLogDisabled(async function () {
|
||||
@@ -737,9 +737,9 @@ suite('vscode API - workspace', () => {
|
||||
assert.ok(await vscode.workspace.applyEdit(we));
|
||||
|
||||
let newDoc = await vscode.workspace.openTextDocument(newUri);
|
||||
assert.equal(newDoc.getText(), 'HelloFoo');
|
||||
assert.strictEqual(newDoc.getText(), 'HelloFoo');
|
||||
let doc = await vscode.workspace.openTextDocument(docUri);
|
||||
assert.equal(doc.getText(), 'Bar');
|
||||
assert.strictEqual(doc.getText(), 'Bar');
|
||||
}));
|
||||
|
||||
test('WorkspaceEdit api - after saving a deleted file, it still shows up as deleted. #42667', withLogDisabled(async function () {
|
||||
@@ -783,7 +783,7 @@ suite('vscode API - workspace', () => {
|
||||
let doc = await vscode.workspace.openTextDocument(newUri);
|
||||
assert.ok(doc);
|
||||
|
||||
assert.equal(doc.getText(), 'Hello');
|
||||
assert.strictEqual(doc.getText(), 'Hello');
|
||||
});
|
||||
|
||||
test('WorkspaceEdit: rename resource followed by edit does not work #42638', withLogDisabled(async function () {
|
||||
@@ -797,7 +797,7 @@ suite('vscode API - workspace', () => {
|
||||
assert.ok(await vscode.workspace.applyEdit(we));
|
||||
|
||||
let doc = await vscode.workspace.openTextDocument(newUri);
|
||||
assert.equal(doc.getText(), 'Hello');
|
||||
assert.strictEqual(doc.getText(), 'Hello');
|
||||
}));
|
||||
|
||||
test('WorkspaceEdit: create & override', withLogDisabled(async function () {
|
||||
@@ -807,12 +807,12 @@ suite('vscode API - workspace', () => {
|
||||
let we = new vscode.WorkspaceEdit();
|
||||
we.createFile(docUri);
|
||||
assert.ok(!await vscode.workspace.applyEdit(we));
|
||||
assert.equal((await vscode.workspace.openTextDocument(docUri)).getText(), 'before');
|
||||
assert.strictEqual((await vscode.workspace.openTextDocument(docUri)).getText(), 'before');
|
||||
|
||||
we = new vscode.WorkspaceEdit();
|
||||
we.createFile(docUri, { overwrite: true });
|
||||
assert.ok(await vscode.workspace.applyEdit(we));
|
||||
assert.equal((await vscode.workspace.openTextDocument(docUri)).getText(), '');
|
||||
assert.strictEqual((await vscode.workspace.openTextDocument(docUri)).getText(), '');
|
||||
}));
|
||||
|
||||
test('WorkspaceEdit: create & ignoreIfExists', withLogDisabled(async function () {
|
||||
@@ -821,12 +821,12 @@ suite('vscode API - workspace', () => {
|
||||
let we = new vscode.WorkspaceEdit();
|
||||
we.createFile(docUri, { ignoreIfExists: true });
|
||||
assert.ok(await vscode.workspace.applyEdit(we));
|
||||
assert.equal((await vscode.workspace.openTextDocument(docUri)).getText(), 'before');
|
||||
assert.strictEqual((await vscode.workspace.openTextDocument(docUri)).getText(), 'before');
|
||||
|
||||
we = new vscode.WorkspaceEdit();
|
||||
we.createFile(docUri, { overwrite: true, ignoreIfExists: true });
|
||||
assert.ok(await vscode.workspace.applyEdit(we));
|
||||
assert.equal((await vscode.workspace.openTextDocument(docUri)).getText(), '');
|
||||
assert.strictEqual((await vscode.workspace.openTextDocument(docUri)).getText(), '');
|
||||
}));
|
||||
|
||||
test('WorkspaceEdit: rename & ignoreIfExists', withLogDisabled(async function () {
|
||||
@@ -880,9 +880,9 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
assert.ok(await vscode.workspace.applyEdit(we));
|
||||
|
||||
assert.equal((await vscode.workspace.openTextDocument(f3)).getText(), 'f3');
|
||||
assert.equal((await vscode.workspace.openTextDocument(f2)).getText(), 'f2');
|
||||
assert.equal((await vscode.workspace.openTextDocument(f1_)).getText(), 'f1');
|
||||
assert.strictEqual((await vscode.workspace.openTextDocument(f3)).getText(), 'f3');
|
||||
assert.strictEqual((await vscode.workspace.openTextDocument(f2)).getText(), 'f2');
|
||||
assert.strictEqual((await vscode.workspace.openTextDocument(f1_)).getText(), 'f1');
|
||||
try {
|
||||
await vscode.workspace.fs.stat(f1);
|
||||
assert.ok(false);
|
||||
@@ -932,12 +932,12 @@ suite('vscode API - workspace', () => {
|
||||
assert.ok(await vscode.workspace.applyEdit(we));
|
||||
|
||||
const document = await vscode.workspace.openTextDocument(newUri);
|
||||
assert.equal(document.isDirty, true);
|
||||
assert.strictEqual(document.isDirty, true);
|
||||
|
||||
await document.save();
|
||||
assert.equal(document.isDirty, false);
|
||||
assert.strictEqual(document.isDirty, false);
|
||||
|
||||
assert.equal(document.getText(), expected);
|
||||
assert.strictEqual(document.getText(), expected);
|
||||
|
||||
await delay(10);
|
||||
}
|
||||
@@ -959,7 +959,7 @@ suite('vscode API - workspace', () => {
|
||||
const document = await vscode.workspace.openTextDocument(file1);
|
||||
// const expected = 'import1;import2;';
|
||||
const expected2 = 'import2;import1;';
|
||||
assert.equal(document.getText(), expected2);
|
||||
assert.strictEqual(document.getText(), expected2);
|
||||
});
|
||||
|
||||
test('The api workspace.applyEdit failed for some case of mixing resourceChange and textEdit #80688', async function () {
|
||||
@@ -978,7 +978,7 @@ suite('vscode API - workspace', () => {
|
||||
const document = await vscode.workspace.openTextDocument(file1);
|
||||
const expected = 'import1;import2;';
|
||||
// const expected2 = 'import2;import1;';
|
||||
assert.equal(document.getText(), expected);
|
||||
assert.strictEqual(document.getText(), expected);
|
||||
});
|
||||
|
||||
test('Should send a single FileWillRenameEvent instead of separate events when moving multiple files at once#111867', async function () {
|
||||
@@ -1073,8 +1073,8 @@ suite('vscode API - workspace', () => {
|
||||
{
|
||||
const document = await vscode.workspace.openTextDocument(newFile);
|
||||
await vscode.window.showTextDocument(document);
|
||||
assert.equal(document.getText(), 'hello2');
|
||||
assert.equal(document.isDirty, true);
|
||||
assert.strictEqual(document.getText(), 'hello2');
|
||||
assert.strictEqual(document.isDirty, true);
|
||||
}
|
||||
|
||||
// undo and show the old document
|
||||
@@ -1082,7 +1082,7 @@ suite('vscode API - workspace', () => {
|
||||
await vscode.commands.executeCommand('undo');
|
||||
const document = await vscode.workspace.openTextDocument(file);
|
||||
await vscode.window.showTextDocument(document);
|
||||
assert.equal(document.getText(), 'hello');
|
||||
assert.strictEqual(document.getText(), 'hello');
|
||||
}
|
||||
|
||||
// redo and show the new document
|
||||
@@ -1090,8 +1090,8 @@ suite('vscode API - workspace', () => {
|
||||
await vscode.commands.executeCommand('redo');
|
||||
const document = await vscode.workspace.openTextDocument(newFile);
|
||||
await vscode.window.showTextDocument(document);
|
||||
assert.equal(document.getText(), 'hello2');
|
||||
assert.equal(document.isDirty, true);
|
||||
assert.strictEqual(document.getText(), 'hello2');
|
||||
assert.strictEqual(document.isDirty, true);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1111,8 +1111,8 @@ suite('vscode API - workspace', () => {
|
||||
|
||||
// check the document
|
||||
{
|
||||
assert.equal(document.getText(), 'hello2\nworld');
|
||||
assert.equal(document.isDirty, true);
|
||||
assert.strictEqual(document.getText(), 'hello2\nworld');
|
||||
assert.strictEqual(document.isDirty, true);
|
||||
}
|
||||
|
||||
// apply no-op edit
|
||||
@@ -1125,8 +1125,8 @@ suite('vscode API - workspace', () => {
|
||||
// undo
|
||||
{
|
||||
await vscode.commands.executeCommand('undo');
|
||||
assert.equal(document.getText(), 'hello\nworld');
|
||||
assert.equal(document.isDirty, false);
|
||||
assert.strictEqual(document.getText(), 'hello\nworld');
|
||||
assert.strictEqual(document.isDirty, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user