Interupt TS references and implementations requests

Fixes #60213

These are low priority UI elements and should not block user ui requests that come in, such as completions
This commit is contained in:
Matt Bierner
2018-11-27 16:47:38 -08:00
parent 1a1987dee6
commit 42145f1f0c
2 changed files with 22 additions and 25 deletions

View File

@@ -24,7 +24,7 @@ export default class TypeScriptImplementationsCodeLensProvider extends TypeScrip
const codeLens = inputCodeLens as ReferencesCodeLens;
const args = typeConverters.Position.toFileLocationRequestArgs(codeLens.file, codeLens.range.start);
const response = await this.client.execute('implementation', args, token);
const response = await this.client.execute('implementation', args, token, /* lowPriority */ true);
if (response.type !== 'response' || !response.body) {
codeLens.command = {
title: localize('implementationsErrorLabel', 'Could not determine implementations'),

View File

@@ -17,12 +17,16 @@ const localize = nls.loadMessageBundle();
class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLensProvider {
public resolveCodeLens(inputCodeLens: vscode.CodeLens, token: vscode.CancellationToken): Promise<vscode.CodeLens> {
public async resolveCodeLens(inputCodeLens: vscode.CodeLens, token: vscode.CancellationToken): Promise<vscode.CodeLens> {
const codeLens = inputCodeLens as ReferencesCodeLens;
const args = typeConverters.Position.toFileLocationRequestArgs(codeLens.file, codeLens.range.start);
return this.client.execute('references', args, token).then(response => {
const response = await this.client.execute('references', args, token, /* lowPriority */ true);
if (response.type !== 'response' || !response.body) {
throw codeLens;
codeLens.command = {
title: localize('referenceErrorLabel', 'Could not determine references'),
command: ''
};
return codeLens;
}
const locations = response.body.refs
@@ -41,13 +45,6 @@ class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLensProvide
arguments: [codeLens.document, codeLens.range.start, locations]
};
return codeLens;
}).catch(() => {
codeLens.command = {
title: localize('referenceErrorLabel', 'Could not determine references'),
command: ''
};
return codeLens;
});
}
protected extractSymbol(