当前位置: 代码迷 >> 综合 >> vscod代码(vue)格式化
  详细解决方案

vscod代码(vue)格式化

热度:90   发布时间:2024-02-20 10:06:14.0

vscod代码格式化:

{

  // vscode默认启用了根据文件类型自动设置tabsize的选项

  "editor.detectIndentation": false,

  // 重新设定tabsize

  "editor.tabSize": 4,

  // #每次保存的时候自动格式化

  "editor.formatOnSave": true,

  // #每次保存的时候将代码按eslint格式进行修复

  "eslint.autoFixOnSave": true,

  // #让函数(名)和后面的括号之间加个空格

  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,

  // #这个按用户自身习惯选择

  "vetur.format.defaultFormatter.html": "js-beautify-html",

  // #让vue中的js按编辑器自带的ts格式进行格式化

  "vetur.format.defaultFormatter.js": "vscode-typescript",

  "vetur.format.defaultFormatterOptions": {

    "js-beautify-html": {

      "wrap_attributes": "force-aligned"

      // #vue组件中html代码格式化样式

    }

  },

  "vetur.format.options.tabSize": 4,

  "editor.fontSize": 14,

  "window.zoomLevel": 0,

  "[javascript]": {

    "editor.defaultFormatter": "esbenp.prettier-vscode"

  },

  "git.autofetch": true,

  "git.confirmSync": false,

  "gitlens.advanced.messages": {

    "suppressCommitHasNoPreviousCommitWarning": true

  },

  "editor.codeActionsOnSave": {

    "source.fixAll.eslint": true

  },

  "prettier.requireConfig": true,

  "[vue]": {

    "editor.defaultFormatter": "octref.vetur"

  },

  "editor.renderWhitespace": "none",

  "editor.renderControlCharacters": false

}

  相关解决方案