clang-tools  7.0.0
vsc-extension-quickstart.md
Go to the documentation of this file.
1 # Toy VS Code Extension for clangd
2 
3 ## What's in the folder
4 * This folder contains all of the files necessary for your extension
5 * `package.json` - this is the manifest file in which you declare your extension and command.
6 The sample plugin registers a command and defines its title and command name. With this information
7 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
10 activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
11 We pass the function containing the implementation of the command as the second parameter to
12 `registerCommand`.
13 
14 ## Get up and running straight away
15 * press `F5` to open a new window with your extension loaded
16 * run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`
17 * set breakpoints in your code inside `src/extension.ts` to debug your extension
18 * find output from your extension in the debug console
19 
20 ## Make changes
21 * you can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`
22 * you can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes
23 
24 ## Explore the API
25 * you can open the full set of our API when you open the file `node_modules/vscode/vscode.d.ts`
26 
27 ## Run tests
28 * open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests`
29 * press `F5` to run the tests in a new window with your extension loaded
30 * see the output of the test result in the debug console
31 * make changes to `test/extension.test.ts` or create new test files inside the `test` folder
32  * by convention, the test runner will only consider files matching the name pattern `**.test.ts`
33  * you can create folders inside the `test` folder to structure your tests any way you want