1. vscode 簡介
vscode是微軟開發的的一款代碼編輯器,就如官網上說的一樣,vscode重新定義(redefined)了代碼編輯器。
當前市面上常用的輕型代碼編輯器主要是:sublime,notepad++,editplus,atom這幾種。
比起notepad++、editplus,vscode集成了許多IDE才具有的功能,比起它們更像一個代碼編輯器;
比起sublime,vscode顏值更高,安裝配置插件更為方便;
比起atom,vscode啟動速度更快,打開各種大文件不卡。
可以說,vscode既擁有高自由度、又擁有高性能和高顏值,最關鍵的是,vscode還是一款免費並且有團隊持續快速更新的代碼編輯器。
可以說,vscode是代碼編輯器的首選。個人推薦編寫前端代碼時,代碼編輯器選擇vscode,IDE選擇WebStorm。
vscode安裝插件只需要點擊圖片所示按鈕,即可進入拓展,在搜索框中輸入插件名點擊安裝后,等待安裝好即可點擊重新加載重啟vscode使得插件生效。
當你不需要某個插件時只需要進入擴展,點擊對應插件右下角的齒輪按鈕即可選擇禁用或卸載該插件。
2. 前端常用插件 (ps: 必備 > 推薦 > 了解)
必備的一定要裝, 推薦的看自己需要, 了解的可不裝 !!!
1.Auto Close Tag (必備)
自動閉合HTML/XML標簽
2.Auto Rename Tag (必備)
自動完成另一側標簽的同步修改
3.Beautify (必備)
格式化 html ,js,css
vue 里面配置方法和快捷鍵配置 戳這里
另一款 Prettier
格式化JavaScript / TypeScript / CSS
配置教程 戳這里
4.Bracket Pair Colorizer (必備)
給括號加上不同的顏色,便於區分不同的區塊,使用者可以定義不同括號類型和不同顏色
5.Debugger for Chrome (推薦)
映射vscode上的斷點到chrome上,方便調試
調試方法戳這
6.ESLint (推薦)
js語法糾錯,可以自定義配置,不過配置較為復雜,建議使用網上一些廣泛使用的eslint配置,日后我也會專門針對eslint配置寫一篇文章。
7.GitLens(使用git的必備)
方便查看git日志,git重度使用者必備
使用教程
8.HTML CSS Support (必備)
智能提示CSS類名以及id
9.HTML Snippets (必備)
智能提示HTML標簽,以及標簽含義
10.JavaScript(ES6) code snippets (必備)
ES6語法智能提示,以及快速輸入,不僅僅支持.js,還支持.ts,.jsx,.tsx,.html,.vue,省去了配置其支持各種包含js代碼文件的時間
11.jQuery Code Snippets (推薦)
jQuery代碼智能提示
12.Markdown Preview Enhanced (推薦)
實時預覽markdown,markdown使用者必備
13.markdownlint (推薦)
markdown語法糾錯
14.Material Icon Theme (推薦)
vscode圖標主題,支持更換不同色系的圖標,值得點出的是,該插件更新極其頻繁,基本和vscode更新頻率保持一致
極簡主義是不需要的
另一套 目錄樹圖標主題 vscode-icons
使用方法,配置如下json
15.open in browser (必備)
vscode不像IDE一樣能夠直接在瀏覽器中打開html,而該插件支持快捷鍵與鼠標右鍵快速在瀏覽器中打開html文件,支持自定義打開指定的瀏覽器,包括:Firefox,Chrome,Opera,IE以及Safari
設置默認瀏覽器
16.Path Intellisense (必備)
自動提示文件路徑,支持各種快速引入文件
17.React/Redux/react-router Snippets (推薦)(react必備)
React/Redux/react-router語法智能提示
補充兩個
1) React-Native/React/Redux snippets for es6/es7
react代碼片段,下載人數超多
2) react-beautify
格式化 javascript, JSX, typescript, TSX 文件
18.Vetur (推薦)(vue必備)
Vue多功能集成插件,包括:語法高亮,智能提示,emmet,錯誤提示,格式化,自動補全,debugger。vscode官方欽定Vue插件,Vue開發者必備。
補充 兩個:
1) VueHelper
vue代碼片段
2) Vue TypeScript Snippets
vue的 typescript 代碼片段
3) Vue 2 Snippets
vue 2代碼片段
19.Dracula Official (推薦)
很好看的一款主題風格
這樣的
20.filesize (了解)
查看文件大小
20.HTMLHint(了解)
靜態檢查規則 具體規則戳這
21. Class autocomplete for HTML (推薦)
智能提示HTML class =“”屬性(必備)
22. IntelliSense for CSS class names (推薦)
智能提示 css 的 class 名
23. Npm Intellisense(node必備)
require 時的包提示
如果還有好的插件我會隨時補充 ~~~
ps : 下面是一些常用的json 配置
{ // VScode主題配置
"editor.tabSize": 2,
"editor.lineHeight": 24,
"editor.renderLineHighlight": "none",
"editor.renderWhitespace": "none",
"editor.fontFamily": "Consolas",
"editor.fontSize": 15,
"editor.cursorBlinking": "smooth",
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnSave": false,
"editor.snippetSuggestions": "top",
"editor.wordWrapColumn": 200,
"editor.wordWrap": "off",
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": false
},
// 保存時自動格式化
"editor.formatOnPaste": false,
"files.trimTrailingWhitespace": true,
"terminal.integrated.shell.windows": "C:\\windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"typescript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"javascript.suggest.autoImports": true,
"workbench.iconTheme": "eq-material-theme-icons",
"workbench.startupEditor": "newUntitledFile",
"workbench.colorTheme": "Material Theme High Contrast",
"workbench.colorCustomizations": {
// 設置guide線高亮顏色
"editorIndentGuide.activeBackground": "#ff0000"
},
// 啟用/禁用導航路徑
"breadcrumbs.enabled": true,
// git是否啟用自動拉取
"git.autofetch": true,
"minapp-vscode.disableAutoConfig": true,
"view-in-browser.customBrowser": "chrome",
// VScode 文件搜索區域配置
"search.exclude": {
"**/dist": true,
"**/build": true,
"**/elehukouben": true,
"**/.git": true,
"**/.gitignore": true,
"**/.svn": true,
"**/.DS_Store": true,
"**/.idea": true,
"**/.vscode": false,
"**/yarn.lock": true,
"**/tmp": true
},
// 配置文件關聯
"files.associations": {
"*.vue": "html",
"*.wxss": "css",
"*.cjson": "jsonc",
"*.wxs": "javascript"
},
// 配置emmet是否啟用tab展開縮寫
"emmet.triggerExpansionOnTab": true,
// 配置emmet對文件類型的支持
"emmet.syntaxProfiles": {
"vue-html": "html",
"vue": "html",
"javascript": "javascriptreact",
"xml": {
"attr_quotes": "single"
}
},
// 在react的jsx中添加對emmet的支持
"emmet.includeLanguages": {
"jsx-sublime-babel-tags": "javascriptreact",
"wxml": "html"
},
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatterOptions": {
"wrap_attributes": "force-aligned"
},
// 是否開啟eslint檢測
"eslint.enable": false,
// 文件保存時,是否自動根據eslint進行格式化
"eslint.autoFixOnSave": false,
// eslint配置文件
"eslint.options": {
"configFile": "E:/aaaworkspace/ex/experience/.eslintrc.js",
"plugins": [
"html",
"vue"
]
},
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "vue",
"autoFix": true
},
"html",
"typescript",
"typescriptreact"
],
// 格式化快捷鍵 shirt+alt+F
// prettier進行格式化時是否安裝eslint配置去執行,建議false
"prettier.eslintIntegration": false,
// 如果為true,將使用單引號而不是雙引號
"prettier.singleQuote": true,
// 代碼換行,每一行最大占有字符數
"prettier.printWidth": 200,
// 配置gitlen中git提交歷史記錄的信息顯示情況
"gitlens.advanced.messages": {
"suppressCommitHasNoPreviousCommitWarning": false,
"suppressCommitNotFoundWarning": false,
"suppressFileNotUnderSourceControlWarning": false,
"suppressGitVersionWarning": false,
"suppressLineUncommittedWarning": false,
"suppressNoRepositoryWarning": false,
"suppressResultsExplorerNotice": false,
"suppressShowKeyBindingsNotice": true,
"suppressUpdateNotice": true,
"suppressWelcomeNotice": false
},
// 調試,本地服務器配置
"launch": {
"configurations": [{
"type": "node",
"request": "launch",
"name": "Node.js",
"program": "${file}"
},
{
"type": "chrome",
"request": "launch",
"name": "vuejs: chrome",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/src",
"breakOnLoad": true,
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
}
],
"compounds": []
},
// 是否格式化python文件
"python.linting.enabled": false,
// 設置端口。開啟apicloud在vscode中的wifi真機同步
"apicloud.port": "23450",
// 設置apicloud在vscode中的wifi真機同步根目錄,默認可不設置
"apicloud.subdirectories": "/apicloudproject",
// git 部分配置
"gitlens.advanced.messages": {
"suppressShowKeyBindingsNotice": true
},
"git.path": "C:/Program Files/Git/cmd/git.exe",
"git.autofetch": true,
"git.confirmSync": false,
"open-in-browser.default": "Google Chrome",
"files.autoSave": "afterDelay",
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
"workbench.startupEditor": "welcomePage",
}
這里有一份更詳細的清單,歡迎參考
————————————————
版權聲明:本文為CSDN博主「懂懂kkw」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/jiandan1127/article/details/85957003