File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 38
38
"compile" : " node ./node_modules/vscode/bin/compile -watch -p ./"
39
39
},
40
40
"contributes" : {
41
- "keybindings" : [
41
+ "keybindings" : [
42
42
{
43
43
"command" : " PowerShell.OnlineHelp" ,
44
44
"key" : " ctrl+f1" ,
51
51
}
52
52
],
53
53
"commands" : [
54
+ {
55
+ "command" : " PowerShell.FindModule" ,
56
+ "title" : " Install PowerShell Module" ,
57
+ "category" : " PowerShell"
58
+ },
54
59
{
55
60
"command" : " PowerShell.OnlineHelp" ,
56
61
"title" : " Get online help for command" ,
Original file line number Diff line number Diff line change
1
+ import vscode = require( 'vscode' ) ;
2
+ import { LanguageClient } from 'vscode-languageclient' ;
3
+ import { RequestType , NotificationType , ResponseError } from 'vscode-jsonrpc' ;
4
+ import Window = vscode . window ;
5
+ import QuickPickItem = vscode . QuickPickItem ;
6
+
7
+ export namespace FindModuleRequest {
8
+ export const type : RequestType < string , any , void > = { get method ( ) { return 'powerShell/findModule' ; } } ;
9
+ }
10
+
11
+ export function registerFindModuleCommand ( client : LanguageClient ) : void {
12
+ var disposable = vscode . commands . registerCommand ( 'PowerShell.FindModule' , ( ) => {
13
+
14
+ var items : QuickPickItem [ ] = [ ] ;
15
+
16
+ Window . showInformationMessage ( "Querying PowerShell Gallery..." ) ;
17
+
18
+ client . sendRequest ( FindModuleRequest . type , null ) . then ( ( modules ) => {
19
+ for ( var i = 0 ; i < modules . moduleList . length ; i ++ ) {
20
+ var module = modules . moduleList [ i ] ;
21
+ items . push ( { label : module . name , description : module . description } ) ;
22
+ }
23
+
24
+ Window . showQuickPick ( items ) . then ( ( selection ) => {
25
+ switch ( selection . label ) {
26
+ default :
27
+ Window . showInformationMessage ( "Installing PowerShell Module " + selection . label ) ;
28
+ }
29
+ } ) ;
30
+ } ) ;
31
+
32
+ } ) ;
33
+ }
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import settingsManager = require('./settings');
10
10
import { LanguageClient , LanguageClientOptions , Executable } from 'vscode-languageclient' ;
11
11
12
12
import { RequestType , NotificationType , ResponseError } from 'vscode-jsonrpc' ;
13
+ import { registerFindModuleCommand } from './features/FindModule' ;
13
14
import { registerShowHelpCommand } from './features/ShowOnlineHelp' ;
14
15
import { registerConsoleCommands } from './features/Console' ;
15
16
@@ -95,6 +96,7 @@ export function activate(context: vscode.ExtensionContext): void {
95
96
client . start ( ) ;
96
97
97
98
// Register other features
99
+ registerFindModuleCommand ( client ) ;
98
100
registerShowHelpCommand ( client ) ;
99
101
registerConsoleCommands ( client ) ;
100
102
}
You can’t perform that action at this time.
0 commit comments