一、package.json文件内容
{
// 插件的名字,应全部小写,不能有空格; string
"name": "my-vscode-plugin",
// 版本号; string
"version": "1.0.0",
// 发布插件的人的名字 string
"publisher": "Bob",
// 插件支持的最低 VScode版本,不能是 *; Object
"engines": {
"vscode": "^1.0.0"
},
// 许可证,和 npm license 一样; string
"license": "SEE LICENSE IN <filename>",
// 插件应用市场显示的名称;string
"displayName": "myVScodePlugin",
// 描述;string
"description": "this is my vscode plugin",
// 插件应用市场分类;string[];可选值:[Programming Languages, Snippets, Linters, Themes, Debuggers, Formatters, Keymaps, SCM Providers, Other, Extension Packs, Language Packs, Data Science, Machine Learning, Visualization, Notebooks, Education]
"categories": ["other"]
// 关键字,可以在应用市场上进行搜索,最多 5 个关键字;array
"keywords": ["test", "vscode", "theme"],
// 格式化市场标题,以匹配图标;object
"galleryBanner": {
"color": "#C80000",
"theme": "dark"
},
// 将插件设置为在应用市场中预览;boolean
"preview": true,
// 差距的入口文件;string
"main": "/src/extension"
// 贡献点,描述插件贡献的对象;object
"contributes": {
// 插件配置项
"configuration": {
"type": "object",
// 配置项标题,会显示在vscode的设置页
"title": "my-vscode-plugin",
"properties": {
"myVscodePluginDemo.yourName": {
"type": "string",
"default": "guest",
"description": "this is your name"
}
}
},
// 命令
"commands": [
{
"command": "extension.sayHello",
"title": "Hello World"
}
],
// 快捷键绑定
"keybindings": [
{
"command": "extension.sayHello",
"key": "ctrl+f10",
"mac": "cmd+f10",
"when": "editorTextFocus"
}
],
// 菜单
"menus": {
// 编辑器右键菜单
"editor/context": [
{
// 表示只有编辑器具有焦点时才会在菜单中出现
"when": "editorFocus",
"command": "extension.sayHello",
// navigation是一个永远置顶的分组,后面的@6是人工进行组内排序
"group": "navigation@6"
},
{
"when": "editorFocus",
"command": "extension.demo.getCurrentFilePath",
"group": "navigation@5"
},
{
// 只有编辑器具有焦点,并且打开的是JS文件才会出现
"when": "editorFocus && resourceLangId == javascript",
"command": "extension.demo.testMenuShow",
"group": "z_commands"
},
{
"command": "extension.demo.openWebview",
"group": "navigation"
}
],
// 编辑器右上角图标,不配置图片就显示文字
"editor/title": [
{
"when": "editorFocus && resourceLangId == javascript",
"command": "extension.demo.testMenuShow",
"group": "navigation"
}
],
// 编辑器标题右键菜单
"editor/title/context": [
{
"when": "resourceLangId == javascript",
"command": "extension.demo.testMenuShow",
"group": "navigation"
}
],
// 资源管理器右键菜单
"explorer/context": [
{
"command": "extension.demo.getCurrentFilePath",
"group": "navigation"
},
{
"command": "extension.demo.openWebview",
"group": "navigation"
}
]
},
// 代码片段
"snippets": [
{
"language": "javascript",
"path": "./snippets/javascript.json"
},
{
"language": "html",
"path": "./snippets/html.json"
}
],
// 自定义新的 activitybar 图标,也就是左侧侧边栏大的图标
"viewsContainers": {
"activitybar": [
{
"id": "phone",
"title": "手机",
"icon": "images/phone.svg"
}
]
},
// 自定义侧边栏内 view 的实现
"views": {
// 和 viewsContainers 的id对应
"beautifulGirl": [
{
"id": "apple",
"name": "苹果"
},
{
"id": "huawei",
"name": "华为"
},
{
"id": "xm",
"name": "小米"
}
]
},
// 图标主题
"iconThemes": [
{
"id": "myIconTheme",
"label": "图标主题",
"path": "./theme/icon-theme.json"
}
]
},
// 激活的拓展事件组;array
"activationEvents": [
"*"
],
// 徽章,显示在应用市场拓展页侧边栏中;array,只允许受信用的徽章
"badges": [],
// 插件市场中使用的 markdown 渲染引擎;string
"markdown": ""
// 市场中的链接;marketplace(默认)、string、false
"qna": "",
// 插件运行时的 Node.js 依赖项;object;和 npm 中相同
"dependencies": {
},
// 插件开发时的 Node.js 依赖项;object;和 npm 中相同
"devDependencies": {
},
// 与此插件捆绑的插件的 ID 数组;array
"extensionPack": [
"felixfbecker.php-debug",
"felixfbecker.php-intellisense",
"Kasik96.format-php"
],
// 此插件所依赖的插件的 ID 数组;array
"extensionDependencies": [
],
// 插件在远程配置中运行的位置的数组;array;[ui, workspace],
"extensionKind": [],
// 和 npm 中 scripts 相同;object
"scripts": {
},
// 插件 icon,至少为 128 * 128 像素
"icon": "icon.png"
}
更多的也可以参考 npm
中 package.json
文件