mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 09:18:59 +00:00
Skip interrupting geterr
in automatic cases (#215389)
Quick fixes already don't interrupt `geterr` requests so this likely won't slow down the automatic lightbulb
This commit is contained in:
parent
b7e5750fa9
commit
94274c47b8
|
@ -541,11 +541,12 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider<TsCodeActi
|
|||
return undefined;
|
||||
}
|
||||
|
||||
const response = await this.client.interruptGetErr(() => {
|
||||
const response = await this.interruptGetErrIfNeeded(context, () => {
|
||||
const file = this.client.toOpenTsFilePath(document);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
this.formattingOptionsManager.ensureConfigurationForDocument(document, token);
|
||||
|
||||
const args: Proto.GetApplicableRefactorsRequestArgs = {
|
||||
|
@ -595,6 +596,17 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider<TsCodeActi
|
|||
return this.pruneInvalidActions(this.appendInvalidActions(actions), context.only, /* numberOfInvalid = */ 5);
|
||||
}
|
||||
|
||||
private interruptGetErrIfNeeded<R>(context: vscode.CodeActionContext, f: () => R): R {
|
||||
// Only interrupt diagnostics computation when code actions are explicitly
|
||||
// (such as using the refactor command or a keybinding). This is a clear
|
||||
// user action so we want to return results as quickly as possible.
|
||||
if (context.triggerKind === vscode.CodeActionTriggerKind.Invoke) {
|
||||
return this.client.interruptGetErr(f);
|
||||
} else {
|
||||
return f();
|
||||
}
|
||||
}
|
||||
|
||||
public async resolveCodeAction(
|
||||
codeAction: TsCodeAction,
|
||||
token: vscode.CancellationToken,
|
||||
|
|
Loading…
Reference in a new issue