-
Notifications
You must be signed in to change notification settings - Fork 510
/
Copy pathCodeActions.ts
35 lines (30 loc) · 1.16 KB
/
CodeActions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import vscode = require('vscode');
import { LanguageClient } from 'vscode-languageclient';
import Window = vscode.window;
import { IFeature } from '../feature';
export class CodeActionsFeature implements IFeature {
private command: vscode.Disposable;
private languageClient: LanguageClient;
constructor() {
this.command = vscode.commands.registerCommand('PowerShell.ApplyCodeActionEdits', (edit: any) => {
Window.activeTextEditor.edit((editBuilder) => {
editBuilder.replace(
new vscode.Range(
edit.StartLineNumber - 1,
edit.StartColumnNumber - 1,
edit.EndLineNumber - 1,
edit.EndColumnNumber - 1),
edit.Text);
});
});
}
public setLanguageClient(languageclient: LanguageClient) {
this.languageClient = languageclient;
}
public dispose() {
this.command.dispose();
}
}