@@ -19,18 +19,16 @@ export class GetCommandsFeature implements IFeature {
19
19
return ;
20
20
}
21
21
this . languageClient . sendRequest ( GetAllCommandsRequestType , "" ) . then ( ( result ) => {
22
- this . commandsExplorerProvider . PowerShellCommands = result . map ( toCommand ) ;
22
+ this . commandsExplorerProvider . powerShellCommands = result . map ( toCommand ) ;
23
23
this . commandsExplorerProvider . refresh ( ) ;
24
24
} ) ;
25
25
} ) ;
26
26
this . commandsExplorerProvider = new CommandsExplorerProvider ( ) ;
27
27
vscode . window . registerTreeDataProvider ( "PowerShellCommands" , this . commandsExplorerProvider ) ;
28
28
vscode . commands . registerCommand ( "PowerShell.InsertCommand" , ( item ) => {
29
29
const editor = vscode . window . activeTextEditor ;
30
- const document = editor . document ;
31
- const selection = editor . selection ;
32
- const sls = selection . start ;
33
- const sle = selection . end ;
30
+ const sls = editor . selection . start ;
31
+ const sle = editor . selection . end ;
34
32
const range = new vscode . Range ( sls . line , sls . character , sle . line , sle . character ) ;
35
33
editor . edit ( ( editBuilder ) => {
36
34
editBuilder . replace ( range , item . Name ) ;
@@ -50,7 +48,7 @@ export class GetCommandsFeature implements IFeature {
50
48
51
49
class CommandsExplorerProvider implements vscode . TreeDataProvider < Command > {
52
50
public readonly onDidChangeTreeData : vscode . Event < Command | undefined > ;
53
- public PowerShellCommands : Command [ ] ;
51
+ public powerShellCommands : Command [ ] ;
54
52
private didChangeTreeData : vscode . EventEmitter < Command | undefined > = new vscode . EventEmitter < Command > ( ) ;
55
53
56
54
constructor ( ) {
@@ -66,10 +64,11 @@ class CommandsExplorerProvider implements vscode.TreeDataProvider<Command> {
66
64
}
67
65
68
66
public getChildren ( element ?: Command ) : Thenable < Command [ ] > {
69
- return Promise . resolve ( this . PowerShellCommands ? this . PowerShellCommands : [ ] ) ;
67
+ return Promise . resolve ( this . powerShellCommands || [ ] ) ;
70
68
}
71
69
72
70
}
71
+
73
72
function toCommand ( command : any ) : Command {
74
73
return new Command (
75
74
command . name ,
0 commit comments