欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

VSCode中package.json的用法

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

創(chuàng)新互聯(lián)成立與2013年,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項目成都網(wǎng)站設(shè)計、網(wǎng)站建設(shè)網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元甘南做網(wǎng)站,已為上家服務(wù),為甘南各地企業(yè)和個人服務(wù),聯(lián)系電話:18982081108

package.json

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

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

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

activationEvents

插件在VS Code中默認是沒有被激活的,哪什么時候才被激活呢?就是通過activationEvents來配置,目前支持一下8種配置:

  • onLanguage:${language}
  • onCommand:${command}
  • onDebug
  • workspaceContains:${toplevelfilename}
  • onFileSystem:${scheme}
  • onView:${viewId}
  • onUri
  • *

都比較好懂,我就不做一一介紹了,舉個例子,如果我配置了onLanguage:javascript,那么只要我打開了JS類型的文件,插件就會被激活。

重點說一下*,如果配置了*,只要一啟動vscode,插件就會被激活,為了出色的用戶體驗,官方不推薦這么做。看到這里相信大家知道了我們前面HelloWord里面為啥要配置onCommand了吧。

3.contributes

  • configuration:設(shè)置
  • commands:命令
  • menus:菜單
  • keybindings:快捷鍵綁定
  • languages:新語言支持
  • debuggers:調(diào)試
  • breakpoints:斷點
  • grammars
  • themes:主題
  • snippets:代碼片段
  • jsonValidation:自定義JSON校驗
  • views:左側(cè)側(cè)邊欄視圖
  • viewsContainers:自定義activitybar
  • problemMatchers
  • problemPatterns
  • taskDefinitions
  • colors

VSCode中package.json的用法

看完上述內(nèi)容,是不是對VSCode中package.json的用法有進一步的了解,如果還想學(xué)習(xí)更多內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

本文題目:VSCode中package.json的用法
網(wǎng)頁網(wǎng)址:http://chinadenli.net/article26/geocjg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營銷網(wǎng)站排名App設(shè)計網(wǎng)站設(shè)計網(wǎng)頁設(shè)計公司靜態(tài)網(wǎng)站

廣告

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

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