您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

32 行
2.1 KiB

  1. # Welcome to your first VS Code Extension
  2. ## What's in the folder
  3. * This folder contains all of the files necessary for your extension
  4. * `package.json` - this is the manifest file in which you declare your extension and command.
  5. The sample plugin registers a command and defines its title and command name. With this information
  6. VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
  7. * `src/extension.ts` - this is the main file where you will provide the implementation of your command.
  8. The file exports one function, `activate`, which is called the very first time your extension is
  9. 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
  11. `registerCommand`.
  12. ## Get up and running straight away
  13. * press `F5` to open a new window with your extension loaded
  14. * run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`
  15. * set breakpoints in your code inside `src/extension.ts` to debug your extension
  16. * find output from your extension in the debug console
  17. ## Make changes
  18. * you can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`
  19. * you can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes
  20. ## Explore the API
  21. * you can open the full set of our API when you open the file `node_modules/vscode/vscode.d.ts`
  22. ## Run tests
  23. * open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests`
  24. * press `F5` to run the tests in a new window with your extension loaded
  25. * see the output of the test result in the debug console
  26. * make changes to `test/extension.test.ts` or create new test files inside the `test` folder
  27. * by convention, the test runner will only consider files matching the name pattern `**.test.ts`
  28. * you can create folders inside the `test` folder to structure your tests any way you want