vscode file format configuration

After formatting using the Prettier-Code formatter plug-in, the attributes of custom or element-ui components will automatically wrap and look uncomfortable.

Insert image description here

Insert image description here 

{
  // vscode默认启用了根据文件类型自动设置tabsize的选项
  "editor.detectIndentation": false,
  // 重新设定tabsize
  "editor.tabSize": 2,
  // #每次保存的时候自动格式化 
  "editor.formatOnSave": true,
  // #去掉代码结尾的分号 
  "prettier.semi": true,
  // #使用带引号替代双引号 
  "prettier.singleQuote": true,
  // #让函数(名)和后面的括号之间加个空格
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  // #让vue中的js按编辑器自带的ts格式进行格式化 
  "vetur.format.defaultFormatter.js": "vscode-typescript",
  // 选择 vue 文件中 template 的格式化工具
  "vetur.format.defaultFormatter.html": "js-beautify-html", 
  // vetur 的自定义设置
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      "wrap_attributes": "auto"
      // #vue组件中html代码格式化样式
    },
    "prettyhtml": {
      "printWidth": 160,
      "singleQuote": false,
      "wrapAttributes": false,
      "sortAttributes": false
    } ,
    "prettier": {
      "singleQuote": true,
      "semi": false
    }
  },
  "liveServer.settings.port": 5501
}

 

Guess you like

Origin blog.csdn.net/qq_42351675/article/details/128477818