settings.json & 常用插件 & 用戶代碼片段

settings.json

{
  "files.autoSave": "afterDelay",
  "eslint.packageManager": "yarn",
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "vue"
  ],
  "editor.renderWhitespace": "none",
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "gitlens.advanced.messages": {

    "suppressGitVersionWarning": true
  },
  "editor.renderIndentGuides": false,
  "vetur.format.defaultFormatterOptions": {
    "prettier": {
      "semi": true, // 要分號
      "singleQuote": true // 要單引號
    }
  },
  "[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "[less]": {
    "editor.defaultFormatter": "michelemelluso.code-beautifier"
  },
  "editor.detectIndentation": false,
  "editor.tabSize": 2,
  "javascript.updateImportsOnFileMove.enabled": "always",
  "files.eol": "\n",
  "[vue]": {
    "editor.defaultFormatter": "octref.vetur"
  },
  "[json]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "terminal.integrated.shell.windows": "C:\\windows\\System32\\cmd.exe",
  "window.zoomLevel": 1,
  "gitlens.advanced.fileHistoryFollowsRenames": false,
  "git.enableSmartCommit": true,
  "[jsonc]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "liveServer.settings.donotShowInfoMsg": true,
  "[dockerfile]": {
    "editor.quickSuggestions": {
      "strings": true
    }
  },
  "settingsSync.ignoredExtensions": [],
  "files.exclude": {
    // "**/node_modules": true   // true 時會隱藏node_modules文件
  },
  "explorer.confirmDelete": false,
  "svgviewer.enableautopreview": false,  // true:允許預(yù)覽 svg ;false:不允許預(yù)覽 svg
  "vsicons.dontShowNewVersionMessage": true,
  "workbench.startupEditor": "welcomePage",
  "gitlens.advanced.blame.customArguments": [],
  // less 設(shè)置
  "less.compile": {
    "compress": false, // 是否壓縮
    "sourceMap": false, // 是否生成map文件,有了這個可以在調(diào)試臺看到less行數(shù)
    "out": false, // 是否輸出css文件银室,false為不輸出
  },
  "workbench.colorTheme": "One Dark Pro",
}

常用的 VScode 插件

  1. Auto Close Tag
  2. Auto Import
  3. Auto Rename Tag
  4. Beautify css/sass...
  5. browser-tab
  6. Chinese
  7. Easy LESS
  8. ESLint
  9. GitLens git 工具
  10. Guides
  11. HTML CSS Support
  12. HTML Snippets
  13. indent-rainbow
  14. JavaScript (ES6) code snippets
  15. Live Server
  16. One Dark Pro
  17. open in browser
  18. Path Intellisense
  19. Rainbow Brackets
  20. Smarty
  21. SVG Viewer
  22. Vetur
  23. vscode-icons
  24. Browser Preview
  25. Simple React Snippets

用戶代碼片段設(shè)置

文件 → 首選項 → 用戶片段 → 可新增也可編輯

eg:自定義 vue 片段

{
    // Place your 全局 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and 
    // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope 
    // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is 
    // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: 
    // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. 
    // Placeholders with the same ids are connected.
    // Example:
    // "Print to console": {
    //  "scope": "javascript,typescript",
    //  "prefix": "log",
    //  "body": [
    //      "console.log('$1');",
    //      "$2"
    //  ],
    //  "description": "Log output to console"
  // }
  "vue": {
    "prefix": "vue",
    "body": [
        "<template>",
        "  <div>",
        "",
        "  </div>",
        "</template>",
        "",
        "<script>",
        "export default {",
        "  name: '',",
        "  components: {},",
        "  data() {",
        "    return {};",
        "  },",
        "};",
        "</script>",
        "",
        "<style lang='less' scoped>",
        "</style>",
        "",
    ],
    "description": "generate a vue file"
  }
}

代碼自動換行到可視區(qū)內(nèi)

文件=>首選項=>設(shè)置:

Editor:World Wrap 將off修改為on即可
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末胃夏,一起剝皮案震驚了整個濱河市唉侄,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌泪电,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,183評論 6 516
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異诲泌,居然都是意外死亡,警方通過查閱死者的電腦和手機铣鹏,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,850評論 3 399
  • 文/潘曉璐 我一進店門敷扫,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人诚卸,你說我怎么就攤上這事葵第。” “怎么了合溺?”我有些...
    開封第一講書人閱讀 168,766評論 0 361
  • 文/不壞的土叔 我叫張陵卒密,是天一觀的道長。 經(jīng)常有香客問我棠赛,道長栅受,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,854評論 1 299
  • 正文 為了忘掉前任恭朗,我火速辦了婚禮屏镊,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘痰腮。我一直安慰自己而芥,他們只是感情好,可當我...
    茶點故事閱讀 68,871評論 6 398
  • 文/花漫 我一把揭開白布膀值。 她就那樣靜靜地躺著棍丐,像睡著了一般。 火紅的嫁衣襯著肌膚如雪沧踏。 梳的紋絲不亂的頭發(fā)上歌逢,一...
    開封第一講書人閱讀 52,457評論 1 311
  • 那天,我揣著相機與錄音翘狱,去河邊找鬼秘案。 笑死,一個胖子當著我的面吹牛,可吹牛的內(nèi)容都是我干的阱高。 我是一名探鬼主播赚导,決...
    沈念sama閱讀 40,999評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼赤惊!你這毒婦竟也來了吼旧?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,914評論 0 277
  • 序言:老撾萬榮一對情侶失蹤未舟,失蹤者是張志新(化名)和其女友劉穎圈暗,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體裕膀,經(jīng)...
    沈念sama閱讀 46,465評論 1 319
  • 正文 獨居荒郊野嶺守林人離奇死亡员串,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,543評論 3 342
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了魂角。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片昵济。...
    茶點故事閱讀 40,675評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖野揪,靈堂內(nèi)的尸體忽然破棺而出访忿,到底是詐尸還是另有隱情,我是刑警寧澤斯稳,帶...
    沈念sama閱讀 36,354評論 5 351
  • 正文 年R本政府宣布海铆,位于F島的核電站,受9級特大地震影響挣惰,放射性物質(zhì)發(fā)生泄漏卧斟。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 42,029評論 3 335
  • 文/蒙蒙 一憎茂、第九天 我趴在偏房一處隱蔽的房頂上張望珍语。 院中可真熱鬧,春花似錦竖幔、人聲如沸板乙。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,514評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽募逞。三九已至,卻和暖如春馋评,著一層夾襖步出監(jiān)牢的瞬間放接,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,616評論 1 274
  • 我被黑心中介騙來泰國打工留特, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留纠脾,地道東北人玛瘸。 一個月前我還...
    沈念sama閱讀 49,091評論 3 378
  • 正文 我出身青樓,卻偏偏與公主長得像乳乌,于是被迫代替她去往敵國和親捧韵。 傳聞我的和親對象是個殘疾皇子市咆,可洞房花燭夜當晚...
    茶點故事閱讀 45,685評論 2 360

推薦閱讀更多精彩內(nèi)容