vscode =>setting.json 常用配置 git背景图 自动保存 eslint

756 阅读1分钟

配置之后只需cstr+s就会自动格式化代码,更换背景颜色,延伸git插件,大大提升开发速度,让代码更加美观。

版一:

{
  "editor.tabSize": 2,
  "editor.detectIndentation": false,
  "editor.formatOnSave": true,
  "vetur.validation.template": false,
  "vetur.format.defaultFormatter.js": "vscode-typescript",
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      "wrap_attributes": "auto"
    },
    "prettyhtml": {
      "printWidth": 120,
      "singleQuote": false,
      "wrapAttributes": false,
      "sortAttributes": false
    }
  },
  "html.format.wrapAttributes": "auto",
  "eslint.autoFixOnSave": true,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "html",
    "vue",
    {
      "language": "html",
      "autoFix": true
    },
    {
      "language": "vue",
      "autoFix": true
    }
  ],
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  "files.autoSave": "afterDelay",
  "gitlens.advanced.messages": {
    "suppressCommitHasNoPreviousCommitWarning": false,
    "suppressCommitNotFoundWarning": false,
    "suppressFileNotUnderSourceControlWarning": false,
    "suppressGitVersionWarning": false,
    "suppressLineUncommittedWarning": false,
    "suppressNoRepositoryWarning": false,
    "suppressResultsExplorerNotice": false,
    "suppressShowKeyBindingsNotice": true
  },
  "git.confirmSync": false,
  "git.enableSmartCommit": true,
  "gitlens.historyExplorer.enabled": true,
  "files.autoSaveDelay": 3000,
  "workbench.startupEditor": "newUntitledFile",
  "workbench.iconTheme": "vs-minimal",
  "workbench.colorTheme": "dark-plus-syntax",
  "terminal.integrated.rendererType": "dom",
  "search.followSymlinks": false,
  "explorer.confirmDelete": false,
  "gitlens.views.fileHistory.enabled": true,
  "gitlens.views.lineHistory.enabled": true,
  "backgroundCover.imagePath": "file:///D:/用户目录/Pictures/bg4.jpg",
}

版本二:

{  //打开文件不覆盖  "workbench.editor.enablePreview": false,  //关闭快速预览  "editor.minimap.enabled": false,  //打开自动保存  "files.autoSave": "afterDelay",  //使用主题  "workbench.colorTheme": "Darcula Theme from IntelliJ",  // 头部注释  //快捷键 ctr+alt+i  //安装koroFileHeader插件  "fileheader.customMade": {    "Author": "yhy",    "Date": "Do not edit", // 设置后默认设置文件生成时间    "LastEditTime": "Do not edit", // 设置后,保存文件更改默认更新最后编辑时间    "LastEditors": "yhy", // 设置后,保存文件更改默认更新最后编辑人    "Description": ""  },  // 函数注释 快捷键ctr+alt+t  "fileheader.cursorMode": {    "description": "",    "param": "",    "return": ""  },  //手机项目rem适配  "px-to-rem.px-per-rem": 100,  // -----------------------自动格式化配置eslint+prettier-----------------------  // 每次保存自动格式化ctrl+s  "editor.formatOnSave": true,  // 每次保存的时候将代码按eslint格式进行修复  "editor.codeActionsOnSave": {    "source.fixAll.eslint": true  },  //配置内配置对 .vue 文件的格式化  "[vue]": {    "editor.defaultFormatter": "esbenp.prettier-vscode"  },  //配置内配置对 .ts 文件的格式化  "[typescript]": {    "editor.defaultFormatter": "esbenp.prettier-vscode"  },  //配置内配置对 .js 文件的格式化  "[javascript]": {    "editor.defaultFormatter": "esbenp.prettier-vscode"  },  //配置内配置对 .json 文件的格式化  "[jsonc]": {    "editor.defaultFormatter": "esbenp.prettier-vscode"  },  "editor.accessibilityPageSize": 20,  "editor.fontSize": 20}