From 52b7c255b1d65823a760a00de5aeab0336092beb Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Mon, 5 Nov 2018 23:31:13 -0800 Subject: [PATCH] Update hellocode-minimal-sample. Fix #116 --- README.md | 2 +- hellocode-minimal-sample/README.md | 25 +++++++++++++++++++++++++ hellocode-minimal-sample/extension.js | 6 +++++- hellocode-minimal-sample/package.json | 6 ++++++ 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 hellocode-minimal-sample/README.md diff --git a/README.md b/README.md index 229a0d66..5501a9bd 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ You can expect from each sample: ## Getting Started - [Hello Code Sample](hellocode-sample): The Hello World sample for VS Code. -- [Hello Code Minimal Sample](hellocode-sample): A minimal version of Hello Code Sample that doesn't use TypeScript. +- [Hello Code Minimal Sample](hellocode-minimal-sample): A minimal version of Hello Code Sample that doesn't use TypeScript. ## Samples diff --git a/hellocode-minimal-sample/README.md b/hellocode-minimal-sample/README.md new file mode 100644 index 00000000..b9fcd21f --- /dev/null +++ b/hellocode-minimal-sample/README.md @@ -0,0 +1,25 @@ +# Hello Code Minimal Sample + +This is a minimal version of the [Hello Code Sample](../hellocode-sample). + +It does not use TypeScript and only includes the `vscode` devDependency needed for extension development. + +## Demo + +![demo](demo.gif) + +## VS Code API + +### `vscode` module + +- [`commands.registerCommand`](https://code.visualstudio.com/docs/extensionAPI/vscode-api#commands.registerCommand) +- [`window.showInformationMessage`](https://code.visualstudio.com/docs/extensionAPI/vscode-api#window.showInformationMessage) + +### Contribution Points + +- [`contributes.commands`](https://code.visualstudio.com/docs/extensionAPI/extension-points#_contributescommands) + +## Running the Sample + +- Run `npm install` in terminal to install dependencies +- Run the `Run Extension` target in the Debug View. \ No newline at end of file diff --git a/hellocode-minimal-sample/extension.js b/hellocode-minimal-sample/extension.js index 542f038e..b012f14a 100644 --- a/hellocode-minimal-sample/extension.js +++ b/hellocode-minimal-sample/extension.js @@ -4,10 +4,14 @@ const vscode = require('vscode'); // this method is called when your extension is activated // your extension is activated the very first time the command is executed + +/** + * @param {vscode.ExtensionContext} context + */ function activate(context) { // Use the console to output diagnostic information (console.log) and errors (console.error) // This line of code will only be executed once when your extension is activated - console.log('Congratulations, your extension "hellocode-sample" is now active!'); + console.log('Congratulations, your extension "hellocode-minimal-sample" is now active!'); // The command has been defined in the package.json file // Now provide the implementation of the command with registerCommand diff --git a/hellocode-minimal-sample/package.json b/hellocode-minimal-sample/package.json index ee55546a..63892c34 100644 --- a/hellocode-minimal-sample/package.json +++ b/hellocode-minimal-sample/package.json @@ -17,5 +17,11 @@ "title": "Hello World" } ] + }, + "scripts": { + "postinstall": "node ./node_modules/vscode/bin/install" + }, + "devDependencies": { + "vscode": "^1.1.17" } }