diff --git a/src/features/CodeActions.ts b/src/features/CodeActions.ts index cf0de58a74..4be6ac9ed6 100644 --- a/src/features/CodeActions.ts +++ b/src/features/CodeActions.ts @@ -2,28 +2,17 @@ // Licensed under the MIT License. import vscode = require("vscode"); -import Window = vscode.window; import { ILogger } from "../logging"; export class CodeActionsFeature implements vscode.Disposable { - private applyEditsCommand: vscode.Disposable; private showDocumentationCommand: vscode.Disposable; constructor(private log: ILogger) { - // TODO: What type is `edit`, what uses this, and is it working? - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.applyEditsCommand = vscode.commands.registerCommand("PowerShell.ApplyCodeActionEdits", async (edit: any) => { - await Window.activeTextEditor?.edit((editBuilder) => { - editBuilder.replace( - new vscode.Range( - edit.StartLineNumber - 1, - edit.StartColumnNumber - 1, - edit.EndLineNumber - 1, - edit.EndColumnNumber - 1), - edit.Text); - }); - }); - + // NOTE: While not exposed to the user via package.json, this is + // required as the server's code action sends across a command name. + // + // TODO: In the far future with LSP 3.19 the server can just set a URL + // and this can go away. See https://github.com/microsoft/language-server-protocol/issues/1548 this.showDocumentationCommand = vscode.commands.registerCommand("PowerShell.ShowCodeActionDocumentation", async (ruleName: string) => { await this.showRuleDocumentation(ruleName); @@ -31,7 +20,6 @@ export class CodeActionsFeature implements vscode.Disposable { } public dispose(): void { - this.applyEditsCommand.dispose(); this.showDocumentationCommand.dispose(); }