VSCode中package.json的用法-創(chuàng)新互聯(lián)

這篇文章主要講解了VSCode中package.json的用法,內(nèi)容清晰明了,對(duì)此有興趣的小伙伴可以學(xué)習(xí)一下,相信大家閱讀完之后會(huì)有幫助。

站在用戶的角度思考問(wèn)題,與客戶深入溝通,找到興業(yè)網(wǎng)站設(shè)計(jì)與興業(yè)網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:網(wǎng)站建設(shè)、成都網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、主機(jī)域名、虛擬空間、企業(yè)郵箱。業(yè)務(wù)覆蓋興業(yè)地區(qū)。

package.json

在詳細(xì)介紹vscode插件開發(fā)細(xì)節(jié)之前,這里我們先詳細(xì)介紹一下vscode插件的package.json寫法,但是建議先只需要隨便看一下,了解個(gè)大概,等后面講到具體細(xì)節(jié)的時(shí)候再回過(guò)頭來(lái)看。

如下是package.json文件的常用配置,當(dāng)然這里還不是全部:

{
	// 插件的名字,應(yīng)全部小寫,不能有空格
 "name": "vscode-plugin-demo",
	// 插件的友好顯示名稱,用于顯示在應(yīng)用市場(chǎng),支持中文
 "displayName": "VSCode插件demo",
	// 描述
 "description": "VSCode插件demo集錦",
	// 關(guān)鍵字,用于應(yīng)用市場(chǎng)搜索
 "keywords": ["vscode", "plugin", "demo"],
	// 版本號(hào)
 "version": "1.0.0",
	// 發(fā)布者,如果要發(fā)布到應(yīng)用市場(chǎng)的話,這個(gè)名字必須與發(fā)布者一致
 "publisher": "sxei",
	// 表示插件最低支持的vscode版本
 "engines": {
  "vscode": "^1.27.0"
 },
	// 插件應(yīng)用市場(chǎng)分類,可選值: [Programming Languages, Snippets, Linters, Themes, Debuggers, Formatters, Keymaps, SCM Providers, Other, Extension Packs, Language Packs]
 "categories": [
  "Other"
 ],
	// 插件圖標(biāo),至少128x128像素
 "icon": "images/icon.png",
	// 擴(kuò)展的激活事件數(shù)組,可以被哪些事件激活擴(kuò)展,后文有詳細(xì)介紹
 "activationEvents": [
  "onCommand:extension.sayHello"
 ],
	// 插件的主入口
 "main": "./src/extension",
	// 貢獻(xiàn)點(diǎn),整個(gè)插件最重要最多的配置項(xiàng)
 "contributes": {
		// 插件配置項(xiàng)
		"configuration": {
   "type": "object",
			// 配置項(xiàng)標(biāo)題,會(huì)顯示在vscode的設(shè)置頁(yè)
   "title": "vscode-plugin-demo",
   "properties": {
				// 這里我隨便寫了2個(gè)設(shè)置,配置你的昵稱
    "vscodePluginDemo.yourName": {
     "type": "string",
     "default": "guest",
     "description": "你的名字"
    },
				// 是否在啟動(dòng)時(shí)顯示提示
    "vscodePluginDemo.showTip": {
     "type": "boolean",
     "default": true,
     "description": "是否在每次啟動(dòng)時(shí)顯示歡迎提示!"
    }
   }
  },
		// 命令
  "commands": [
   {
    "command": "extension.sayHello",
    "title": "Hello World"
   }
  ],
		// 快捷鍵綁定
  "keybindings": [
   {
    "command": "extension.sayHello",
    "key": "ctrl+f10",
    "mac": "cmd+f10",
    "when": "editorTextFocus"
   }
  ],
		// 菜單
  "menus": {
			// 編輯器右鍵菜單
   "editor/context": [
    {
					// 表示只有編輯器具有焦點(diǎn)時(shí)才會(huì)在菜單中出現(xiàn)
     "when": "editorFocus",
     "command": "extension.sayHello",
					// navigation是一個(gè)永遠(yuǎn)置頂?shù)姆纸M,后面的@6是人工進(jìn)行組內(nèi)排序
     "group": "navigation@6"
    },
    {
     "when": "editorFocus",
     "command": "extension.demo.getCurrentFilePath",
     "group": "navigation@5"
    },
    {
					// 只有編輯器具有焦點(diǎn),并且打開的是JS文件才會(huì)出現(xiàn)
     "when": "editorFocus && resourceLangId == javascript",
     "command": "extension.demo.testMenuShow",
     "group": "z_commands"
    },
    {
     "command": "extension.demo.openWebview",
     "group": "navigation"
    }
   ],
			// 編輯器右上角圖標(biāo),不配置圖片就顯示文字
   "editor/title": [
    {
     "when": "editorFocus && resourceLangId == javascript",
     "command": "extension.demo.testMenuShow",
     "group": "navigation"
    }
   ],
			// 編輯器標(biāo)題右鍵菜單
   "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圖標(biāo),也就是左側(cè)側(cè)邊欄大的圖標(biāo)
  "viewsContainers": {
   "activitybar": [
    {
     "id": "beautifulGirl",
     "title": "美女",
     "icon": "images/beautifulGirl.svg"
    }
   ]
  },
		// 自定義側(cè)邊欄內(nèi)view的實(shí)現(xiàn)
  "views": {
			// 和 viewsContainers 的id對(duì)應(yīng)
   "beautifulGirl": [
    {
     "id": "beautifulGirl1",
     "name": "國(guó)內(nèi)美女"
    },
    {
     "id": "beautifulGirl2",
     "name": "國(guó)外美女"
    },
    {
     "id": "beautifulGirl3",
     "name": "人妖"
    }
   ]
  },
		// 圖標(biāo)主題
  "iconThemes": [
   {
    "id": "testIconTheme",
    "label": "測(cè)試圖標(biāo)主題",
    "path": "./theme/icon-theme.json"
   }
  ]
 },
	// 同 npm scripts
 "scripts": {
  "postinstall": "node ./node_modules/vscode/bin/install",
  "test": "node ./node_modules/vscode/bin/test"
 },
	// 開發(fā)依賴
 "devDependencies": {
  "typescript": "^2.6.1",
  "vscode": "^1.1.6",
  "eslint": "^4.11.0",
  "@types/node": "^7.0.43",
  "@types/mocha": "^2.2.42"
 },
	// 后面這幾個(gè)應(yīng)該不用介紹了
 "license": "SEE LICENSE IN LICENSE.txt",
 "bugs": {
  "url": "https://github.com/sxei/vscode-plugin-demo/issues"
 },
 "repository": {
  "type": "git",
  "url": "https://github.com/sxei/vscode-plugin-demo"
 },
	// 主頁(yè)
 "homepage": "https://github.com/sxei/vscode-plugin-demo/blob/master/README.md"
}

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)建站bm7419.com,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

名稱欄目:VSCode中package.json的用法-創(chuàng)新互聯(lián)
網(wǎng)址分享:http://bm7419.com/article48/gjeep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)企業(yè)網(wǎng)站制作、微信公眾號(hào)響應(yīng)式網(wǎng)站、云服務(wù)器外貿(mào)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)