Skip to content

Commit 2e6e8c9

Browse files
authored
Revert "feat: Add option to disable code actions (#1849)" (#1856)
This reverts commit 3453361. This feature was only added as a potential mitigation for performance issues in the v15 release. These performance issues have been unreproducable by the team and disabling quick fixes using this feature has not been confirmed to resolve the problem from developers expeiencing the issue.
1 parent 86292ea commit 2e6e8c9

File tree

5 files changed

+8
-24
lines changed

5 files changed

+8
-24
lines changed

client/src/client.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,6 @@ function constructArgs(
452452
if (disableAutomaticNgcc) {
453453
args.push('--disableAutomaticNgcc');
454454
}
455-
const disableCodeActions = config.get<boolean>('angular.disableCodeActions');
456-
if (disableCodeActions) {
457-
args.push('--disableCodeActions');
458-
}
459455

460456
const forceStrictTemplates = config.get<boolean>('angular.forceStrictTemplates');
461457
if (forceStrictTemplates) {

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,6 @@
146146
"default": false,
147147
"markdownDescription": "Disable the step to automatically run ngcc. [ngcc](https://github.com/angular/angular/blob/main/packages/compiler/design/architecture.md#high-level-proposal) is required to run and gather metadata from libraries not published with Ivy instructions. This can be run outside of VSCode instead (for example, as part of the build/rebuild in the CLI). Note that ngcc needs to run not only at startup, but also whenever the dependencies change. Failing to run ngcc when required can result in incomplete information and spurious errors reported by the language service."
148148
},
149-
"angular.disableCodeActions": {
150-
"type": "boolean",
151-
"default": false,
152-
"markdownDescription": "Disable code actions in Angular contexts, including quick fixes in template files which add missing imports. Some code actions require global project analysis, so it may be desirable to disable them for performance reasons."
153-
},
154149
"angular.forceStrictTemplates": {
155150
"type": "boolean",
156151
"default": false,

server/src/cmdline_utils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ interface CommandLineOptions {
3636
* If true, skips the running ngcc when using Ivy LS.
3737
*/
3838
disableAutomaticNgcc: boolean;
39-
disableCodeActions: boolean;
4039
logFile?: string;
4140
logVerbosity?: string;
4241
logToConsole: boolean;
@@ -53,7 +52,6 @@ export function parseCommandLine(argv: string[]): CommandLineOptions {
5352
help: hasArgument(argv, '--help'),
5453
ivy: !hasArgument(argv, '--viewEngine'),
5554
disableAutomaticNgcc: hasArgument(argv, '--disableAutomaticNgcc'),
56-
disableCodeActions: hasArgument(argv, '--disableCodeActions'),
5755
logFile: findArgument(argv, '--logFile'),
5856
logVerbosity: findArgument(argv, '--logVerbosity'),
5957
logToConsole: hasArgument(argv, '--logToConsole'),

server/src/server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ function main() {
4444
resolvedNgLsPath: ng.resolvedPath,
4545
ivy: isG3 ? true : options.ivy,
4646
disableAutomaticNgcc: options.disableAutomaticNgcc || options.untrustedWorkspace,
47-
disableCodeActions: options.disableCodeActions,
4847
logToConsole: options.logToConsole,
4948
includeAutomaticOptionalChainCompletions: options.includeAutomaticOptionalChainCompletions,
5049
includeCompletionsWithSnippetText: options.includeCompletionsWithSnippetText,

server/src/session.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export interface SessionOptions {
3131
resolvedNgLsPath: string;
3232
ivy: boolean;
3333
disableAutomaticNgcc: boolean;
34-
disableCodeActions: boolean;
3534
logToConsole: boolean;
3635
includeAutomaticOptionalChainCompletions: boolean;
3736
includeCompletionsWithSnippetText: boolean;
@@ -116,7 +115,7 @@ export class Session {
116115
}
117116
});
118117

119-
this.addProtocolHandlers(this.connection, options);
118+
this.addProtocolHandlers(this.connection);
120119
this.projectService = this.createProjectService(options);
121120
}
122121

@@ -184,8 +183,8 @@ export class Session {
184183
return projSvc;
185184
}
186185

187-
private addProtocolHandlers(conn: lsp.Connection, options: SessionOptions) {
188-
conn.onInitialize(p => this.onInitialize(p, options));
186+
private addProtocolHandlers(conn: lsp.Connection) {
187+
conn.onInitialize(p => this.onInitialize(p));
189188
conn.onDidOpenTextDocument(p => this.onDidOpenTextDocument(p));
190189
conn.onDidCloseTextDocument(p => this.onDidCloseTextDocument(p));
191190
conn.onDidChangeTextDocument(p => this.onDidChangeTextDocument(p));
@@ -207,10 +206,8 @@ export class Session {
207206
conn.onCodeLens(p => this.onCodeLens(p));
208207
conn.onCodeLensResolve(p => this.onCodeLensResolve(p));
209208
conn.onSignatureHelp(p => this.onSignatureHelp(p));
210-
if (!options.disableCodeActions) {
211-
conn.onCodeAction(p => this.onCodeAction(p));
212-
conn.onCodeActionResolve(p => this.onCodeActionResolve(p));
213-
}
209+
conn.onCodeAction(p => this.onCodeAction(p));
210+
conn.onCodeActionResolve(p => this.onCodeActionResolve(p));
214211
}
215212

216213
private onCodeAction(params: lsp.CodeActionParams): lsp.CodeAction[]|null {
@@ -710,8 +707,7 @@ export class Session {
710707
return project;
711708
}
712709

713-
private onInitialize(params: lsp.InitializeParams, options: SessionOptions):
714-
lsp.InitializeResult {
710+
private onInitialize(params: lsp.InitializeParams): lsp.InitializeResult {
715711
this.snippetSupport =
716712
params.capabilities.textDocument?.completion?.completionItem?.snippetSupport;
717713
const serverOptions: ServerOptions = {
@@ -745,7 +741,7 @@ export class Session {
745741
workspace: {
746742
workspaceFolders: {supported: true},
747743
},
748-
codeActionProvider: (this.ivy && !options.disableCodeActions) ? {
744+
codeActionProvider: this.ivy ? {
749745
resolveProvider: true,
750746
// Now the Angular code action provider only supports `QuickFix`. If leave the
751747
// `codeActionKinds` empty, all action requests will be sent to the Angular language
@@ -756,7 +752,7 @@ export class Session {
756752
// [here](https://github.com/angular/vscode-ng-language-service/issues/1828)
757753
codeActionKinds: [lsp.CodeActionKind.QuickFix],
758754
} :
759-
undefined,
755+
undefined,
760756
},
761757
serverOptions,
762758
};

0 commit comments

Comments
 (0)