VsCode 格式化插件配置


Beautify

1、在工作目錄下建立.jsbeautifyrc文件:

{
  "brace_style": "none,preserve-inline",
  "indent_size": 4,
  "indent_char": " ",
  "jslint_happy": true,
  "unformatted": [""],
  "css": {
    "indent_size": 4
  }
}

注釋:

brace_style:格式風格(為避免和eslint默認檢查沖突,建議此屬性設置為 none,preserve-inline)
indent_size:縮進長度(為避免和eslint默認檢查沖突,建議此屬性設置為 2)
indent_char:縮進填充的內容
jslint_happy:true:若你要搭配jslint使用,請開啟此選項
unformatted:["a","p"]:這里放不需要格式化的標簽類型。注意 template 也是默認不格式化的,.vue 的 template
              標簽如果需要格式化請在 .jsbeautifyrc 重新定義不帶 template 的聲明屬性

2、如果需要保存時自動格式化,請設置如下:

在VSCode的配置文件里添加:

"editor.formatOnSave": true

Vetur

針對 .vue 文件格式化

"vetur.format.options.tabSize": 4

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM