Skip to content

Commit

Permalink
perf(extension): Ensure Angular code actions are only retrieved in An…
Browse files Browse the repository at this point in the history
…gular 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.
  • Loading branch information
atscott committed Dec 29, 2022
1 parent 38729c9 commit 13d165c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ export class AngularLanguageClient implements vscode.Disposable {
revealOutputChannelOn: lsp.RevealOutputChannelOn.Never,
outputChannel: this.outputChannel,
middleware: {
provideCodeActions: async (
document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext,
token: vscode.CancellationToken, next: lsp.ProvideCodeActionsSignature) => {
if (await this.isInAngularProject(document) &&
isInsideInlineTemplateRegion(document, range.start) &&
isInsideInlineTemplateRegion(document, range.end)) {
return next(document, range, context, token);
}
},
prepareRename: async (
document: vscode.TextDocument, position: vscode.Position,
token: vscode.CancellationToken, next: lsp.PrepareRenameSignature) => {
Expand Down

0 comments on commit 13d165c

Please sign in to comment.