美文网首页
vs code 代码格式化配置

vs code 代码格式化配置

作者: 我有一条小黑狗 | 来源:发表于2022-12-14 13:30 被阅读0次

{

  "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",

  " workbench.colorTheme": "Monokai",

  "editor.matchBrackets": "never",

  "workbench.iconTheme": "vscode-icons",

  "diffEditor.ignoreTrimWhitespace": false,

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

  "editor.detectIndentation": false,

  // 重新设定tabsize

  "editor.tabSize": 2,

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

  "editor.formatOnSave": true,

  //  #去掉代码结尾的分号

  "prettier.semi": false,

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

  "eslint.autoFixOnSave": true,

  // 添加 vue 支持

  "eslint.validate": [

    "javascript",

    "javascriptreact",

    {

      "language": "vue",

      "autoFix": true

    }

  ],

  //  #让prettier使用eslint的代码格式进行校验

  "prettier.eslintIntegration": true,

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

  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,

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

  "vetur.format.defaultFormatter.js": "prettier",

  "vetur.format.defaultFormatterOptions": {

    // 自定义配置

    "js-beautify-html": {

      "wrap_line_length": 0, // Lines should wrap at next opportunity after this number of characters (0 disables)

      "wrap_attributes": "auto", // 换行,[auto|force|force-aligned|force-expand-multiline] ["auto"]

      "indent_size": 2 // 缩进大小

    },

    "prettier": {

      "trailingComma": "es6",

      "tabWidth": 2,

      "semi": false,

      "singleQuote": true

    }

  },

  // 格式化stylus, 需安装Manta's Stylus Supremacy插件

  "stylusSupremacy.insertColons": false, // 是否插入冒号

  "stylusSupremacy.insertSemicolons": false, // 是否插入分号

  "stylusSupremacy.insertBraces": false, // 是否插入大括号

  "stylusSupremacy.insertNewLineAroundImports": false, // import之后是否换行

  "stylusSupremacy.insertNewLineAroundBlocks": false,

  "editor.codeActionsOnSave": {

    "source.fixAll.eslint": true

  },

  "eslint.codeAction.disableRuleComment": {},

  "explorer.confirmDelete": false,

  "files.autoSave": "afterDelay",

  "git.confirmSync": false,

  "[vue]": {

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

  },

  "[javascript]": {

    "editor.defaultFormatter": "vscode.typescript-language-features"

  },

  "vsicons.dontShowNewVersionMessage": true,

  "git.suggestSmartCommit": false,

  "javascript.updateImportsOnFileMove.enabled": "always",

  "files.associations": {

    "*.vue": "vue"

  },

  "prettier.jsxSingleQuote": true,

  "http.proxyAuthorization": null,

  "security.workspace.trust.untrustedFiles": "open",

  //  #使用带引号替代双引号

  "prettier.singleQuote": true,

  "git.autofetch": true,

  "typescript.updateImportsOnFileMove.enabled": "always",

  "[html]": {

    "editor.defaultFormatter": "vscode.html-language-features"

  },

  "cSpell.userWords": [

    "btns",

    "iconfont",

    "radioes",

    "tabbar",

    "Vant",

    "vuex"

  ],

  "explorer.confirmDragAndDrop": false,

  "[typescript]": {

    "editor.defaultFormatter": "vscode.typescript-language-features"

  },

  "[scss]": {

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

  },

  "editor.wordWrap": "wordWrapColumn",

  "editor.wordWrapColumn": 200,

  "[javascriptreact]": {

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

  },

  "bracketPairColorizer.depreciation-notice": false,

  "tabnine.experimentalAutoImports": true,

  "search.followSymlinks": false,

  "git.ignoredRepositories": [

    "/src/config-token.js"

  ],

  "[css]": {

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

  },

  "git.repositoryScanIgnoredFolders": [

    "node_modules",

    "/src/config.ts"

  ],

  "editor.fontWeight": "normal",

  "github.copilot.advanced": {

  }

}

相关文章

网友评论

      本文标题:vs code 代码格式化配置

      本文链接:https://www.haomeiwen.com/subject/siyhqdtx.html