File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed
Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 2727 "main" : " ./out/main" ,
2828 "activationEvents" : [
2929 " onLanguage:powershell" ,
30- " onCommand:PowerShell.NewProjectFromTemplate"
30+ " onCommand:PowerShell.NewProjectFromTemplate" ,
31+ " onCommand:PowerShell.OpenExamplesFolder"
3132 ],
3233 "dependencies" : {
3334 "vscode-languageclient" : " 1.3.1"
139140 "command" : " PowerShell.NewProjectFromTemplate" ,
140141 "title" : " Create New Project from Plaster Template" ,
141142 "category" : " PowerShell"
143+ },
144+ {
145+ "command" : " PowerShell.OpenExamplesFolder" ,
146+ "title" : " Open Examples Folder" ,
147+ "category" : " PowerShell"
142148 }
143149 ],
144150 "snippets" : [
Original file line number Diff line number Diff line change 1+ /*---------------------------------------------------------
2+ * Copyright (C) Microsoft Corporation. All rights reserved.
3+ *--------------------------------------------------------*/
4+
5+ import vscode = require( 'vscode' ) ;
6+ import path = require( 'path' ) ;
7+ import { IFeature } from '../feature' ;
8+ import { LanguageClient } from 'vscode-languageclient' ;
9+
10+ export class ExamplesFeature implements IFeature {
11+ private command : vscode . Disposable ;
12+ private examplesPath : string ;
13+
14+ constructor ( ) {
15+ this . examplesPath = path . resolve ( __dirname , "../../examples" ) ;
16+ this . command = vscode . commands . registerCommand ( 'PowerShell.OpenExamplesFolder' , ( ) => {
17+ vscode . commands . executeCommand (
18+ "vscode.openFolder" ,
19+ vscode . Uri . file ( this . examplesPath ) ,
20+ true ) ;
21+ } ) ;
22+ }
23+
24+ public setLanguageClient ( languageclient : LanguageClient ) {
25+ }
26+
27+ public dispose ( ) {
28+ this . command . dispose ( ) ;
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { IFeature } from './feature';
1010import { SessionManager } from './session' ;
1111import { PowerShellLanguageId } from './utils' ;
1212import { ConsoleFeature } from './features/Console' ;
13+ import { ExamplesFeature } from './features/Examples' ;
1314import { OpenInISEFeature } from './features/OpenInISE' ;
1415import { NewFileOrProjectFeature } from './features/NewFileOrProject' ;
1516import { ExpandAliasFeature } from './features/ExpandAlias' ;
@@ -88,6 +89,7 @@ export function activate(context: vscode.ExtensionContext): void {
8889 // Create features
8990 extensionFeatures = [
9091 new ConsoleFeature ( ) ,
92+ new ExamplesFeature ( ) ,
9193 new OpenInISEFeature ( ) ,
9294 new ExpandAliasFeature ( ) ,
9395 new ShowHelpFeature ( ) ,
You can’t perform that action at this time.
0 commit comments