mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
auto-fixed prefer-const violation
This commit is contained in:
@@ -183,7 +183,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
// --- workspace symbols
|
||||
|
||||
test('WorkspaceSymbols, invalid arguments', function () {
|
||||
let promises = [
|
||||
const promises = [
|
||||
assertRejects(() => commands.executeCommand('vscode.executeWorkspaceSymbolProvider')),
|
||||
assertRejects(() => commands.executeCommand('vscode.executeWorkspaceSymbolProvider', null)),
|
||||
assertRejects(() => commands.executeCommand('vscode.executeWorkspaceSymbolProvider', undefined)),
|
||||
@@ -215,7 +215,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
return commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeWorkspaceSymbolProvider', 'testing').then(value => {
|
||||
|
||||
assert.strictEqual(value.length, 2); // de-duped
|
||||
for (let info of value) {
|
||||
for (const info of value) {
|
||||
assert.strictEqual(info instanceof types.SymbolInformation, true);
|
||||
assert.strictEqual(info.name, 'testing');
|
||||
assert.strictEqual(info.kind, types.SymbolKind.Array);
|
||||
@@ -251,7 +251,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let edits = await commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeFormatDocumentProvider', model.uri);
|
||||
const edits = await commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeFormatDocumentProvider', model.uri);
|
||||
assert.strictEqual(edits.length, 1);
|
||||
});
|
||||
|
||||
@@ -310,7 +310,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
// --- definition
|
||||
|
||||
test('Definition, invalid arguments', function () {
|
||||
let promises = [
|
||||
const promises = [
|
||||
assertRejects(() => commands.executeCommand('vscode.executeDefinitionProvider')),
|
||||
assertRejects(() => commands.executeCommand('vscode.executeDefinitionProvider', null)),
|
||||
assertRejects(() => commands.executeCommand('vscode.executeDefinitionProvider', undefined)),
|
||||
@@ -346,7 +346,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.strictEqual(values.length, 4);
|
||||
for (let v of values) {
|
||||
for (const v of values) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
assert.ok(v.range instanceof types.Range);
|
||||
}
|
||||
@@ -403,7 +403,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.strictEqual(values.length, 2);
|
||||
for (let v of values) {
|
||||
for (const v of values) {
|
||||
if (isLocation(v)) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
assert.ok(v.range instanceof types.Range);
|
||||
@@ -446,7 +446,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.strictEqual(values.length, 4);
|
||||
for (let v of values) {
|
||||
for (const v of values) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
assert.ok(v.range instanceof types.Range);
|
||||
}
|
||||
@@ -467,7 +467,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.strictEqual(values.length, 2);
|
||||
for (let v of values) {
|
||||
for (const v of values) {
|
||||
if (isLocation(v)) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
assert.ok(v.range instanceof types.Range);
|
||||
@@ -542,7 +542,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.strictEqual(values.length, 2);
|
||||
for (let v of values) {
|
||||
for (const v of values) {
|
||||
if (isLocation(v)) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
assert.ok(v.range instanceof types.Range);
|
||||
@@ -617,7 +617,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.strictEqual(values.length, 2);
|
||||
for (let v of values) {
|
||||
for (const v of values) {
|
||||
if (isLocation(v)) {
|
||||
assert.ok(v.uri instanceof URI);
|
||||
assert.ok(v.range instanceof types.Range);
|
||||
@@ -646,7 +646,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
return commands.executeCommand<vscode.Location[]>('vscode.executeReferenceProvider', model.uri, new types.Position(0, 0)).then(values => {
|
||||
assert.strictEqual(values.length, 1);
|
||||
let [first] = values;
|
||||
const [first] = values;
|
||||
assert.strictEqual(first.uri.toString(), 'some:uri/path');
|
||||
assert.strictEqual(first.range.start.line, 0);
|
||||
assert.strictEqual(first.range.start.character, 1);
|
||||
@@ -670,7 +670,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeDocumentSymbolProvider', model.uri).then(values => {
|
||||
assert.strictEqual(values.length, 2);
|
||||
let [first, second] = values;
|
||||
const [first, second] = values;
|
||||
assert.strictEqual(first instanceof types.SymbolInformation, true);
|
||||
assert.strictEqual(second instanceof types.SymbolInformation, true);
|
||||
assert.strictEqual(first.name, 'testing2');
|
||||
@@ -689,7 +689,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
}));
|
||||
disposables.push(extHost.registerDocumentSymbolProvider(nullExtensionDescription, defaultSelector, <vscode.DocumentSymbolProvider>{
|
||||
provideDocumentSymbols(): any {
|
||||
let root = new types.DocumentSymbol('DocumentSymbol', 'DocumentSymbol#detail', types.SymbolKind.Enum, new types.Range(1, 0, 1, 0), new types.Range(1, 0, 1, 0));
|
||||
const root = new types.DocumentSymbol('DocumentSymbol', 'DocumentSymbol#detail', types.SymbolKind.Enum, new types.Range(1, 0, 1, 0), new types.Range(1, 0, 1, 0));
|
||||
root.children = [new types.DocumentSymbol('DocumentSymbol#child', 'DocumentSymbol#detail#child', types.SymbolKind.Enum, new types.Range(1, 0, 1, 0), new types.Range(1, 0, 1, 0))];
|
||||
return [root];
|
||||
}
|
||||
@@ -698,7 +698,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<(vscode.SymbolInformation & vscode.DocumentSymbol)[]>('vscode.executeDocumentSymbolProvider', model.uri).then(values => {
|
||||
assert.strictEqual(values.length, 2);
|
||||
let [first, second] = values;
|
||||
const [first, second] = values;
|
||||
assert.strictEqual(first instanceof types.SymbolInformation, true);
|
||||
assert.strictEqual(first instanceof types.DocumentSymbol, false);
|
||||
assert.strictEqual(second instanceof types.SymbolInformation, true);
|
||||
@@ -714,14 +714,14 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
test('Suggest, back and forth', function () {
|
||||
disposables.push(extHost.registerCompletionItemProvider(nullExtensionDescription, defaultSelector, <vscode.CompletionItemProvider>{
|
||||
provideCompletionItems(): any {
|
||||
let a = new types.CompletionItem('item1');
|
||||
let b = new types.CompletionItem('item2');
|
||||
const a = new types.CompletionItem('item1');
|
||||
const b = new types.CompletionItem('item2');
|
||||
b.textEdit = types.TextEdit.replace(new types.Range(0, 4, 0, 8), 'foo'); // overwite after
|
||||
let c = new types.CompletionItem('item3');
|
||||
const c = new types.CompletionItem('item3');
|
||||
c.textEdit = types.TextEdit.replace(new types.Range(0, 1, 0, 6), 'foobar'); // overwite before & after
|
||||
|
||||
// snippet string!
|
||||
let d = new types.CompletionItem('item4');
|
||||
const d = new types.CompletionItem('item4');
|
||||
d.range = new types.Range(0, 1, 0, 4);// overwite before
|
||||
d.insertText = new types.SnippetString('foo$0bar');
|
||||
return [a, b, c, d];
|
||||
@@ -732,10 +732,10 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
return commands.executeCommand<vscode.CompletionList>('vscode.executeCompletionItemProvider', model.uri, new types.Position(0, 4)).then(list => {
|
||||
|
||||
assert.ok(list instanceof types.CompletionList);
|
||||
let values = list.items;
|
||||
const values = list.items;
|
||||
assert.ok(Array.isArray(values));
|
||||
assert.strictEqual(values.length, 4);
|
||||
let [first, second, third, fourth] = values;
|
||||
const [first, second, third, fourth] = values;
|
||||
assert.strictEqual(first.label, 'item1');
|
||||
assert.strictEqual(first.textEdit, undefined);// no text edit, default ranges
|
||||
assert.ok(!types.Range.isRange(first.range));
|
||||
@@ -772,8 +772,8 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
test('Suggest, return CompletionList !array', function () {
|
||||
disposables.push(extHost.registerCompletionItemProvider(nullExtensionDescription, defaultSelector, <vscode.CompletionItemProvider>{
|
||||
provideCompletionItems(): any {
|
||||
let a = new types.CompletionItem('item1');
|
||||
let b = new types.CompletionItem('item2');
|
||||
const a = new types.CompletionItem('item1');
|
||||
const b = new types.CompletionItem('item2');
|
||||
return new types.CompletionList(<any>[a, b], true);
|
||||
}
|
||||
}, []));
|
||||
@@ -792,10 +792,10 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
disposables.push(extHost.registerCompletionItemProvider(nullExtensionDescription, defaultSelector, <vscode.CompletionItemProvider>{
|
||||
provideCompletionItems(): any {
|
||||
let a = new types.CompletionItem('item1');
|
||||
let b = new types.CompletionItem('item2');
|
||||
let c = new types.CompletionItem('item3');
|
||||
let d = new types.CompletionItem('item4');
|
||||
const a = new types.CompletionItem('item1');
|
||||
const b = new types.CompletionItem('item2');
|
||||
const c = new types.CompletionItem('item3');
|
||||
const d = new types.CompletionItem('item4');
|
||||
return new types.CompletionList([a, b, c, d], false);
|
||||
},
|
||||
resolveCompletionItem(item) {
|
||||
@@ -806,7 +806,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
|
||||
let list = await commands.executeCommand<vscode.CompletionList>(
|
||||
const list = await commands.executeCommand<vscode.CompletionList>(
|
||||
'vscode.executeCompletionItemProvider',
|
||||
model.uri,
|
||||
new types.Position(0, 4),
|
||||
@@ -822,19 +822,19 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
test('"vscode.executeCompletionItemProvider" doesnot return a preselect field #53749', async function () {
|
||||
disposables.push(extHost.registerCompletionItemProvider(nullExtensionDescription, defaultSelector, <vscode.CompletionItemProvider>{
|
||||
provideCompletionItems(): any {
|
||||
let a = new types.CompletionItem('item1');
|
||||
const a = new types.CompletionItem('item1');
|
||||
a.preselect = true;
|
||||
let b = new types.CompletionItem('item2');
|
||||
let c = new types.CompletionItem('item3');
|
||||
const b = new types.CompletionItem('item2');
|
||||
const c = new types.CompletionItem('item3');
|
||||
c.preselect = true;
|
||||
let d = new types.CompletionItem('item4');
|
||||
const d = new types.CompletionItem('item4');
|
||||
return new types.CompletionList([a, b, c, d], false);
|
||||
}
|
||||
}, []));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
|
||||
let list = await commands.executeCommand<vscode.CompletionList>(
|
||||
const list = await commands.executeCommand<vscode.CompletionList>(
|
||||
'vscode.executeCompletionItemProvider',
|
||||
model.uri,
|
||||
new types.Position(0, 4),
|
||||
@@ -844,7 +844,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
assert.ok(list instanceof types.CompletionList);
|
||||
assert.strictEqual(list.items.length, 4);
|
||||
|
||||
let [a, b, c, d] = list.items;
|
||||
const [a, b, c, d] = list.items;
|
||||
assert.strictEqual(a.preselect, true);
|
||||
assert.strictEqual(b.preselect, undefined);
|
||||
assert.strictEqual(c.preselect, true);
|
||||
@@ -854,16 +854,16 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
test('executeCompletionItemProvider doesn\'t capture commitCharacters #58228', async function () {
|
||||
disposables.push(extHost.registerCompletionItemProvider(nullExtensionDescription, defaultSelector, <vscode.CompletionItemProvider>{
|
||||
provideCompletionItems(): any {
|
||||
let a = new types.CompletionItem('item1');
|
||||
const a = new types.CompletionItem('item1');
|
||||
a.commitCharacters = ['a', 'b'];
|
||||
let b = new types.CompletionItem('item2');
|
||||
const b = new types.CompletionItem('item2');
|
||||
return new types.CompletionList([a, b], false);
|
||||
}
|
||||
}, []));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
|
||||
let list = await commands.executeCommand<vscode.CompletionList>(
|
||||
const list = await commands.executeCommand<vscode.CompletionList>(
|
||||
'vscode.executeCompletionItemProvider',
|
||||
model.uri,
|
||||
new types.Position(0, 4),
|
||||
@@ -873,7 +873,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
assert.ok(list instanceof types.CompletionList);
|
||||
assert.strictEqual(list.items.length, 2);
|
||||
|
||||
let [a, b] = list.items;
|
||||
const [a, b] = list.items;
|
||||
assert.deepStrictEqual(a.commitCharacters, ['a', 'b']);
|
||||
assert.strictEqual(b.commitCharacters, undefined);
|
||||
});
|
||||
@@ -890,7 +890,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
|
||||
await rpcProtocol.sync();
|
||||
|
||||
let list = await commands.executeCommand<vscode.CompletionList>(
|
||||
const list = await commands.executeCommand<vscode.CompletionList>(
|
||||
'vscode.executeCompletionItemProvider',
|
||||
model.uri,
|
||||
new types.Position(0, 4),
|
||||
@@ -946,7 +946,7 @@ 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.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
const [first] = value;
|
||||
assert.strictEqual(first.title, 'Title');
|
||||
assert.strictEqual(first.command, 'testing');
|
||||
assert.deepStrictEqual(first.arguments, [1, 2, true]);
|
||||
@@ -1145,7 +1145,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.DocumentLink[]>('vscode.executeLinkProvider', model.uri).then(value => {
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
const [first] = value;
|
||||
|
||||
assert.strictEqual(first.target + '', 'foo:bar');
|
||||
assert.strictEqual(first.range.start.line, 0);
|
||||
@@ -1197,7 +1197,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
return rpcProtocol.sync().then(() => {
|
||||
return commands.executeCommand<vscode.ColorInformation[]>('vscode.executeDocumentColorProvider', model.uri).then(value => {
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
const [first] = value;
|
||||
|
||||
assert.strictEqual(first.color.red, 0.1);
|
||||
assert.strictEqual(first.color.green, 0.2);
|
||||
@@ -1213,7 +1213,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
const range = new types.Range(0, 0, 0, 20);
|
||||
return commands.executeCommand<vscode.ColorPresentation[]>('vscode.executeColorPresentationProvider', color, { uri: model.uri, range }).then(value => {
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
const [first] = value;
|
||||
|
||||
assert.strictEqual(first.label, '#ABC');
|
||||
assert.strictEqual(first.textEdit!.newText, '#ABC');
|
||||
@@ -1350,7 +1350,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await commands.executeCommand<vscode.SelectionRange[]>('vscode.executeSelectionRangeProvider', model.uri, [new types.Position(0, 10)]);
|
||||
const value = await commands.executeCommand<vscode.SelectionRange[]>('vscode.executeSelectionRangeProvider', model.uri, [new types.Position(0, 10)]);
|
||||
assert.strictEqual(value.length, 1);
|
||||
assert.ok(value[0].parent);
|
||||
});
|
||||
@@ -1466,7 +1466,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await commands.executeCommand<vscode.SelectionRange[]>('vscode.executeSelectionRangeProvider', model.uri, [new types.Position(0, 10)]);
|
||||
const value = await commands.executeCommand<vscode.SelectionRange[]>('vscode.executeSelectionRangeProvider', model.uri, [new types.Position(0, 10)]);
|
||||
assert.strictEqual(value.length, 1);
|
||||
assert.strictEqual(value[0].range.start.line, 0);
|
||||
assert.strictEqual(value[0].range.start.character, 10);
|
||||
@@ -1487,7 +1487,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await commands.executeCommand<vscode.SelectionRange[]>(
|
||||
const value = await commands.executeCommand<vscode.SelectionRange[]>(
|
||||
'vscode.executeSelectionRangeProvider',
|
||||
model.uri,
|
||||
[new types.Position(0, 0), new types.Position(0, 10)]
|
||||
|
||||
@@ -474,14 +474,14 @@ suite('ExtHostAuthentication', () => {
|
||||
});
|
||||
|
||||
test('Can get multiple sessions (from different providers) in one extension at the same time', async () => {
|
||||
let sessionP: Promise<AuthenticationSession | undefined> = extHostAuthentication.getSession(
|
||||
const sessionP: Promise<AuthenticationSession | undefined> = extHostAuthentication.getSession(
|
||||
extensionDescription,
|
||||
'test',
|
||||
['foo'],
|
||||
{
|
||||
createIfNone: true
|
||||
});
|
||||
let session2P: Promise<AuthenticationSession | undefined> = extHostAuthentication.getSession(
|
||||
const session2P: Promise<AuthenticationSession | undefined> = extHostAuthentication.getSession(
|
||||
extensionDescription,
|
||||
'test-multiple',
|
||||
['foo'],
|
||||
|
||||
@@ -22,7 +22,7 @@ suite('ExtHostBulkEdits.applyWorkspaceEdit', () => {
|
||||
setup(() => {
|
||||
workspaceResourceEdits = null!;
|
||||
|
||||
let rpcProtocol = new TestRPCProtocol();
|
||||
const rpcProtocol = new TestRPCProtocol();
|
||||
rpcProtocol.set(MainContext.MainThreadBulkEdits, new class extends mock<MainThreadBulkEditsShape>() {
|
||||
override $tryApplyWorkspaceEdit(_workspaceResourceEdits: IWorkspaceEditDto): Promise<boolean> {
|
||||
workspaceResourceEdits = _workspaceResourceEdits;
|
||||
@@ -44,7 +44,7 @@ suite('ExtHostBulkEdits.applyWorkspaceEdit', () => {
|
||||
});
|
||||
|
||||
test('uses version id if document available', async () => {
|
||||
let edit = new extHostTypes.WorkspaceEdit();
|
||||
const edit = new extHostTypes.WorkspaceEdit();
|
||||
edit.replace(resource, new extHostTypes.Range(0, 0, 0, 0), 'hello');
|
||||
await bulkEdits.applyWorkspaceEdit(edit);
|
||||
assert.strictEqual(workspaceResourceEdits.edits.length, 1);
|
||||
@@ -54,7 +54,7 @@ suite('ExtHostBulkEdits.applyWorkspaceEdit', () => {
|
||||
});
|
||||
|
||||
test('does not use version id if document is not available', async () => {
|
||||
let edit = new extHostTypes.WorkspaceEdit();
|
||||
const edit = new extHostTypes.WorkspaceEdit();
|
||||
edit.replace(URI.parse('foo:bar2'), new extHostTypes.Range(0, 0, 0, 0), 'hello');
|
||||
await bulkEdits.applyWorkspaceEdit(edit);
|
||||
assert.strictEqual(workspaceResourceEdits.edits.length, 1);
|
||||
|
||||
@@ -249,7 +249,7 @@ suite('ExtHostConfiguration', function () {
|
||||
}
|
||||
});
|
||||
|
||||
let testObject: any = all.getConfiguration();
|
||||
const testObject: any = all.getConfiguration();
|
||||
|
||||
try {
|
||||
testObject['get'] = null;
|
||||
@@ -614,7 +614,7 @@ suite('ExtHostConfiguration', function () {
|
||||
}
|
||||
}, shape);
|
||||
|
||||
let config = allConfig.getConfiguration('foo');
|
||||
const config = allConfig.getConfiguration('foo');
|
||||
config.update('bar', 42);
|
||||
|
||||
assert.strictEqual(shape.lastArgs[0], null);
|
||||
|
||||
@@ -18,7 +18,7 @@ suite('ExtHostDecorations', function () {
|
||||
|
||||
let mainThreadShape: MainThreadDecorationsShape;
|
||||
let extHostDecorations: ExtHostDecorations;
|
||||
let providers = new Set<number>();
|
||||
const providers = new Set<number>();
|
||||
|
||||
setup(function () {
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
});
|
||||
|
||||
test('diagnostic collection, immutable read', function () {
|
||||
let collection = new DiagnosticCollection('test', 'test', 100, extUri, new DiagnosticsShape(), new Emitter());
|
||||
const collection = new DiagnosticCollection('test', 'test', 100, extUri, new DiagnosticsShape(), new Emitter());
|
||||
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')
|
||||
@@ -118,8 +118,8 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
|
||||
test('diagnostics collection, set with dupliclated tuples', function () {
|
||||
let collection = new DiagnosticCollection('test', 'test', 100, extUri, new DiagnosticsShape(), new Emitter());
|
||||
let uri = URI.parse('sc:hightower');
|
||||
const collection = new DiagnosticCollection('test', 'test', 100, extUri, new DiagnosticsShape(), new Emitter());
|
||||
const uri = URI.parse('sc:hightower');
|
||||
collection.set([
|
||||
[uri, [new Diagnostic(new Range(0, 0, 0, 1), 'message-1')]],
|
||||
[URI.parse('some:thing'), [new Diagnostic(new Range(0, 0, 1, 1), 'something')]],
|
||||
@@ -169,19 +169,19 @@ suite('ExtHostDiagnostics', () => {
|
||||
test('diagnostics collection, set tuple overrides, #11547', function () {
|
||||
|
||||
let lastEntries!: [UriComponents, IMarkerData[]][];
|
||||
let collection = new DiagnosticCollection('test', 'test', 100, extUri, new class extends DiagnosticsShape {
|
||||
const collection = new DiagnosticCollection('test', 'test', 100, extUri, new class extends DiagnosticsShape {
|
||||
override $changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]): void {
|
||||
lastEntries = entries;
|
||||
return super.$changeMany(owner, entries);
|
||||
}
|
||||
}, new Emitter());
|
||||
let uri = URI.parse('sc:hightower');
|
||||
const uri = URI.parse('sc:hightower');
|
||||
|
||||
collection.set([[uri, [new Diagnostic(new Range(0, 0, 1, 1), 'error')]]]);
|
||||
assert.strictEqual(collection.get(uri).length, 1);
|
||||
assert.strictEqual(collection.get(uri)[0].message, 'error');
|
||||
assert.strictEqual(lastEntries.length, 1);
|
||||
let [[, data1]] = lastEntries;
|
||||
const [[, data1]] = lastEntries;
|
||||
assert.strictEqual(data1.length, 1);
|
||||
assert.strictEqual(data1[0].message, 'error');
|
||||
lastEntries = undefined!;
|
||||
@@ -190,7 +190,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
assert.strictEqual(collection.get(uri).length, 1);
|
||||
assert.strictEqual(collection.get(uri)[0].message, 'warning');
|
||||
assert.strictEqual(lastEntries.length, 1);
|
||||
let [[, data2]] = lastEntries;
|
||||
const [[, data2]] = lastEntries;
|
||||
assert.strictEqual(data2.length, 1);
|
||||
assert.strictEqual(data2[0].message, 'warning');
|
||||
lastEntries = undefined!;
|
||||
@@ -209,8 +209,8 @@ suite('ExtHostDiagnostics', () => {
|
||||
}
|
||||
}, emitter);
|
||||
|
||||
let uri = URI.parse('sc:hightower');
|
||||
let diag = new Diagnostic(new Range(0, 0, 0, 1), 'ffff');
|
||||
const uri = URI.parse('sc:hightower');
|
||||
const diag = new Diagnostic(new Range(0, 0, 0, 1), 'ffff');
|
||||
|
||||
collection.set(uri, [diag]);
|
||||
assert.strictEqual(changeCount, 1);
|
||||
@@ -224,9 +224,9 @@ suite('ExtHostDiagnostics', () => {
|
||||
test('diagnostics collection, tuples and undefined (small array), #15585', function () {
|
||||
|
||||
const collection = new DiagnosticCollection('test', 'test', 100, extUri, new DiagnosticsShape(), new Emitter());
|
||||
let uri = URI.parse('sc:hightower');
|
||||
let uri2 = URI.parse('sc:nomad');
|
||||
let diag = new Diagnostic(new Range(0, 0, 0, 1), 'ffff');
|
||||
const uri = URI.parse('sc:hightower');
|
||||
const uri2 = URI.parse('sc:nomad');
|
||||
const diag = new Diagnostic(new Range(0, 0, 0, 1), 'ffff');
|
||||
|
||||
collection.set([
|
||||
[uri, [diag, diag, diag]],
|
||||
@@ -248,8 +248,8 @@ suite('ExtHostDiagnostics', () => {
|
||||
const tuples: [URI, Diagnostic[]][] = [];
|
||||
|
||||
for (let i = 0; i < 500; i++) {
|
||||
let uri = URI.parse('sc:hightower#' + i);
|
||||
let diag = new Diagnostic(new Range(0, 0, 0, 1), i.toString());
|
||||
const uri = URI.parse('sc:hightower#' + i);
|
||||
const diag = new Diagnostic(new Range(0, 0, 0, 1), i.toString());
|
||||
|
||||
tuples.push([uri, [diag, diag, diag]]);
|
||||
tuples.push([uri, undefined!]);
|
||||
@@ -259,7 +259,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
collection.set(tuples);
|
||||
|
||||
for (let i = 0; i < 500; i++) {
|
||||
let uri = URI.parse('sc:hightower#' + i);
|
||||
const uri = URI.parse('sc:hightower#' + i);
|
||||
assert.strictEqual(collection.has(uri), true);
|
||||
assert.strictEqual(collection.get(uri).length, 1);
|
||||
}
|
||||
@@ -268,15 +268,15 @@ suite('ExtHostDiagnostics', () => {
|
||||
test('diagnostic capping', function () {
|
||||
|
||||
let lastEntries!: [UriComponents, IMarkerData[]][];
|
||||
let collection = new DiagnosticCollection('test', 'test', 250, extUri, new class extends DiagnosticsShape {
|
||||
const collection = new DiagnosticCollection('test', 'test', 250, extUri, new class extends DiagnosticsShape {
|
||||
override $changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]): void {
|
||||
lastEntries = entries;
|
||||
return super.$changeMany(owner, entries);
|
||||
}
|
||||
}, new Emitter());
|
||||
let uri = URI.parse('aa:bb');
|
||||
const uri = URI.parse('aa:bb');
|
||||
|
||||
let diagnostics: Diagnostic[] = [];
|
||||
const diagnostics: Diagnostic[] = [];
|
||||
for (let i = 0; i < 500; i++) {
|
||||
diagnostics.push(new Diagnostic(new Range(i, 0, i + 1, 0), `error#${i}`, i < 300
|
||||
? DiagnosticSeverity.Warning
|
||||
@@ -293,12 +293,12 @@ suite('ExtHostDiagnostics', () => {
|
||||
});
|
||||
|
||||
test('diagnostic eventing', async function () {
|
||||
let emitter = new Emitter<Array<URI>>();
|
||||
let collection = new DiagnosticCollection('ddd', 'test', 100, extUri, new DiagnosticsShape(), emitter);
|
||||
const emitter = new Emitter<Array<URI>>();
|
||||
const collection = new DiagnosticCollection('ddd', 'test', 100, extUri, new DiagnosticsShape(), emitter);
|
||||
|
||||
let diag1 = new Diagnostic(new Range(1, 1, 2, 3), 'diag1');
|
||||
let diag2 = new Diagnostic(new Range(1, 1, 2, 3), 'diag2');
|
||||
let diag3 = new Diagnostic(new Range(1, 1, 2, 3), 'diag3');
|
||||
const diag1 = new Diagnostic(new Range(1, 1, 2, 3), 'diag1');
|
||||
const diag2 = new Diagnostic(new Range(1, 1, 2, 3), 'diag2');
|
||||
const diag3 = new Diagnostic(new Range(1, 1, 2, 3), 'diag3');
|
||||
|
||||
let p = Event.toPromise(emitter.event).then(a => {
|
||||
assert.strictEqual(a.length, 1);
|
||||
@@ -331,10 +331,10 @@ suite('ExtHostDiagnostics', () => {
|
||||
});
|
||||
|
||||
test('vscode.languages.onDidChangeDiagnostics Does Not Provide Document URI #49582', async function () {
|
||||
let emitter = new Emitter<Array<URI>>();
|
||||
let collection = new DiagnosticCollection('ddd', 'test', 100, extUri, new DiagnosticsShape(), emitter);
|
||||
const emitter = new Emitter<Array<URI>>();
|
||||
const collection = new DiagnosticCollection('ddd', 'test', 100, extUri, new DiagnosticsShape(), emitter);
|
||||
|
||||
let diag1 = new Diagnostic(new Range(1, 1, 2, 3), 'diag1');
|
||||
const diag1 = new Diagnostic(new Range(1, 1, 2, 3), 'diag1');
|
||||
|
||||
// delete
|
||||
collection.set(URI.parse('aa:bb'), [diag1]);
|
||||
@@ -355,14 +355,14 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
test('diagnostics with related information', function (done) {
|
||||
|
||||
let collection = new DiagnosticCollection('ddd', 'test', 100, extUri, new class extends DiagnosticsShape {
|
||||
const collection = new DiagnosticCollection('ddd', 'test', 100, extUri, new class extends DiagnosticsShape {
|
||||
override $changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]) {
|
||||
|
||||
let [[, data]] = entries;
|
||||
const [[, data]] = entries;
|
||||
assert.strictEqual(entries.length, 1);
|
||||
assert.strictEqual(data.length, 1);
|
||||
|
||||
let [diag] = data;
|
||||
const [diag] = data;
|
||||
assert.strictEqual(diag.relatedInformation!.length, 2);
|
||||
assert.strictEqual(diag.relatedInformation![0].message, 'more1');
|
||||
assert.strictEqual(diag.relatedInformation![1].message, 'more2');
|
||||
@@ -370,7 +370,7 @@ suite('ExtHostDiagnostics', () => {
|
||||
}
|
||||
}, new Emitter<any>());
|
||||
|
||||
let diag = new Diagnostic(new Range(0, 0, 1, 1), 'Foo');
|
||||
const diag = new Diagnostic(new Range(0, 0, 1, 1), 'Foo');
|
||||
diag.relatedInformation = [
|
||||
new DiagnosticRelatedInformation(new Location(URI.parse('cc:dd'), new Range(0, 0, 0, 0)), 'more1'),
|
||||
new DiagnosticRelatedInformation(new Location(URI.parse('cc:ee'), new Range(0, 0, 0, 0)), 'more2')
|
||||
@@ -401,8 +401,8 @@ suite('ExtHostDiagnostics', () => {
|
||||
}
|
||||
}, new NullLogService(), fileSystemInfoService);
|
||||
|
||||
let collection1 = diags.createDiagnosticCollection(nullExtensionDescription.identifier, 'foo');
|
||||
let collection2 = diags.createDiagnosticCollection(nullExtensionDescription.identifier, 'foo'); // warns, uses a different owner
|
||||
const collection1 = diags.createDiagnosticCollection(nullExtensionDescription.identifier, 'foo');
|
||||
const collection2 = diags.createDiagnosticCollection(nullExtensionDescription.identifier, 'foo'); // warns, uses a different owner
|
||||
|
||||
collection1.clear();
|
||||
collection2.clear();
|
||||
@@ -414,15 +414,15 @@ suite('ExtHostDiagnostics', () => {
|
||||
|
||||
test('Error updating diagnostics from extension #60394', function () {
|
||||
let callCount = 0;
|
||||
let collection = new DiagnosticCollection('ddd', 'test', 100, extUri, new class extends DiagnosticsShape {
|
||||
const collection = new DiagnosticCollection('ddd', 'test', 100, extUri, new class extends DiagnosticsShape {
|
||||
override $changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]) {
|
||||
callCount += 1;
|
||||
}
|
||||
}, new Emitter<any>());
|
||||
|
||||
let array: Diagnostic[] = [];
|
||||
let diag1 = new Diagnostic(new Range(0, 0, 1, 1), 'Foo');
|
||||
let diag2 = new Diagnostic(new Range(0, 0, 1, 1), 'Bar');
|
||||
const array: Diagnostic[] = [];
|
||||
const diag1 = new Diagnostic(new Range(0, 0, 1, 1), 'Foo');
|
||||
const diag2 = new Diagnostic(new Range(0, 0, 1, 1), 'Bar');
|
||||
|
||||
array.push(diag1, diag2);
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ suite('ExtHostDocumentData', () => {
|
||||
let data: ExtHostDocumentData;
|
||||
|
||||
function assertPositionAt(offset: number, line: number, character: number) {
|
||||
let position = data.document.positionAt(offset);
|
||||
const position = data.document.positionAt(offset);
|
||||
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);
|
||||
const pos = new Position(line, character);
|
||||
const actual = data.document.offsetAt(pos);
|
||||
assert.strictEqual(actual, offset);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ suite('ExtHostDocumentData', () => {
|
||||
|
||||
test('save, when disposed', function () {
|
||||
let saved: URI;
|
||||
let data = new ExtHostDocumentData(new class extends mock<MainThreadDocumentsShape>() {
|
||||
const data = new ExtHostDocumentData(new class extends mock<MainThreadDocumentsShape>() {
|
||||
override $trySaveDocument(uri: URI) {
|
||||
assert.ok(!saved);
|
||||
saved = uri;
|
||||
@@ -344,7 +344,7 @@ suite('ExtHostDocumentData', () => {
|
||||
line
|
||||
], '\n', 1, 'text', false);
|
||||
|
||||
let range = data.document.getWordRangeAtPosition(new Position(0, 27), regex)!;
|
||||
const range = data.document.getWordRangeAtPosition(new Position(0, 27), regex)!;
|
||||
assert.strictEqual(range.start.line, 0);
|
||||
assert.strictEqual(range.end.line, 0);
|
||||
assert.strictEqual(range.start.character, 4);
|
||||
@@ -379,7 +379,7 @@ suite('ExtHostDocumentData updates line mapping', () => {
|
||||
}
|
||||
|
||||
function assertDocumentLineMapping(doc: ExtHostDocumentData, direction: AssertDocumentLineMappingDirection): void {
|
||||
let allText = doc.getText();
|
||||
const allText = doc.getText();
|
||||
|
||||
let line = 0, character = 0, previousIsCarriageReturn = false;
|
||||
for (let offset = 0; offset <= allText.length; offset++) {
|
||||
@@ -387,12 +387,12 @@ suite('ExtHostDocumentData updates line mapping', () => {
|
||||
const position: Position = new Position(line, character + (previousIsCarriageReturn ? -1 : 0));
|
||||
|
||||
if (direction === AssertDocumentLineMappingDirection.OffsetToPosition) {
|
||||
let actualPosition = doc.document.positionAt(offset);
|
||||
const actualPosition = doc.document.positionAt(offset);
|
||||
assert.strictEqual(positionToStr(actualPosition), positionToStr(position), 'positionAt mismatch for offset ' + offset);
|
||||
} else {
|
||||
// The position coordinate system cannot express the position between \r and \n
|
||||
let expectedOffset: number = offset + (previousIsCarriageReturn ? -1 : 0);
|
||||
let actualOffset = doc.document.offsetAt(position);
|
||||
const expectedOffset: number = offset + (previousIsCarriageReturn ? -1 : 0);
|
||||
const actualOffset = doc.document.offsetAt(position);
|
||||
assert.strictEqual(actualOffset, expectedOffset, 'offsetAt mismatch for position ' + positionToStr(position));
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ suite('ExtHostDocumentData updates line mapping', () => {
|
||||
}
|
||||
|
||||
function testLineMappingDirectionAfterEvents(lines: string[], eol: string, direction: AssertDocumentLineMappingDirection, e: IModelChangedEvent): void {
|
||||
let myDocument = new ExtHostDocumentData(undefined!, URI.file(''), lines.slice(0), eol, 1, 'text', false);
|
||||
const myDocument = new ExtHostDocumentData(undefined!, URI.file(''), lines.slice(0), eol, 1, 'text', false);
|
||||
assertDocumentLineMapping(myDocument, direction);
|
||||
|
||||
myDocument.onEvents(e);
|
||||
|
||||
@@ -19,10 +19,10 @@ import { nullExtensionDescription } from 'vs/workbench/services/extensions/commo
|
||||
|
||||
suite('ExtHostDocumentSaveParticipant', () => {
|
||||
|
||||
let resource = URI.parse('foo:bar');
|
||||
let mainThreadBulkEdits = new class extends mock<MainThreadBulkEditsShape>() { };
|
||||
const resource = URI.parse('foo:bar');
|
||||
const mainThreadBulkEdits = new class extends mock<MainThreadBulkEditsShape>() { };
|
||||
let documents: ExtHostDocuments;
|
||||
let nullLogService = new NullLogService();
|
||||
const nullLogService = new NullLogService();
|
||||
|
||||
setup(() => {
|
||||
const documentsAndEditors = new ExtHostDocumentsAndEditors(SingleProxyRPCProtocol(null), new NullLogService());
|
||||
@@ -48,7 +48,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
|
||||
|
||||
let event: vscode.TextDocumentWillSaveEvent;
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
event = e;
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
|
||||
|
||||
let event: vscode.TextDocumentWillSaveEvent;
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
event = e;
|
||||
});
|
||||
|
||||
@@ -80,7 +80,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
test('event delivery, bad listener', () => {
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
|
||||
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
throw new Error('💀');
|
||||
});
|
||||
|
||||
@@ -95,11 +95,11 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
test('event delivery, bad listener doesn\'t prevent more events', () => {
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
|
||||
|
||||
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
throw new Error('💀');
|
||||
});
|
||||
let event: vscode.TextDocumentWillSaveEvent;
|
||||
let sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
event = e;
|
||||
});
|
||||
|
||||
@@ -115,11 +115,11 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
|
||||
|
||||
let counter = 0;
|
||||
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
const sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
assert.strictEqual(counter++, 0);
|
||||
});
|
||||
|
||||
let sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
const sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
assert.strictEqual(counter++, 1);
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits, { timeout: 5, errors: 1 });
|
||||
|
||||
let callCount = 0;
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
const sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
callCount += 1;
|
||||
throw new Error('boom');
|
||||
});
|
||||
@@ -151,17 +151,17 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits, { timeout: 20, errors: 5 });
|
||||
|
||||
// let callCount = 0;
|
||||
let calls: number[] = [];
|
||||
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
const calls: number[] = [];
|
||||
const sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
calls.push(1);
|
||||
});
|
||||
|
||||
let sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
const sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
calls.push(2);
|
||||
event.waitUntil(timeout(100));
|
||||
});
|
||||
|
||||
let sub3 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
const sub3 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
calls.push(3);
|
||||
});
|
||||
|
||||
@@ -176,7 +176,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
test('event delivery, waitUntil', () => {
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
|
||||
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
const sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
|
||||
event.waitUntil(timeout(10));
|
||||
event.waitUntil(timeout(10));
|
||||
@@ -192,7 +192,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
test('event delivery, waitUntil must be called sync', () => {
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
|
||||
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
const sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
|
||||
event.waitUntil(new Promise<undefined>((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
@@ -216,7 +216,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits, { timeout: 5, errors: 3 });
|
||||
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
const sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
event.waitUntil(timeout(100));
|
||||
});
|
||||
|
||||
@@ -231,12 +231,12 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
test('event delivery, waitUntil failure handling', () => {
|
||||
const participant = new ExtHostDocumentSaveParticipant(nullLogService, documents, mainThreadBulkEdits);
|
||||
|
||||
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
e.waitUntil(Promise.reject(new Error('dddd')));
|
||||
});
|
||||
|
||||
let event: vscode.TextDocumentWillSaveEvent;
|
||||
let sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
event = e;
|
||||
});
|
||||
|
||||
@@ -257,7 +257,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
}
|
||||
});
|
||||
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
e.waitUntil(Promise.resolve([TextEdit.insert(new Position(0, 0), 'bar')]));
|
||||
e.waitUntil(Promise.resolve([TextEdit.setEndOfLine(EndOfLine.CRLF)]));
|
||||
});
|
||||
@@ -281,7 +281,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
}
|
||||
});
|
||||
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
|
||||
// concurrent change from somewhere
|
||||
documents.$acceptModelChanged(resource, {
|
||||
@@ -339,7 +339,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
|
||||
const document = documents.getDocument(resource);
|
||||
|
||||
let sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub1 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
// the document state we started with
|
||||
assert.strictEqual(document.version, 1);
|
||||
assert.strictEqual(document.getText(), 'foo');
|
||||
@@ -347,7 +347,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
e.waitUntil(Promise.resolve([TextEdit.insert(new Position(0, 0), 'bar')]));
|
||||
});
|
||||
|
||||
let sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub2 = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
// the document state AFTER the first listener kicked in
|
||||
assert.strictEqual(document.version, 2);
|
||||
assert.strictEqual(document.getText(), 'barfoo');
|
||||
@@ -368,14 +368,14 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
|
||||
test('Log failing listener', function () {
|
||||
let didLogSomething = false;
|
||||
let participant = new ExtHostDocumentSaveParticipant(new class extends NullLogService {
|
||||
const participant = new ExtHostDocumentSaveParticipant(new class extends NullLogService {
|
||||
override error(message: string | Error, ...args: any[]): void {
|
||||
didLogSomething = true;
|
||||
}
|
||||
}, documents, mainThreadBulkEdits);
|
||||
|
||||
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
const sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (e) {
|
||||
throw new Error('boom');
|
||||
});
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ suite('ExtHostEditorTabs', function () {
|
||||
tabs: [tabDtoAAA, tabDtoBBB]
|
||||
}]);
|
||||
|
||||
let all = extHostEditorTabs.tabGroups.all.map(group => group.tabs).flat();
|
||||
const all = extHostEditorTabs.tabGroups.all.map(group => group.tabs).flat();
|
||||
assert.strictEqual(all.length, 2);
|
||||
|
||||
const activeTab1 = extHostEditorTabs.tabGroups.activeTabGroup?.activeTab;
|
||||
@@ -346,7 +346,7 @@ suite('ExtHostEditorTabs', function () {
|
||||
});
|
||||
|
||||
test('Ensure close is called with all tab ids', function () {
|
||||
let closedTabIds: string[][] = [];
|
||||
const closedTabIds: string[][] = [];
|
||||
const extHostEditorTabs = new ExtHostEditorTabs(
|
||||
SingleProxyRPCProtocol(new class extends mock<MainThreadEditorTabsShape>() {
|
||||
// override/implement $moveTab or $closeTab
|
||||
@@ -384,7 +384,7 @@ suite('ExtHostEditorTabs', function () {
|
||||
});
|
||||
|
||||
test('Update tab only sends tab change event', async function () {
|
||||
let closedTabIds: string[][] = [];
|
||||
const closedTabIds: string[][] = [];
|
||||
const extHostEditorTabs = new ExtHostEditorTabs(
|
||||
SingleProxyRPCProtocol(new class extends mock<MainThreadEditorTabsShape>() {
|
||||
// override/implement $moveTab or $closeTab
|
||||
|
||||
@@ -84,7 +84,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
// Use IInstantiationService to get typechecking when instantiating
|
||||
let inst: IInstantiationService;
|
||||
{
|
||||
let instantiationService = new TestInstantiationService();
|
||||
const instantiationService = new TestInstantiationService();
|
||||
instantiationService.stub(IMarkerService, MarkerService);
|
||||
instantiationService.set(ILanguageFeaturesService, languageFeaturesService);
|
||||
inst = instantiationService;
|
||||
@@ -135,7 +135,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
test('DocumentSymbols, register/deregister', async () => {
|
||||
assert.strictEqual(languageFeaturesService.documentSymbolProvider.all(model).length, 0);
|
||||
let d1 = extHost.registerDocumentSymbolProvider(defaultExtension, defaultSelector, new class implements vscode.DocumentSymbolProvider {
|
||||
const d1 = extHost.registerDocumentSymbolProvider(defaultExtension, defaultSelector, new class implements vscode.DocumentSymbolProvider {
|
||||
provideDocumentSymbols() {
|
||||
return <vscode.SymbolInformation[]>[];
|
||||
}
|
||||
@@ -175,7 +175,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
await rpcProtocol.sync();
|
||||
const value = (await OutlineModel.create(languageFeaturesService.documentSymbolProvider, model, CancellationToken.None)).asListOfDocumentSymbols();
|
||||
assert.strictEqual(value.length, 1);
|
||||
let entry = value[0];
|
||||
const entry = value[0];
|
||||
assert.strictEqual(entry.name, 'test');
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
});
|
||||
@@ -263,7 +263,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
await rpcProtocol.sync();
|
||||
const value = await getCodeLensModel(languageFeaturesService.codeLensProvider, model, CancellationToken.None);
|
||||
assert.strictEqual(value.lenses.length, 1);
|
||||
let [data] = value.lenses;
|
||||
const [data] = value.lenses;
|
||||
const symbol = await Promise.resolve(data.provider.resolveCodeLens!(model, data.symbol, CancellationToken.None));
|
||||
assert.strictEqual(symbol!.command!.id, 'missing');
|
||||
assert.strictEqual(symbol!.command!.title, '!!MISSING: command!!');
|
||||
@@ -280,9 +280,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getDefinitionsAtPosition(languageFeaturesService.definitionProvider, model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
const value = await getDefinitionsAtPosition(languageFeaturesService.definitionProvider, model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
const [entry] = value;
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.strictEqual(entry.uri.toString(), model.uri.toString());
|
||||
});
|
||||
@@ -356,9 +356,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getDeclarationsAtPosition(languageFeaturesService.declarationProvider, model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
const value = await getDeclarationsAtPosition(languageFeaturesService.declarationProvider, model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
const [entry] = value;
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.strictEqual(entry.uri.toString(), model.uri.toString());
|
||||
});
|
||||
@@ -374,9 +374,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getImplementationsAtPosition(languageFeaturesService.implementationProvider, model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
const value = await getImplementationsAtPosition(languageFeaturesService.implementationProvider, model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
const [entry] = value;
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.strictEqual(entry.uri.toString(), model.uri.toString());
|
||||
});
|
||||
@@ -392,9 +392,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getTypeDefinitionsAtPosition(languageFeaturesService.typeDefinitionProvider, model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
const value = await getTypeDefinitionsAtPosition(languageFeaturesService.typeDefinitionProvider, model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
const [entry] = value;
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 2, startColumn: 3, endLineNumber: 4, endColumn: 5 });
|
||||
assert.strictEqual(entry.uri.toString(), model.uri.toString());
|
||||
});
|
||||
@@ -412,7 +412,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
await rpcProtocol.sync();
|
||||
getHoverPromise(languageFeaturesService.hoverProvider, model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
const [entry] = value;
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 5 });
|
||||
});
|
||||
});
|
||||
@@ -429,7 +429,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
await rpcProtocol.sync();
|
||||
getHoverPromise(languageFeaturesService.hoverProvider, model, new EditorPosition(1, 1), CancellationToken.None).then(value => {
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [entry] = value;
|
||||
const [entry] = value;
|
||||
assert.deepStrictEqual(entry.range, { startLineNumber: 4, startColumn: 1, endLineNumber: 9, endColumn: 8 });
|
||||
});
|
||||
});
|
||||
@@ -452,7 +452,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
await rpcProtocol.sync();
|
||||
const value = await getHoverPromise(languageFeaturesService.hoverProvider, model, new EditorPosition(1, 1), CancellationToken.None);
|
||||
assert.strictEqual(value.length, 2);
|
||||
let [first, second] = (value as languages.Hover[]);
|
||||
const [first, second] = (value as languages.Hover[]);
|
||||
assert.strictEqual(first.contents[0].value, 'registered second');
|
||||
assert.strictEqual(second.contents[0].value, 'registered first');
|
||||
});
|
||||
@@ -573,9 +573,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getReferencesAtPosition(languageFeaturesService.referenceProvider, model, new EditorPosition(1, 2), false, CancellationToken.None);
|
||||
const value = await getReferencesAtPosition(languageFeaturesService.referenceProvider, model, new EditorPosition(1, 2), false, CancellationToken.None);
|
||||
assert.strictEqual(value.length, 2);
|
||||
let [first, second] = value;
|
||||
const [first, second] = value;
|
||||
assert.strictEqual(first.uri.path, '/second');
|
||||
assert.strictEqual(second.uri.path, '/first');
|
||||
});
|
||||
@@ -589,9 +589,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getReferencesAtPosition(languageFeaturesService.referenceProvider, model, new EditorPosition(1, 2), false, CancellationToken.None);
|
||||
const value = await getReferencesAtPosition(languageFeaturesService.referenceProvider, model, new EditorPosition(1, 2), false, CancellationToken.None);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [item] = value;
|
||||
const [item] = value;
|
||||
assert.deepStrictEqual(item.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.strictEqual(item.uri.toString(), model.uri.toString());
|
||||
});
|
||||
@@ -714,7 +714,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getWorkspaceSymbols('');
|
||||
const value = await getWorkspaceSymbols('');
|
||||
assert.strictEqual(value.length, 1);
|
||||
const [first] = value;
|
||||
assert.strictEqual(first.symbol.name, 'testing');
|
||||
@@ -750,7 +750,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getWorkspaceSymbols('');
|
||||
const value = await getWorkspaceSymbols('');
|
||||
assert.strictEqual(value.length, 3);
|
||||
});
|
||||
|
||||
@@ -797,7 +797,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
disposables.push(extHost.registerRenameProvider(defaultExtension, defaultSelector, new class implements vscode.RenameProvider {
|
||||
provideRenameEdits(): any {
|
||||
let edit = new types.WorkspaceEdit();
|
||||
const edit = new types.WorkspaceEdit();
|
||||
edit.replace(model.uri, new types.Range(0, 0, 0, 0), 'testing');
|
||||
return edit;
|
||||
}
|
||||
@@ -812,7 +812,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
disposables.push(extHost.registerRenameProvider(defaultExtension, '*', new class implements vscode.RenameProvider {
|
||||
provideRenameEdits(): any {
|
||||
let edit = new types.WorkspaceEdit();
|
||||
const edit = new types.WorkspaceEdit();
|
||||
edit.replace(model.uri, new types.Range(0, 0, 0, 0), 'testing');
|
||||
edit.replace(model.uri, new types.Range(1, 0, 1, 0), 'testing');
|
||||
return edit;
|
||||
@@ -833,12 +833,12 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
test('Multiple RenameProviders don\'t respect all possible PrepareRename handlers, #98352', async function () {
|
||||
|
||||
let called = [false, false, false, false];
|
||||
const called = [false, false, false, false];
|
||||
|
||||
disposables.push(extHost.registerRenameProvider(defaultExtension, defaultSelector, new class implements vscode.RenameProvider {
|
||||
prepareRename(document: vscode.TextDocument, position: vscode.Position,): vscode.ProviderResult<vscode.Range> {
|
||||
called[0] = true;
|
||||
let range = document.getWordRangeAtPosition(position);
|
||||
const range = document.getWordRangeAtPosition(position);
|
||||
return range;
|
||||
}
|
||||
|
||||
@@ -867,12 +867,12 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
|
||||
test('Multiple RenameProviders don\'t respect all possible PrepareRename handlers, #98352', async function () {
|
||||
|
||||
let called = [false, false, false];
|
||||
const called = [false, false, false];
|
||||
|
||||
disposables.push(extHost.registerRenameProvider(defaultExtension, defaultSelector, new class implements vscode.RenameProvider {
|
||||
prepareRename(document: vscode.TextDocument, position: vscode.Position,): vscode.ProviderResult<vscode.Range> {
|
||||
called[0] = true;
|
||||
let range = document.getWordRangeAtPosition(position);
|
||||
const range = document.getWordRangeAtPosition(position);
|
||||
return range;
|
||||
}
|
||||
|
||||
@@ -1048,9 +1048,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = (await getDocumentFormattingEditsUntilResult(NullWorkerService, languageFeaturesService, model, { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
const value = (await getDocumentFormattingEditsUntilResult(NullWorkerService, languageFeaturesService, model, { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
assert.strictEqual(value.length, 2);
|
||||
let [first, second] = value;
|
||||
const [first, second] = value;
|
||||
assert.strictEqual(first.text, 'testing');
|
||||
assert.deepStrictEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
assert.strictEqual(second.eol, EndOfLineSequence.LF);
|
||||
@@ -1090,9 +1090,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = (await getDocumentFormattingEditsUntilResult(NullWorkerService, languageFeaturesService, model, { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
const value = (await getDocumentFormattingEditsUntilResult(NullWorkerService, languageFeaturesService, model, { insertSpaces: true, tabSize: 4 }, CancellationToken.None))!;
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
const [first] = value;
|
||||
assert.strictEqual(first.text, 'testing');
|
||||
assert.deepStrictEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 });
|
||||
});
|
||||
@@ -1177,9 +1177,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let { links } = await getLinks(languageFeaturesService.linkProvider, model, CancellationToken.None);
|
||||
const { links } = await getLinks(languageFeaturesService.linkProvider, model, CancellationToken.None);
|
||||
assert.strictEqual(links.length, 1);
|
||||
let [first] = links;
|
||||
const [first] = links;
|
||||
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');
|
||||
@@ -1200,9 +1200,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let { links } = await getLinks(languageFeaturesService.linkProvider, model, CancellationToken.None);
|
||||
const { links } = await getLinks(languageFeaturesService.linkProvider, model, CancellationToken.None);
|
||||
assert.strictEqual(links.length, 1);
|
||||
let [first] = links;
|
||||
const [first] = links;
|
||||
assert.strictEqual(first.url?.toString(), 'foo:bar#3');
|
||||
assert.deepStrictEqual(first.range, { startLineNumber: 1, startColumn: 1, endLineNumber: 2, endColumn: 2 });
|
||||
});
|
||||
@@ -1219,9 +1219,9 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let value = await getColors(languageFeaturesService.colorProvider, model, CancellationToken.None);
|
||||
const value = await getColors(languageFeaturesService.colorProvider, model, CancellationToken.None);
|
||||
assert.strictEqual(value.length, 1);
|
||||
let [first] = value;
|
||||
const [first] = value;
|
||||
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 });
|
||||
});
|
||||
@@ -1248,7 +1248,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
test('Selection Ranges, bad data', async () => {
|
||||
|
||||
try {
|
||||
let _a = new types.SelectionRange(new types.Range(0, 10, 0, 18),
|
||||
const _a = new types.SelectionRange(new types.Range(0, 10, 0, 18),
|
||||
new types.SelectionRange(new types.Range(0, 11, 0, 18))
|
||||
);
|
||||
assert.ok(false, String(_a));
|
||||
|
||||
@@ -86,7 +86,7 @@ suite('ExtHostMessageService', function () {
|
||||
|
||||
test('propagte handle on select', async function () {
|
||||
|
||||
let service = new MainThreadMessageService(null!, new EmptyNotificationService(notification => {
|
||||
const service = new MainThreadMessageService(null!, new EmptyNotificationService(notification => {
|
||||
assert.strictEqual(notification.actions!.primary!.length, 1);
|
||||
queueMicrotask(() => notification.actions!.primary![0].run());
|
||||
}), emptyCommandService, new TestDialogService());
|
||||
|
||||
@@ -62,7 +62,7 @@ suite('NotebookCell#Document', function () {
|
||||
extHostNotebooks = new ExtHostNotebookController(rpcProtocol, new ExtHostCommands(rpcProtocol, new NullLogService()), extHostDocumentsAndEditors, extHostDocuments, extHostStoragePaths);
|
||||
extHostNotebookDocuments = new ExtHostNotebookDocuments(extHostNotebooks);
|
||||
|
||||
let reg = extHostNotebooks.registerNotebookContentProvider(nullExtensionDescription, 'test', new class extends mock<vscode.NotebookContentProvider>() {
|
||||
const reg = extHostNotebooks.registerNotebookContentProvider(nullExtensionDescription, 'test', new class extends mock<vscode.NotebookContentProvider>() {
|
||||
// async openNotebook() { }
|
||||
});
|
||||
extHostNotebooks.$acceptDocumentAndEditorsDelta(new SerializableObjectWithBuffers({
|
||||
@@ -124,7 +124,7 @@ suite('NotebookCell#Document', function () {
|
||||
|
||||
test('cell document goes when notebook closes', async function () {
|
||||
const cellUris: string[] = [];
|
||||
for (let cell of notebook.apiNotebook.getCells()) {
|
||||
for (const cell of notebook.apiNotebook.getCells()) {
|
||||
assert.ok(extHostDocuments.getDocument(cell.document.uri));
|
||||
cellUris.push(cell.document.uri.toString());
|
||||
}
|
||||
@@ -203,7 +203,7 @@ suite('NotebookCell#Document', function () {
|
||||
|
||||
const docs: vscode.TextDocument[] = [];
|
||||
const addData: IModelAddedData[] = [];
|
||||
for (let cell of notebook.apiNotebook.getCells()) {
|
||||
for (const cell of notebook.apiNotebook.getCells()) {
|
||||
const doc = extHostDocuments.getDocument(cell.document.uri);
|
||||
assert.ok(doc);
|
||||
assert.strictEqual(extHostDocuments.getDocument(cell.document.uri).isClosed, false);
|
||||
@@ -225,17 +225,17 @@ suite('NotebookCell#Document', function () {
|
||||
extHostDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({ removedDocuments: docs.map(d => d.uri) });
|
||||
|
||||
// notebook is still open -> cell documents stay open
|
||||
for (let cell of notebook.apiNotebook.getCells()) {
|
||||
for (const cell of notebook.apiNotebook.getCells()) {
|
||||
assert.ok(extHostDocuments.getDocument(cell.document.uri));
|
||||
assert.strictEqual(extHostDocuments.getDocument(cell.document.uri).isClosed, false);
|
||||
}
|
||||
|
||||
// close notebook -> docs are closed
|
||||
extHostNotebooks.$acceptDocumentAndEditorsDelta(new SerializableObjectWithBuffers({ removedDocuments: [notebook.uri] }));
|
||||
for (let cell of notebook.apiNotebook.getCells()) {
|
||||
for (const cell of notebook.apiNotebook.getCells()) {
|
||||
assert.throws(() => extHostDocuments.getDocument(cell.document.uri));
|
||||
}
|
||||
for (let doc of docs) {
|
||||
for (const doc of docs) {
|
||||
assert.strictEqual(doc.isClosed, true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -162,7 +162,7 @@ suite('NotebookKernel', function () {
|
||||
await rpcProtocol.sync();
|
||||
assert.strictEqual(kernelData.size, 1);
|
||||
|
||||
let [first] = kernelData.values();
|
||||
const [first] = kernelData.values();
|
||||
assert.strictEqual(first.id, 'nullExtensionDescription/foo');
|
||||
assert.strictEqual(ExtensionIdentifier.equals(first.extensionId, nullExtensionDescription.identifier), true);
|
||||
assert.strictEqual(first.label, 'Foo');
|
||||
@@ -283,7 +283,7 @@ suite('NotebookKernel', function () {
|
||||
assert.strictEqual(cellExecuteUpdates.length > 0, true);
|
||||
|
||||
let found = false;
|
||||
for (let edit of cellExecuteUpdates) {
|
||||
for (const edit of cellExecuteUpdates) {
|
||||
if (edit.editType === CellExecutionUpdateType.Output) {
|
||||
assert.strictEqual(edit.append, false);
|
||||
assert.strictEqual(edit.outputs.length, 1);
|
||||
@@ -317,7 +317,7 @@ suite('NotebookKernel', function () {
|
||||
assert.strictEqual(cellExecuteUpdates.length > 0, true);
|
||||
|
||||
let found = false;
|
||||
for (let edit of cellExecuteUpdates) {
|
||||
for (const edit of cellExecuteUpdates) {
|
||||
if (edit.editType === CellExecutionUpdateType.Output) {
|
||||
assert.strictEqual(edit.append, false);
|
||||
assert.strictEqual(edit.outputs.length, 1);
|
||||
|
||||
@@ -16,7 +16,7 @@ import { Lazy } from 'vs/base/common/lazy';
|
||||
suite('ExtHostTextEditor', () => {
|
||||
|
||||
let editor: ExtHostTextEditor;
|
||||
let doc = new ExtHostDocumentData(undefined!, URI.file(''), [
|
||||
const doc = new ExtHostDocumentData(undefined!, URI.file(''), [
|
||||
'aaaa bbbb+cccc abc'
|
||||
], '\n', 1, 'text', false);
|
||||
|
||||
@@ -42,7 +42,7 @@ suite('ExtHostTextEditor', () => {
|
||||
|
||||
test('API [bug]: registerTextEditorCommand clears redo stack even if no edits are made #55163', async function () {
|
||||
let applyCount = 0;
|
||||
let editor = new ExtHostTextEditor('edt1',
|
||||
const editor = new ExtHostTextEditor('edt1',
|
||||
new class extends mock<MainThreadTextEditorsShape>() {
|
||||
override $tryApplyEdits(): Promise<boolean> {
|
||||
applyCount += 1;
|
||||
@@ -68,7 +68,7 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
|
||||
setup(() => {
|
||||
calls = [];
|
||||
let mockProxy: MainThreadTextEditorsShape = {
|
||||
const mockProxy: MainThreadTextEditorsShape = {
|
||||
dispose: undefined!,
|
||||
$trySetOptions: (id: string, options: ITextEditorConfigurationUpdate) => {
|
||||
assert.strictEqual(id, '1');
|
||||
@@ -102,7 +102,7 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
});
|
||||
|
||||
function assertState(opts: ExtHostTextEditorOptions, expected: IResolvedTextEditorConfiguration): void {
|
||||
let actual = {
|
||||
const actual = {
|
||||
tabSize: opts.value.tabSize,
|
||||
insertSpaces: opts.value.insertSpaces,
|
||||
cursorStyle: opts.value.cursorStyle,
|
||||
|
||||
@@ -65,11 +65,11 @@ suite('ExtHostTreeView', function () {
|
||||
labels = {};
|
||||
nodes = {};
|
||||
|
||||
let rpcProtocol = new TestRPCProtocol();
|
||||
const rpcProtocol = new TestRPCProtocol();
|
||||
// Use IInstantiationService to get typechecking when instantiating
|
||||
let inst: IInstantiationService;
|
||||
{
|
||||
let instantiationService = new TestInstantiationService();
|
||||
const instantiationService = new TestInstantiationService();
|
||||
inst = instantiationService;
|
||||
}
|
||||
|
||||
@@ -738,7 +738,7 @@ suite('ExtHostTreeView', function () {
|
||||
if (!key) {
|
||||
return Object.keys(tree);
|
||||
}
|
||||
let treeElement = getTreeElement(key);
|
||||
const treeElement = getTreeElement(key);
|
||||
if (treeElement) {
|
||||
return Object.keys(treeElement);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
suite('ExtHostTypeConverter', function () {
|
||||
function size<T>(from: Record<any, any>): number {
|
||||
let count = 0;
|
||||
for (let key in from) {
|
||||
for (const key in from) {
|
||||
if (Object.prototype.hasOwnProperty.call(from, key)) {
|
||||
count += 1;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ suite('ExtHostTypeConverter', function () {
|
||||
|
||||
test('NPM script explorer running a script from the hover does not work #65561', 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)');
|
||||
const 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.strictEqual(size(data.uris!), 2);
|
||||
forEach(data.uris!, entry => {
|
||||
|
||||
@@ -22,7 +22,7 @@ suite('ExtHostTypes', function () {
|
||||
|
||||
test('URI, toJSON', function () {
|
||||
|
||||
let uri = URI.parse('file:///path/test.file');
|
||||
const uri = URI.parse('file:///path/test.file');
|
||||
assert.deepStrictEqual(uri.toJSON(), {
|
||||
$mid: MarshalledId.Uri,
|
||||
scheme: 'file',
|
||||
@@ -52,7 +52,7 @@ suite('ExtHostTypes', function () {
|
||||
test('Disposable', () => {
|
||||
|
||||
let count = 0;
|
||||
let d = new types.Disposable(() => {
|
||||
const d = new types.Disposable(() => {
|
||||
count += 1;
|
||||
return 12;
|
||||
});
|
||||
@@ -80,25 +80,25 @@ suite('ExtHostTypes', function () {
|
||||
assert.throws(() => new types.Position(-1, 0));
|
||||
assert.throws(() => new types.Position(0, -1));
|
||||
|
||||
let pos = new types.Position(0, 0);
|
||||
const pos = new types.Position(0, 0);
|
||||
assert.throws(() => (pos as any).line = -1);
|
||||
assert.throws(() => (pos as any).character = -1);
|
||||
assert.throws(() => (pos as any).line = 12);
|
||||
|
||||
let { line, character } = pos.toJSON();
|
||||
const { line, character } = pos.toJSON();
|
||||
assert.strictEqual(line, 0);
|
||||
assert.strictEqual(character, 0);
|
||||
});
|
||||
|
||||
test('Position, toJSON', function () {
|
||||
let pos = new types.Position(4, 2);
|
||||
const pos = new types.Position(4, 2);
|
||||
assertToJSON(pos, { line: 4, character: 2 });
|
||||
});
|
||||
|
||||
test('Position, isBefore(OrEqual)?', function () {
|
||||
let p1 = new types.Position(1, 3);
|
||||
let p2 = new types.Position(1, 2);
|
||||
let p3 = new types.Position(0, 4);
|
||||
const p1 = new types.Position(1, 3);
|
||||
const p2 = new types.Position(1, 2);
|
||||
const p3 = new types.Position(0, 4);
|
||||
|
||||
assert.ok(p1.isBeforeOrEqual(p1));
|
||||
assert.ok(!p1.isBefore(p1));
|
||||
@@ -107,9 +107,9 @@ suite('ExtHostTypes', function () {
|
||||
});
|
||||
|
||||
test('Position, isAfter(OrEqual)?', function () {
|
||||
let p1 = new types.Position(1, 3);
|
||||
let p2 = new types.Position(1, 2);
|
||||
let p3 = new types.Position(0, 4);
|
||||
const p1 = new types.Position(1, 3);
|
||||
const p2 = new types.Position(1, 2);
|
||||
const p3 = new types.Position(0, 4);
|
||||
|
||||
assert.ok(p1.isAfterOrEqual(p1));
|
||||
assert.ok(!p1.isAfter(p1));
|
||||
@@ -119,9 +119,9 @@ suite('ExtHostTypes', function () {
|
||||
});
|
||||
|
||||
test('Position, compareTo', function () {
|
||||
let p1 = new types.Position(1, 3);
|
||||
let p2 = new types.Position(1, 2);
|
||||
let p3 = new types.Position(0, 4);
|
||||
const p1 = new types.Position(1, 3);
|
||||
const p2 = new types.Position(1, 2);
|
||||
const p3 = new types.Position(0, 4);
|
||||
|
||||
assert.strictEqual(p1.compareTo(p1), 0);
|
||||
assert.strictEqual(p2.compareTo(p1), -1);
|
||||
@@ -131,7 +131,7 @@ suite('ExtHostTypes', function () {
|
||||
});
|
||||
|
||||
test('Position, translate', function () {
|
||||
let p1 = new types.Position(1, 3);
|
||||
const p1 = new types.Position(1, 3);
|
||||
|
||||
assert.ok(p1.translate() === p1);
|
||||
assert.ok(p1.translate({}) === p1);
|
||||
@@ -169,7 +169,7 @@ suite('ExtHostTypes', function () {
|
||||
});
|
||||
|
||||
test('Position, with', function () {
|
||||
let p1 = new types.Position(1, 3);
|
||||
const p1 = new types.Position(1, 3);
|
||||
|
||||
assert.ok(p1.with() === p1);
|
||||
assert.ok(p1.with(1) === p1);
|
||||
@@ -180,7 +180,7 @@ suite('ExtHostTypes', function () {
|
||||
assert.ok(p1.with({ character: 3 }) === p1);
|
||||
assert.ok(p1.with({ line: 1, character: 3 }) === p1);
|
||||
|
||||
let p2 = p1.with({ line: 0, character: 11 });
|
||||
const p2 = p1.with({ line: 0, character: 11 });
|
||||
assert.strictEqual(p2.line, 0);
|
||||
assert.strictEqual(p2.character, 11);
|
||||
|
||||
@@ -199,14 +199,14 @@ suite('ExtHostTypes', function () {
|
||||
assert.throws(() => new types.Range(undefined!, new types.Position(0, 0)));
|
||||
assert.throws(() => new types.Range(null!, new types.Position(0, 0)));
|
||||
|
||||
let range = new types.Range(1, 0, 0, 0);
|
||||
const range = new types.Range(1, 0, 0, 0);
|
||||
assert.throws(() => { (range as any).start = null; });
|
||||
assert.throws(() => { (range as any).start = new types.Position(0, 3); });
|
||||
});
|
||||
|
||||
test('Range, toJSON', function () {
|
||||
|
||||
let range = new types.Range(1, 2, 3, 4);
|
||||
const range = new types.Range(1, 2, 3, 4);
|
||||
assertToJSON(range, [{ line: 1, character: 2 }, { line: 3, character: 4 }]);
|
||||
});
|
||||
|
||||
@@ -240,7 +240,7 @@ suite('ExtHostTypes', function () {
|
||||
});
|
||||
|
||||
test('Range, contains', function () {
|
||||
let range = new types.Range(1, 1, 2, 11);
|
||||
const range = new types.Range(1, 1, 2, 11);
|
||||
|
||||
assert.ok(range.contains(range.start));
|
||||
assert.ok(range.contains(range.end));
|
||||
@@ -253,11 +253,11 @@ suite('ExtHostTypes', function () {
|
||||
});
|
||||
|
||||
test('Range, contains (no instanceof)', function () {
|
||||
let range = new types.Range(1, 1, 2, 11);
|
||||
const range = new types.Range(1, 1, 2, 11);
|
||||
|
||||
let startLike = { line: range.start.line, character: range.start.character };
|
||||
let endLike = { line: range.end.line, character: range.end.character };
|
||||
let rangeLike = { start: startLike, end: endLike };
|
||||
const startLike = { line: range.start.line, character: range.start.character };
|
||||
const endLike = { line: range.end.line, character: range.end.character };
|
||||
const rangeLike = { start: startLike, end: endLike };
|
||||
|
||||
assert.ok(range.contains((<types.Position>startLike)));
|
||||
assert.ok(range.contains((<types.Position>endLike)));
|
||||
@@ -265,7 +265,7 @@ suite('ExtHostTypes', function () {
|
||||
});
|
||||
|
||||
test('Range, intersection', function () {
|
||||
let range = new types.Range(1, 1, 2, 11);
|
||||
const range = new types.Range(1, 1, 2, 11);
|
||||
let res: types.Range;
|
||||
|
||||
res = range.intersection(range)!;
|
||||
@@ -312,7 +312,7 @@ suite('ExtHostTypes', function () {
|
||||
});
|
||||
|
||||
test('Range, with', function () {
|
||||
let range = new types.Range(1, 1, 2, 11);
|
||||
const range = new types.Range(1, 1, 2, 11);
|
||||
|
||||
assert.ok(range.with(range.start) === range);
|
||||
assert.ok(range.with(undefined, range.end) === range);
|
||||
@@ -349,7 +349,7 @@ suite('ExtHostTypes', function () {
|
||||
|
||||
test('TextEdit', () => {
|
||||
|
||||
let range = new types.Range(1, 1, 2, 11);
|
||||
const range = new types.Range(1, 1, 2, 11);
|
||||
let edit = new types.TextEdit(range, undefined!);
|
||||
assert.strictEqual(edit.newText, '');
|
||||
assertToJSON(edit, { range: [{ line: 1, character: 1 }, { line: 2, character: 11 }], newText: '' });
|
||||
@@ -363,10 +363,10 @@ suite('ExtHostTypes', function () {
|
||||
|
||||
test('WorkspaceEdit', () => {
|
||||
|
||||
let a = URI.file('a.ts');
|
||||
let b = URI.file('b.ts');
|
||||
const a = URI.file('a.ts');
|
||||
const b = URI.file('b.ts');
|
||||
|
||||
let edit = new types.WorkspaceEdit();
|
||||
const edit = new types.WorkspaceEdit();
|
||||
assert.ok(!edit.has(a));
|
||||
|
||||
edit.set(a, [types.TextEdit.insert(new types.Position(0, 0), 'fff')]);
|
||||
@@ -418,13 +418,13 @@ suite('ExtHostTypes', function () {
|
||||
});
|
||||
|
||||
test('WorkspaceEdit - two edits for one resource', function () {
|
||||
let edit = new types.WorkspaceEdit();
|
||||
let uri = URI.parse('foo:bar');
|
||||
const edit = new types.WorkspaceEdit();
|
||||
const uri = URI.parse('foo:bar');
|
||||
edit.insert(uri, new types.Position(0, 0), 'Hello');
|
||||
edit.insert(uri, new types.Position(0, 0), 'Foo');
|
||||
|
||||
assert.strictEqual(edit._allEntries().length, 2);
|
||||
let [first, second] = edit._allEntries();
|
||||
const [first, second] = edit._allEntries();
|
||||
|
||||
assertType(first._type === types.FileEditType.Text);
|
||||
assertType(second._type === types.FileEditType.Text);
|
||||
@@ -444,7 +444,7 @@ suite('ExtHostTypes', function () {
|
||||
assertToJSON(new types.Location(URI.file('u.ts'), new types.Position(3, 4)), { uri: URI.parse('file:///u.ts').toJSON(), range: [{ line: 3, character: 4 }, { line: 3, character: 4 }] });
|
||||
assertToJSON(new types.Location(URI.file('u.ts'), new types.Range(1, 2, 3, 4)), { uri: URI.parse('file:///u.ts').toJSON(), range: [{ line: 1, character: 2 }, { line: 3, character: 4 }] });
|
||||
|
||||
let diag = new types.Diagnostic(new types.Range(0, 1, 2, 3), 'hello');
|
||||
const diag = new types.Diagnostic(new types.Range(0, 1, 2, 3), 'hello');
|
||||
assertToJSON(diag, { severity: 'Error', message: 'hello', range: [{ line: 0, character: 1 }, { line: 2, character: 3 }] });
|
||||
diag.source = 'me';
|
||||
assertToJSON(diag, { severity: 'Error', message: 'hello', range: [{ line: 0, character: 1 }, { line: 2, character: 3 }], source: 'me' });
|
||||
@@ -468,7 +468,7 @@ suite('ExtHostTypes', function () {
|
||||
|
||||
assertToJSON(new types.CompletionItem('complete'), { label: 'complete' });
|
||||
|
||||
let item = new types.CompletionItem('complete');
|
||||
const item = new types.CompletionItem('complete');
|
||||
item.kind = types.CompletionItemKind.Interface;
|
||||
assertToJSON(item, { label: 'complete', kind: 'Interface' });
|
||||
|
||||
@@ -476,7 +476,7 @@ suite('ExtHostTypes', function () {
|
||||
|
||||
test('SymbolInformation, old ctor', function () {
|
||||
|
||||
let info = new types.SymbolInformation('foo', types.SymbolKind.Array, new types.Range(1, 1, 2, 3));
|
||||
const info = new types.SymbolInformation('foo', types.SymbolKind.Array, new types.Range(1, 1, 2, 3));
|
||||
assert.ok(info.location instanceof types.Location);
|
||||
assert.strictEqual(info.location.uri, undefined);
|
||||
});
|
||||
|
||||
@@ -179,7 +179,7 @@ suite('ExtHostWorkspace', function () {
|
||||
});
|
||||
|
||||
test('Multiroot change event should have a delta, #29641', function (done) {
|
||||
let ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [] }, new NullLogService());
|
||||
const ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [] }, new NullLogService());
|
||||
|
||||
let finished = false;
|
||||
const finish = (error?: any) => {
|
||||
@@ -242,9 +242,9 @@ suite('ExtHostWorkspace', function () {
|
||||
});
|
||||
|
||||
test('Multiroot change keeps existing workspaces live', function () {
|
||||
let ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar'), 0)] }, new NullLogService());
|
||||
const ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.parse('foo:bar'), 0)] }, new NullLogService());
|
||||
|
||||
let firstFolder = ws.getWorkspaceFolders()![0];
|
||||
const 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.strictEqual(ws.getWorkspaceFolders()![1], firstFolder);
|
||||
@@ -528,8 +528,8 @@ suite('ExtHostWorkspace', function () {
|
||||
}
|
||||
};
|
||||
|
||||
let ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [] }, new NullLogService());
|
||||
let sub = ws.onDidChangeWorkspace(e => {
|
||||
const ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [] }, new NullLogService());
|
||||
const sub = ws.onDidChangeWorkspace(e => {
|
||||
try {
|
||||
assert.throws(() => {
|
||||
(<any>e).added = [];
|
||||
@@ -549,7 +549,7 @@ suite('ExtHostWorkspace', function () {
|
||||
test('`vscode.workspace.getWorkspaceFolder(file)` don\'t return workspace folder when file open from command line. #36221', function () {
|
||||
if (isWindows) {
|
||||
|
||||
let ws = createExtHostWorkspace(new TestRPCProtocol(), {
|
||||
const ws = createExtHostWorkspace(new TestRPCProtocol(), {
|
||||
id: 'foo', name: 'Test', folders: [
|
||||
aWorkspaceFolderData(URI.file('c:/Users/marek/Desktop/vsc_test/'), 0)
|
||||
]
|
||||
|
||||
@@ -18,7 +18,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
|
||||
|
||||
suite('MainThreadConfiguration', function () {
|
||||
|
||||
let proxy = {
|
||||
const proxy = {
|
||||
$initializeConfiguration: () => { }
|
||||
};
|
||||
let instantiationService: TestInstantiationService;
|
||||
|
||||
@@ -26,7 +26,7 @@ suite('MainThreadDiagnostics', function () {
|
||||
|
||||
test('clear markers on dispose', function () {
|
||||
|
||||
let diag = new MainThreadDiagnostics(
|
||||
const diag = new MainThreadDiagnostics(
|
||||
new class implements IExtHostContext {
|
||||
remoteAuthority = '';
|
||||
extensionHostKind = ExtensionHostKind.LocalProcess;
|
||||
@@ -68,7 +68,7 @@ suite('MainThreadDiagnostics', function () {
|
||||
|
||||
const changedData: [UriComponents, IMarkerData[]][][] = [];
|
||||
|
||||
let diag = new MainThreadDiagnostics(
|
||||
const diag = new MainThreadDiagnostics(
|
||||
new class implements IExtHostContext {
|
||||
remoteAuthority = '';
|
||||
extensionHostKind = ExtensionHostKind.LocalProcess;
|
||||
@@ -132,7 +132,7 @@ suite('MainThreadDiagnostics', function () {
|
||||
|
||||
const changedData: [UriComponents, IMarkerData[]][][] = [];
|
||||
|
||||
let diag = new MainThreadDiagnostics(
|
||||
const diag = new MainThreadDiagnostics(
|
||||
new class implements IExtHostContext {
|
||||
remoteAuthority = '';
|
||||
extensionHostKind = ExtensionHostKind.LocalProcess;
|
||||
|
||||
@@ -17,10 +17,10 @@ suite('MainThreadDocumentContentProviders', function () {
|
||||
|
||||
test('events are processed properly', function () {
|
||||
|
||||
let uri = URI.parse('test:uri');
|
||||
let model = createTextModel('1', undefined, undefined, uri);
|
||||
const uri = URI.parse('test:uri');
|
||||
const model = createTextModel('1', undefined, undefined, uri);
|
||||
|
||||
let providers = new MainThreadDocumentContentProviders(new TestRPCProtocol(), null!, null!,
|
||||
const providers = new MainThreadDocumentContentProviders(new TestRPCProtocol(), null!, null!,
|
||||
new class extends mock<IModelService>() {
|
||||
override getModel(_uri: URI) {
|
||||
assert.strictEqual(uri.toString(), _uri.toString());
|
||||
|
||||
@@ -40,7 +40,7 @@ suite('BoundModelReferenceCollection', function () {
|
||||
|
||||
test('max size', function () {
|
||||
|
||||
let disposed: number[] = [];
|
||||
const disposed: number[] = [];
|
||||
|
||||
col.add(
|
||||
URI.parse('test://farboo'),
|
||||
@@ -76,7 +76,7 @@ suite('BoundModelReferenceCollection', function () {
|
||||
col.dispose();
|
||||
col = new BoundModelReferenceCollection(extUri, 10000, 10000, 2);
|
||||
|
||||
let disposed: number[] = [];
|
||||
const disposed: number[] = [];
|
||||
|
||||
col.add(
|
||||
URI.parse('test://xxxxxxx'),
|
||||
|
||||
@@ -43,7 +43,7 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
let modelService: ModelService;
|
||||
let codeEditorService: TestCodeEditorService;
|
||||
let textFileService: ITextFileService;
|
||||
let deltas: IDocumentsAndEditorsDelta[] = [];
|
||||
const deltas: IDocumentsAndEditorsDelta[] = [];
|
||||
|
||||
function myCreateTestCodeEditor(model: ITextModel | undefined): ITestCodeEditor {
|
||||
return createTestCodeEditor(model, {
|
||||
|
||||
@@ -194,9 +194,9 @@ suite('MainThreadEditors', () => {
|
||||
|
||||
test(`applyWorkspaceEdit returns false if model is changed by user`, () => {
|
||||
|
||||
let model = modelService.createModel('something', null, resource);
|
||||
const model = modelService.createModel('something', null, resource);
|
||||
|
||||
let workspaceResourceEdit: IWorkspaceTextEditDto = {
|
||||
const workspaceResourceEdit: IWorkspaceTextEditDto = {
|
||||
_type: WorkspaceEditType.Text,
|
||||
resource: resource,
|
||||
modelVersionId: model.getVersionId(),
|
||||
@@ -216,9 +216,9 @@ suite('MainThreadEditors', () => {
|
||||
|
||||
test(`issue #54773: applyWorkspaceEdit checks model version in race situation`, () => {
|
||||
|
||||
let model = modelService.createModel('something', null, resource);
|
||||
const model = modelService.createModel('something', null, resource);
|
||||
|
||||
let workspaceResourceEdit1: IWorkspaceTextEditDto = {
|
||||
const workspaceResourceEdit1: IWorkspaceTextEditDto = {
|
||||
_type: WorkspaceEditType.Text,
|
||||
resource: resource,
|
||||
modelVersionId: model.getVersionId(),
|
||||
@@ -227,7 +227,7 @@ suite('MainThreadEditors', () => {
|
||||
range: new Range(1, 1, 1, 1)
|
||||
}
|
||||
};
|
||||
let workspaceResourceEdit2: IWorkspaceTextEditDto = {
|
||||
const workspaceResourceEdit2: IWorkspaceTextEditDto = {
|
||||
_type: WorkspaceEditType.Text,
|
||||
resource: resource,
|
||||
modelVersionId: model.getVersionId(),
|
||||
@@ -237,11 +237,11 @@ suite('MainThreadEditors', () => {
|
||||
}
|
||||
};
|
||||
|
||||
let p1 = bulkEdits.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit1] }).then((result) => {
|
||||
const p1 = bulkEdits.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit1] }).then((result) => {
|
||||
// first edit request succeeds
|
||||
assert.strictEqual(result, true);
|
||||
});
|
||||
let p2 = bulkEdits.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit2] }).then((result) => {
|
||||
const p2 = bulkEdits.$tryApplyWorkspaceEdit({ edits: [workspaceResourceEdit2] }).then((result) => {
|
||||
// second edit request fails
|
||||
assert.strictEqual(result, false);
|
||||
});
|
||||
|
||||
@@ -88,7 +88,7 @@ export class TestRPCProtocol implements IExtHostContext, IExtHostRpcService {
|
||||
}
|
||||
|
||||
private _createProxy<T>(proxyId: string): T {
|
||||
let handler = {
|
||||
const handler = {
|
||||
get: (target: any, name: PropertyKey) => {
|
||||
if (typeof name === 'string' && !target[name] && name.charCodeAt(0) === CharCode.DollarSign) {
|
||||
target[name] = (...myArgs: any[]) => {
|
||||
@@ -118,7 +118,7 @@ export class TestRPCProtocol implements IExtHostContext, IExtHostRpcService {
|
||||
const wireArgs = simulateWireTransfer(args);
|
||||
let p: Promise<any>;
|
||||
try {
|
||||
let result = (<Function>instance[path]).apply(instance, wireArgs);
|
||||
const result = (<Function>instance[path]).apply(instance, wireArgs);
|
||||
p = isThenable(result) ? result : Promise.resolve(result);
|
||||
} catch (err) {
|
||||
p = Promise.reject(err);
|
||||
|
||||
@@ -711,9 +711,9 @@ suite('ExtHostSearch', () => {
|
||||
|
||||
function assertResults(actual: IFileMatch[], expected: vscode.TextSearchResult[]) {
|
||||
const actualTextSearchResults: vscode.TextSearchResult[] = [];
|
||||
for (let fileMatch of actual) {
|
||||
for (const fileMatch of actual) {
|
||||
// Make relative
|
||||
for (let lineResult of fileMatch.results!) {
|
||||
for (const lineResult of fileMatch.results!) {
|
||||
if (resultIsMatch(lineResult)) {
|
||||
actualTextSearchResults.push({
|
||||
preview: {
|
||||
|
||||
Reference in New Issue
Block a user