main
md 48 lines 2.83 KB
Rendered Raw
1 # Welcome to your VS Code Extension
2
3 ## What's in the folder
4
5 * This folder contains all of the files necessary for your extension.
6 * `package.json` - this is the manifest file in which you declare your extension and command.
7 * The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
8 * `src/extension.ts` - this is the main file where you will provide the implementation of your command.
9 * The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
10 * We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
11
12 ## Setup
13
14 * install the recommended extensions (amodio.tsl-problem-matcher, ms-vscode.extension-test-runner, and dbaeumer.vscode-eslint)
15
16
17 ## Get up and running straight away
18
19 * Press `F5` to open a new window with your extension loaded.
20 * Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
21 * Set breakpoints in your code inside `src/extension.ts` to debug your extension.
22 * Find output from your extension in the debug console.
23
24 ## Make changes
25
26 * You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
27 * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
28
29
30 ## Explore the API
31
32 * You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
33
34 ## Run tests
35
36 * Install the [Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner)
37 * Run the "watch" task via the **Tasks: Run Task** command. Make sure this is running, or tests might not be discovered.
38 * Open the Testing view from the activity bar and click the Run Test" button, or use the hotkey `Ctrl/Cmd + ; A`
39 * See the output of the test result in the Test Results view.
40 * Make changes to `src/test/extension.test.ts` or create new test files inside the `test` folder.
41 * The provided test runner will only consider files matching the name pattern `**.test.ts`.
42 * You can create folders inside the `test` folder to structure your tests any way you want.
43
44 ## Go further
45
46 * Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
47 * [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
48 * Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).