File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ import vscode = require( 'vscode' ) ;
2
+ import { LanguageClient , RequestType , NotificationType } from 'vscode-languageclient' ;
3
+ import Window = vscode . window ;
4
+
5
+ export function registerCodeActionCommands ( client : LanguageClient ) : void {
6
+ vscode . commands . registerCommand ( 'PowerShell.ApplyCodeActionEdits' , ( edit : any ) => {
7
+ console . log ( "Applying edits" ) ;
8
+ console . log ( edit ) ;
9
+
10
+ var workspaceEdit = new vscode . WorkspaceEdit ( ) ;
11
+ workspaceEdit . set (
12
+ vscode . Uri . file ( edit . File ) ,
13
+ [
14
+ new vscode . TextEdit (
15
+ new vscode . Range (
16
+ edit . StartLineNumber - 1 ,
17
+ edit . StartColumnNumber - 1 ,
18
+ edit . EndLineNumber - 1 ,
19
+ edit . EndColumnNumber - 1 ) ,
20
+ edit . Text )
21
+ ] ) ;
22
+ vscode . workspace . applyEdit ( workspaceEdit ) ;
23
+ } ) ;
24
+ }
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { registerOpenInISECommand } from './features/OpenInISE';
20
20
import { registerPowerShellFindModuleCommand } from './features/PowerShellFindModule' ;
21
21
import { registerConsoleCommands } from './features/Console' ;
22
22
import { registerExtensionCommands } from './features/ExtensionCommands' ;
23
+ import { registerCodeActionCommands } from './features/CodeActions' ;
23
24
24
25
import net = require( 'net' ) ;
25
26
@@ -317,6 +318,7 @@ function registerFeatures() {
317
318
registerOpenInISECommand ( ) ;
318
319
registerPowerShellFindModuleCommand ( languageServerClient ) ;
319
320
registerExtensionCommands ( languageServerClient ) ;
321
+ registerCodeActionCommands ( languageServerClient ) ;
320
322
}
321
323
322
324
export function deactivate ( ) : void {
You can’t perform that action at this time.
0 commit comments