Skip to content

Commit

Permalink
Remove deprecated PowerShell.ApplyCodeActionEdits
Browse files Browse the repository at this point in the history
This is no longer necessary as edits are constructed by the server and
sent over LSP.
  • Loading branch information
andyleejordan committed Jan 20, 2024
1 parent 3c3d1dd commit d367094
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/features/CodeActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,24 @@
// 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);
});
}

public dispose(): void {
this.applyEditsCommand.dispose();
this.showDocumentationCommand.dispose();
}

Expand Down

0 comments on commit d367094

Please sign in to comment.