From 11f80d1e8bdc7de18c7e9f417635260301d72d01 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Tue, 4 Jan 2022 16:35:40 -0800 Subject: [PATCH] Provide example of `openFolder` getting started commands --- getting-started-sample/package.json | 18 ++++++++++++++---- getting-started-sample/src/extension.ts | 4 ++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/getting-started-sample/package.json b/getting-started-sample/package.json index 9058df151..9781e2e0c 100644 --- a/getting-started-sample/package.json +++ b/getting-started-sample/package.json @@ -15,7 +15,8 @@ "onCommand:getting-started-sample.runCommand", "onCommand:getting-started-sample.changeSetting", "onCommand:getting-started-sample.setContext", - "onCommand:getting-started-sample.sayHello" + "onCommand:getting-started-sample.sayHello", + "onCommand:getting-started-sample.viewSources" ], "main": "./out/extension.js", "contributes": { @@ -26,10 +27,10 @@ } ] }, - "commands":[ + "commands": [ { - "category": "file", - "title": "Say Hello", + "title": "Getting Started Sample: Say Hello", + "shortTitle": "Say Hello (This is the name used in the New File quick pick)", "command": "getting-started-sample.sayHello" } ], @@ -170,6 +171,15 @@ "media": { "markdown": "media/linux.md" } + }, + { + "id": "showSources", + "title": "View Sources", + "description": "Open a folder containg the sources of this extension.\n[View Sources](command:getting-started-sample.viewSources)", + "media": { + "image": "media/image.png", + "altText": "Empty image" + } } ] } diff --git a/getting-started-sample/src/extension.ts b/getting-started-sample/src/extension.ts index c634cac7b..4ef985321 100644 --- a/getting-started-sample/src/extension.ts +++ b/getting-started-sample/src/extension.ts @@ -24,4 +24,8 @@ export function activate(context: vscode.ExtensionContext): void { context.subscriptions.push(vscode.commands.registerCommand('getting-started-sample.sayHello', () => { vscode.window.showInformationMessage('Hello'); })); + + context.subscriptions.push(vscode.commands.registerCommand('getting-started-sample.viewSources', () => { + return { openFolder: vscode.Uri.joinPath(context.extensionUri, 'src') }; + })); } \ No newline at end of file