Skip to content

Commit 478eed7

Browse files
atscottdylhunn
authored andcommitted
perf(extension): Ensure Angular code actions are only retrieved in Angular contexts (#1842)
This change extends the short-circuit logic that has been enabled for other features to the code actions as well. Original issue was #1176 New performance issues have been reported recently (#1840), likely due to the code fixes for auto imports. (cherry picked from commit 13d165c)
1 parent 4ec045c commit 478eed7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

client/src/client.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ export class AngularLanguageClient implements vscode.Disposable {
6060
revealOutputChannelOn: lsp.RevealOutputChannelOn.Never,
6161
outputChannel: this.outputChannel,
6262
middleware: {
63+
provideCodeActions: async (
64+
document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext,
65+
token: vscode.CancellationToken, next: lsp.ProvideCodeActionsSignature) => {
66+
if (await this.isInAngularProject(document) &&
67+
isInsideInlineTemplateRegion(document, range.start) &&
68+
isInsideInlineTemplateRegion(document, range.end)) {
69+
return next(document, range, context, token);
70+
}
71+
},
6372
prepareRename: async (
6473
document: vscode.TextDocument, position: vscode.Position,
6574
token: vscode.CancellationToken, next: lsp.PrepareRenameSignature) => {

0 commit comments

Comments
 (0)