安装工具包 #
npm install -g yo generator-code
创建工程 #
yo code
? What type of extension do you want to create? New Extension (TypeScript)
? What's the name of your extension? vscode-react
? What's the identifier of your extension? vscode-react
? What's the description of your extension? react plugin
? Initialize a git repository? Yes
? Bundle the source code with webpack? Yes
? Which package manager to use? npm
目录结构 #
.vscode\extensions.json:
.vscode\launch.json:
.vscode\settings.json:
.vscode\tasks.json:
package.json:
tsconfig.json:
.vscodeignore:
webpack.config.js:
vsc-extension-quickstart.md:
.gitignore:
README.md:
CHANGELOG.md:
src\extension.ts:
src\test\runTest.ts:
src\test\suite\extension.test.ts:
src\test\suite\index.ts:
.eslintrc.json:
添加activitybar图标 #
- 要将一个自定义视图添加到活动栏中,需要将它添加到
viewsContainers
中
- viewsContainers 中定义了扩展可以添加视图的容器。通常,
activitybar
是最常用的容器,它包含了常见的操作和功能视图,如资源管理器
、搜索
等