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
原文地址:https://www.cnblogs.com/believepd/p/10230494.html