1. vscode 簡介
1.vscode是微軟開發的的一款代碼編輯器,就如官網上說的一樣,vscode重新定義(redefined)了代碼編輯器。
2.當前市面上常用的輕型代碼編輯器主要是:sublime,notepad++,editplus,atom這幾種。
3.比起notepad++、editplus,vscode集成了許多IDE才具有的功能,比起它們更像一個代碼編輯器;
4.比起sublime,vscode顏值更高,安裝配置插件更為方便;
5.比起atom,vscode啟動速度更快,打開各種大文件不卡。
6.可以說,vscode既擁有高自由度、又擁有高性能和高顏值,最關鍵的是,vscode還是一款免費並且有團隊持續快速更新的代碼編輯器。
7.可以說,vscode是代碼編輯器的首選。個人推薦編寫前端代碼時,代碼編輯器選擇vscode,IDE選擇WebStorm。
8.vscode安裝插件只需要點擊圖片所示按鈕,即可進入拓展,在搜索框中輸入插件名點擊安裝后,等待安裝好即可點擊重新加載重啟vscode使得插件生效。
9.當你不需要某個插件時只需要進入擴展,點擊對應插件右下角的齒輪按鈕即可選擇禁用或卸載該插件。
2. 前端常用插件 (ps: 必備 > 推薦 > 了解)
必備的一定要裝, 推薦的看自己需要, 了解的可不裝 !!!
1.Auto Close Tag (必備)
自動閉合HTML/XML標簽
2.Auto Rename Tag (必備)
自動完成另一側標簽的同步修改
3.Beautify (必備)
格式化 html ,js,css
另一款 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 (了解)
查看文件大小
21.HTMLHint(了解)
靜態檢查規則 具體規則戳這
22. Class autocomplete for HTML (推薦)
智能提示HTML class =“”屬性(必備)
23. IntelliSense for CSS class names (推薦)
智能提示 css 的 class 名
24. Npm Intellisense(node必備)
require 時的包提示
如果還有好的插件我會隨時補充 ~~~
ps : 下面是一些常用的json 配置
1 { // VScode主題配置 2 "editor.tabSize": 2, 3 "editor.lineHeight": 24, 4 "editor.renderLineHighlight": "none", 5 "editor.renderWhitespace": "none", 6 "editor.fontFamily": "Consolas", 7 "editor.fontSize": 15, 8 "editor.cursorBlinking": "smooth", 9 "editor.multiCursorModifier": "ctrlCmd", 10 "editor.formatOnSave": false, 11 "editor.snippetSuggestions": "top", 12 "editor.wordWrapColumn": 200, 13 "editor.wordWrap": "off", 14 "editor.quickSuggestions": { 15 "other": true, 16 "comments": true, 17 "strings": false 18 }, 19 // 保存時自動格式化 20 "editor.formatOnPaste": false, 21 "files.trimTrailingWhitespace": true, 22 "terminal.integrated.shell.windows": "C:\\windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", 23 "typescript.suggest.autoImports": true, 24 "javascript.updateImportsOnFileMove.enabled": "always", 25 "javascript.suggest.autoImports": true, 26 "workbench.iconTheme": "eq-material-theme-icons", 27 "workbench.startupEditor": "newUntitledFile", 28 "workbench.colorTheme": "Material Theme High Contrast", 29 "workbench.colorCustomizations": { 30 // 設置guide線高亮顏色 31 "editorIndentGuide.activeBackground": "#ff0000" 32 }, 33 // 啟用/禁用導航路徑 34 "breadcrumbs.enabled": true, 35 // git是否啟用自動拉取 36 "git.autofetch": true, 37 "minapp-vscode.disableAutoConfig": true, 38 "view-in-browser.customBrowser": "chrome", 39 // VScode 文件搜索區域配置 40 "search.exclude": { 41 "**/dist": true, 42 "**/build": true, 43 "**/elehukouben": true, 44 "**/.git": true, 45 "**/.gitignore": true, 46 "**/.svn": true, 47 "**/.DS_Store": true, 48 "**/.idea": true, 49 "**/.vscode": false, 50 "**/yarn.lock": true, 51 "**/tmp": true 52 }, 53 // 配置文件關聯 54 "files.associations": { 55 "*.vue": "html", 56 "*.wxss": "css", 57 "*.cjson": "jsonc", 58 "*.wxs": "javascript" 59 }, 60 // 配置emmet是否啟用tab展開縮寫 61 "emmet.triggerExpansionOnTab": true, 62 // 配置emmet對文件類型的支持 63 "emmet.syntaxProfiles": { 64 "vue-html": "html", 65 "vue": "html", 66 "javascript": "javascriptreact", 67 "xml": { 68 "attr_quotes": "single" 69 } 70 }, 71 // 在react的jsx中添加對emmet的支持 72 "emmet.includeLanguages": { 73 "jsx-sublime-babel-tags": "javascriptreact", 74 "wxml": "html" 75 }, 76 "vetur.format.defaultFormatter.html": "js-beautify-html", 77 "vetur.format.defaultFormatterOptions": { 78 "wrap_attributes": "force-aligned" 79 }, 80 // 是否開啟eslint檢測 81 "eslint.enable": false, 82 // 文件保存時,是否自動根據eslint進行格式化 83 "eslint.autoFixOnSave": false, 84 // eslint配置文件 85 "eslint.options": { 86 "configFile": "E:/aaaworkspace/ex/experience/.eslintrc.js", 87 "plugins": [ 88 "html", 89 "vue" 90 ] 91 }, 92 "eslint.validate": [ 93 "javascript", 94 "javascriptreact", 95 { 96 "language": "vue", 97 "autoFix": true 98 }, 99 "html", 100 "typescript", 101 "typescriptreact" 102 ], 103 // 格式化快捷鍵 shirt+alt+F 104 // prettier進行格式化時是否安裝eslint配置去執行,建議false 105 "prettier.eslintIntegration": false, 106 // 如果為true,將使用單引號而不是雙引號 107 "prettier.singleQuote": true, 108 // 代碼換行,每一行最大占有字符數 109 "prettier.printWidth": 200, 110 // 配置gitlen中git提交歷史記錄的信息顯示情況 111 "gitlens.advanced.messages": { 112 "suppressCommitHasNoPreviousCommitWarning": false, 113 "suppressCommitNotFoundWarning": false, 114 "suppressFileNotUnderSourceControlWarning": false, 115 "suppressGitVersionWarning": false, 116 "suppressLineUncommittedWarning": false, 117 "suppressNoRepositoryWarning": false, 118 "suppressResultsExplorerNotice": false, 119 "suppressShowKeyBindingsNotice": true, 120 "suppressUpdateNotice": true, 121 "suppressWelcomeNotice": false 122 }, 123 // 調試,本地服務器配置 124 "launch": { 125 "configurations": [{ 126 "type": "node", 127 "request": "launch", 128 "name": "Node.js", 129 "program": "${file}" 130 }, 131 { 132 "type": "chrome", 133 "request": "launch", 134 "name": "vuejs: chrome", 135 "url": "http://localhost:8080", 136 "webRoot": "${workspaceFolder}/src", 137 "breakOnLoad": true, 138 "sourceMapPathOverrides": { 139 "webpack:///src/*": "${webRoot}/*" 140 } 141 } 142 ], 143 "compounds": [] 144 }, 145 // 是否格式化python文件 146 "python.linting.enabled": false, 147 // 設置端口。開啟apicloud在vscode中的wifi真機同步 148 "apicloud.port": "23450", 149 // 設置apicloud在vscode中的wifi真機同步根目錄,默認可不設置 150 "apicloud.subdirectories": "/apicloudproject", 151 152 // git 部分配置 153 "gitlens.advanced.messages": { 154 "suppressShowKeyBindingsNotice": true 155 }, 156 "git.path": "C:/Program Files/Git/cmd/git.exe", 157 "git.autofetch": true, 158 "git.confirmSync": false, 159 160 161 "open-in-browser.default": "Google Chrome", 162 "files.autoSave": "afterDelay", 163 164 "emmet.includeLanguages": { 165 "javascript": "javascriptreact" 166 }, 167 168 "workbench.startupEditor": "welcomePage", 169 170 171 }
原文鏈接:https://blog.csdn.net/jiandan1127/java/article/details/85957003