mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Enable no unused parameters in vscode-api tests
This commit is contained in:
parent
f1c7c19a36
commit
55567633b3
|
@ -65,7 +65,7 @@ suite('commands namespace tests', () => {
|
|||
});
|
||||
|
||||
return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => {
|
||||
return window.showTextDocument(doc).then(editor => {
|
||||
return window.showTextDocument(doc).then(_editor => {
|
||||
return commands.executeCommand('t1', 12345, commands);
|
||||
}).then(() => {
|
||||
assert.ok(args);
|
||||
|
|
|
@ -152,7 +152,7 @@ suite('editor tests', () => {
|
|||
});
|
||||
|
||||
test('issue #16573: Extension API: insertSpaces and tabSize are undefined', () => {
|
||||
return withRandomFileEditor('Hello world!\n\tHello world!', (editor, doc) => {
|
||||
return withRandomFileEditor('Hello world!\n\tHello world!', (editor, _doc) => {
|
||||
|
||||
assert.equal(editor.options.tabSize, 4);
|
||||
assert.equal(editor.options.insertSpaces, false);
|
||||
|
@ -180,18 +180,18 @@ suite('editor tests', () => {
|
|||
});
|
||||
|
||||
test('issue #20757: Overlapping ranges are not allowed!', () => {
|
||||
return withRandomFileEditor('Hello world!\n\tHello world!', (editor, doc) => {
|
||||
return withRandomFileEditor('Hello world!\n\tHello world!', (editor, _doc) => {
|
||||
return editor.edit((builder) => {
|
||||
// create two edits that overlap (i.e. are illegal)
|
||||
builder.replace(new Range(0, 0, 0, 2), 'He');
|
||||
builder.replace(new Range(0, 1, 0, 3), 'el');
|
||||
}).then(
|
||||
|
||||
(applied) => {
|
||||
(_applied) => {
|
||||
assert.ok(false, 'edit with overlapping ranges should fail');
|
||||
},
|
||||
|
||||
(err) => {
|
||||
(_err) => {
|
||||
assert.ok(true, 'edit with overlapping ranges should fail');
|
||||
}
|
||||
);
|
||||
|
|
|
@ -95,7 +95,7 @@ suite('languages namespace tests', () => {
|
|||
let uri = vscode.Uri.parse('ttt:path.far');
|
||||
|
||||
let r1 = vscode.languages.registerCodeActionsProvider({ pattern: '*.far', scheme: 'ttt' }, {
|
||||
provideCodeActions(document, range, ctx): vscode.Command[] {
|
||||
provideCodeActions(_document, _range, ctx): vscode.Command[] {
|
||||
|
||||
assert.equal(ctx.diagnostics.length, 2);
|
||||
let [first, second] = ctx.diagnostics;
|
||||
|
@ -119,9 +119,9 @@ suite('languages namespace tests', () => {
|
|||
let r4 = vscode.languages.createDiagnosticCollection();
|
||||
r4.set(uri, [diag2]);
|
||||
|
||||
return vscode.workspace.openTextDocument(uri).then(doc => {
|
||||
return vscode.workspace.openTextDocument(uri).then(_doc => {
|
||||
return vscode.commands.executeCommand('vscode.executeCodeActionProvider', uri, new vscode.Range(0, 0, 0, 10));
|
||||
}).then(commands => {
|
||||
}).then(_commands => {
|
||||
assert.ok(ran);
|
||||
vscode.Disposable.from(r1, r2, r3, r4).dispose();
|
||||
});
|
||||
|
@ -134,7 +134,7 @@ suite('languages namespace tests', () => {
|
|||
let jsonDocumentFilter = [{ language: 'json', pattern: '**/package.json' }, { language: 'json', pattern: '**/bower.json' }, { language: 'json', pattern: '**/.bower.json' }];
|
||||
|
||||
let r1 = vscode.languages.registerCompletionItemProvider(jsonDocumentFilter, {
|
||||
provideCompletionItems: (document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): vscode.CompletionItem[] => {
|
||||
provideCompletionItems: (_document: vscode.TextDocument, _position: vscode.Position, _token: vscode.CancellationToken): vscode.CompletionItem[] => {
|
||||
let proposal = new vscode.CompletionItem('foo');
|
||||
proposal.kind = vscode.CompletionItemKind.Property;
|
||||
ran = true;
|
||||
|
@ -142,7 +142,7 @@ suite('languages namespace tests', () => {
|
|||
}
|
||||
});
|
||||
|
||||
return vscode.workspace.openTextDocument(uri).then(doc => {
|
||||
return vscode.workspace.openTextDocument(uri).then(_doc => {
|
||||
return vscode.commands.executeCommand<vscode.CompletionList>('vscode.executeCompletionItemProvider', uri, new vscode.Position(1, 0));
|
||||
}).then((result: vscode.CompletionList | undefined) => {
|
||||
r1.dispose();
|
||||
|
|
|
@ -16,7 +16,7 @@ suite('window namespace tests', () => {
|
|||
|
||||
test('editor, active text editor', () => {
|
||||
return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => {
|
||||
return window.showTextDocument(doc).then((editor) => {
|
||||
return window.showTextDocument(doc).then((_editor) => {
|
||||
const active = window.activeTextEditor;
|
||||
assert.ok(active);
|
||||
assert.ok(pathEquals(active!.document.uri.fsPath, doc.uri.fsPath));
|
||||
|
@ -26,7 +26,7 @@ suite('window namespace tests', () => {
|
|||
|
||||
test('editor, opened via resource', () => {
|
||||
const uri = Uri.file(join(workspace.rootPath || '', './far.js'));
|
||||
return window.showTextDocument(uri).then((editor) => {
|
||||
return window.showTextDocument(uri).then((_editor) => {
|
||||
const active = window.activeTextEditor;
|
||||
assert.ok(active);
|
||||
assert.ok(pathEquals(active!.document.uri.fsPath, uri.fsPath));
|
||||
|
@ -57,26 +57,26 @@ suite('window namespace tests', () => {
|
|||
test('editor, onDidChangeVisibleTextEditors', () => {
|
||||
|
||||
let eventCounter = 0;
|
||||
let reg = window.onDidChangeVisibleTextEditors(editor => {
|
||||
let reg = window.onDidChangeVisibleTextEditors(_editor => {
|
||||
eventCounter += 1;
|
||||
});
|
||||
|
||||
return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => {
|
||||
return window.showTextDocument(doc, ViewColumn.One).then(editor => {
|
||||
return window.showTextDocument(doc, ViewColumn.One).then(_editor => {
|
||||
assert.equal(eventCounter, 1);
|
||||
return doc;
|
||||
});
|
||||
}).then(doc => {
|
||||
return window.showTextDocument(doc, ViewColumn.Two).then(editor => {
|
||||
return window.showTextDocument(doc, ViewColumn.Two).then(_editor => {
|
||||
assert.equal(eventCounter, 2);
|
||||
return doc;
|
||||
});
|
||||
}).then(doc => {
|
||||
return window.showTextDocument(doc, ViewColumn.Three).then(editor => {
|
||||
return window.showTextDocument(doc, ViewColumn.Three).then(_editor => {
|
||||
assert.equal(eventCounter, 3);
|
||||
return doc;
|
||||
});
|
||||
}).then(doc => {
|
||||
}).then(_doc => {
|
||||
reg.dispose();
|
||||
});
|
||||
});
|
||||
|
@ -527,7 +527,7 @@ suite('window namespace tests', () => {
|
|||
|
||||
test('showQuickPick, never resolve promise and cancel - #22453', function () {
|
||||
|
||||
const result = window.showQuickPick(new Promise<string[]>(resolve => { }));
|
||||
const result = window.showQuickPick(new Promise<string[]>(_resolve => { }));
|
||||
|
||||
const a = result.then(value => {
|
||||
assert.equal(value, undefined);
|
||||
|
@ -540,9 +540,9 @@ suite('window namespace tests', () => {
|
|||
const p = window.showWorkspaceFolderPick(undefined);
|
||||
|
||||
return commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem').then(() => {
|
||||
return p.then(workspace => {
|
||||
return p.then(_workspace => {
|
||||
assert.ok(true);
|
||||
}, error => {
|
||||
}, _error => {
|
||||
assert.ok(false);
|
||||
});
|
||||
});
|
||||
|
@ -568,7 +568,7 @@ suite('window namespace tests', () => {
|
|||
return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => window.showTextDocument(doc)).then(editor => {
|
||||
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve, _reject) => {
|
||||
|
||||
let subscription = window.onDidChangeTextEditorSelection(e => {
|
||||
assert.ok(e.textEditor === editor);
|
||||
|
|
|
@ -69,9 +69,9 @@ suite('workspace-namespace', () => {
|
|||
});
|
||||
|
||||
test('openTextDocument, illegal path', () => {
|
||||
return vscode.workspace.openTextDocument('funkydonky.txt').then(doc => {
|
||||
return vscode.workspace.openTextDocument('funkydonky.txt').then(_doc => {
|
||||
throw new Error('missing error');
|
||||
}, err => {
|
||||
}, _err => {
|
||||
// good!
|
||||
});
|
||||
});
|
||||
|
@ -271,8 +271,8 @@ suite('workspace-namespace', () => {
|
|||
return vscode.window.showTextDocument(doc).then((editor) => {
|
||||
return editor.edit((builder) => {
|
||||
builder.insert(new vscode.Position(0, 0), 'Hello World');
|
||||
}).then(applied => {
|
||||
return doc.save().then(saved => {
|
||||
}).then(_applied => {
|
||||
return doc.save().then(_saved => {
|
||||
assert.ok(onDidOpenTextDocument);
|
||||
assert.ok(onDidChangeTextDocument);
|
||||
assert.ok(onDidSaveTextDocument);
|
||||
|
@ -336,7 +336,7 @@ suite('workspace-namespace', () => {
|
|||
// missing scheme
|
||||
return vscode.workspace.openTextDocument(vscode.Uri.parse('notThere://foo/far/boo/bar')).then(() => {
|
||||
assert.ok(false, 'expected failure');
|
||||
}, err => {
|
||||
}, _err => {
|
||||
// expected
|
||||
});
|
||||
});
|
||||
|
@ -372,12 +372,12 @@ suite('workspace-namespace', () => {
|
|||
|
||||
// duplicate registration
|
||||
let registration1 = vscode.workspace.registerTextDocumentContentProvider('foo', {
|
||||
provideTextDocumentContent(uri) {
|
||||
provideTextDocumentContent(_uri) {
|
||||
return '1';
|
||||
}
|
||||
});
|
||||
let registration2 = vscode.workspace.registerTextDocumentContentProvider('foo', {
|
||||
provideTextDocumentContent(uri): string {
|
||||
provideTextDocumentContent(_uri): string {
|
||||
throw new Error('fail');
|
||||
}
|
||||
});
|
||||
|
@ -392,13 +392,13 @@ suite('workspace-namespace', () => {
|
|||
test('registerTextDocumentContentProvider, invalid text', function () {
|
||||
|
||||
let registration = vscode.workspace.registerTextDocumentContentProvider('foo', {
|
||||
provideTextDocumentContent(uri) {
|
||||
provideTextDocumentContent(_uri) {
|
||||
return <any>123;
|
||||
}
|
||||
});
|
||||
return vscode.workspace.openTextDocument(vscode.Uri.parse('foo://auth/path')).then(() => {
|
||||
assert.ok(false, 'expected failure');
|
||||
}, err => {
|
||||
}, _err => {
|
||||
// expected
|
||||
registration.dispose();
|
||||
});
|
||||
|
@ -407,7 +407,7 @@ suite('workspace-namespace', () => {
|
|||
test('registerTextDocumentContentProvider, show virtual document', function () {
|
||||
|
||||
let registration = vscode.workspace.registerTextDocumentContentProvider('foo', {
|
||||
provideTextDocumentContent(uri) {
|
||||
provideTextDocumentContent(_uri) {
|
||||
return 'I am virtual';
|
||||
}
|
||||
});
|
||||
|
@ -426,7 +426,7 @@ suite('workspace-namespace', () => {
|
|||
|
||||
let callCount = 0;
|
||||
let registration = vscode.workspace.registerTextDocumentContentProvider('foo', {
|
||||
provideTextDocumentContent(uri) {
|
||||
provideTextDocumentContent(_uri) {
|
||||
callCount += 1;
|
||||
return 'I am virtual';
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ suite('workspace-namespace', () => {
|
|||
test('registerTextDocumentContentProvider, empty doc', function () {
|
||||
|
||||
let registration = vscode.workspace.registerTextDocumentContentProvider('foo', {
|
||||
provideTextDocumentContent(uri) {
|
||||
provideTextDocumentContent(_uri) {
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
@ -467,7 +467,7 @@ suite('workspace-namespace', () => {
|
|||
|
||||
let registration = vscode.workspace.registerTextDocumentContentProvider('foo', {
|
||||
onDidChange: emitter.event,
|
||||
provideTextDocumentContent(uri) {
|
||||
provideTextDocumentContent(_uri) {
|
||||
return 'call' + (callCount++);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
"module": "commonjs",
|
||||
"target": "ES5",
|
||||
"outDir": "out",
|
||||
"noUnusedLocals": true,
|
||||
"lib": [
|
||||
"es2015"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"strict": true
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
|
|
Loading…
Reference in a new issue