当前位置:   article > 正文

vsCode的常用settings.json配置_vscode setting.json 常用设置

vscode setting.json 常用设置
  1. {
  2. // 換行
  3. "editor.wordWrap": "on",
  4. // 是否允许自定义的snippet片段提示
  5. "editor.snippetSuggestions": "top",
  6. // vscode默认启用了根据文件类型自动设置tabsize的选项 不檢查縮進,保存后統一按設置項來設置
  7. "editor.detectIndentation": false,
  8. // 重新设定tabsize 代码缩进修改成 2 个空格
  9. "editor.tabSize": 2,
  10. // #每次保存的时候自动格式化
  11. "editor.formatOnSave": false,
  12. // #每次保存的时候将代码按eslint格式进行修复 使用eslint 風格使用standard 進行代碼規則限制
  13. "editor.fontWeight": "200",
  14. "editor.formatOnType": false,
  15. "workbench.iconTheme": "vscode-icons-mac",
  16. "git.confirmSync": false,
  17. "team.showWelcomeMessage": false,
  18. "window.zoomLevel": 0,
  19. "editor.renderWhitespace": "boundary",
  20. "editor.cursorBlinking": "smooth",
  21. "editor.minimap.enabled": true,
  22. "editor.minimap.renderCharacters": false,
  23. "window.title": "${dirty}${activeEditorMedium}${separator}${rootName}",
  24. "editor.codeLens": true,
  25. // eslint 代码自动检查相关配置
  26. "eslint.enable": true,
  27. "eslint.run": "onType",
  28. "eslint.options": {
  29. "configFile": "D:/.eslintrc.js",
  30. "plugins": [
  31. "html"
  32. ],
  33. "extensions": [
  34. ".js",
  35. ".vue"
  36. ]
  37. },
  38. // 添加 vue 支持
  39. "eslint.validate": [
  40. "javascript",
  41. "javascriptreact",
  42. "html",
  43. "vue"
  44. ],
  45. // #让prettier使用eslint的代码格式进行校验
  46. "prettier.eslintIntegration": true,
  47. // #去掉代码结尾的分号
  48. "prettier.semi": true,
  49. // #使用单引号替代双引号
  50. "prettier.singleQuote": true,
  51. "prettier.tabWidth": 4,
  52. // #让函数(名)和后面的括号之间加个空格
  53. "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  54. // #这个按用户自身习惯选择 html格式化
  55. "vetur.format.defaultFormatter.html": "js-beautify-html",
  56. // #让vue中的js按"prettier"格式进行格式化
  57. "vetur.format.defaultFormatter.js": "prettier",
  58. // #让vue中的js按编辑器自带的ts格式进行格式化
  59. // "vetur.format.defaultFormatter.js": "vscode-typescript",
  60. "explorer.confirmDelete": false,
  61. "vetur.format.defaultFormatterOptions": {
  62. "js-beautify-html": {
  63. // #vue组件中html代码格式化样式
  64. "wrap_attributes": "force-aligned", // 也可以设置为"auto", 效果会不一样
  65. "wrap_line_length": 200,
  66. "end_with_newline": false,
  67. "semi": false,
  68. "singleQuote": true
  69. },
  70. "prettier": {
  71. "semi": false,
  72. "singleQuote": true
  73. }
  74. },
  75. "[jsonc]": {
  76. "editor.defaultFormatter": "esbenp.prettier-vscode"
  77. },
  78. // 格式化stylus, 需安装Manta's Stylus Supremacy插件
  79. "stylusSupremacy.insertColons": false, // 是否插入冒号
  80. "stylusSupremacy.insertSemicolons": false, // 是否插入分号
  81. "stylusSupremacy.insertBraces": false, // 是否插入大括号
  82. "stylusSupremacy.insertNewLineAroundImports": false, // import之后是否换行
  83. "stylusSupremacy.insertNewLineAroundBlocks": false, // 两个选择器中是否换行
  84. "prettier.useTabs": true,
  85. "explorer.confirmDelete": false,
  86. "[javascript]": {
  87. "editor.defaultFormatter": "esbenp.prettier-vscode"
  88. },
  89. "[json]": {
  90. "editor.defaultFormatter": "esbenp.prettier-vscode"
  91. },
  92. "diffEditor.ignoreTrimWhitespace": false,
  93. // "terminal.integrated.shell.osx": "zsh",
  94. "files.associations": {
  95. "*.cjson": "jsonc",
  96. "*.wxss": "css",
  97. "*.wxs": "javascript"
  98. },
  99. "emmet.includeLanguages": {
  100. "wxml": "html"
  101. },
  102. "minapp-vscode.disableAutoConfig": true,
  103. "window.menuBarVisibility": "visible",
  104. "git.enableSmartCommit": true,
  105. "git.autofetch": true,
  106. "liveServer.settings.donotShowInfoMsg": true,
  107. "[html]": {
  108. "editor.defaultFormatter": "vscode.html-language-features"
  109. },
  110. "javascript.updateImportsOnFileMove.enabled": "always",
  111. "workbench.colorTheme": "SynthWave '84",
  112. // 字體大小
  113. "editor.fontSize": 15,
  114. // 設置行高
  115. "editor.lineHeight": 20,
  116. "search.followSymlinks": false,
  117. "workbench.sideBar.location": "left",
  118. "vscode_custom_css.policy": true,
  119. "vscode_custom_css.imports": [
  120. "file:///C:/vscode-transparent/synthwave84.css",
  121. "file:///C:/vscode-transparent/toolbar.css",
  122. "file:///C:/vscode-transparent/vscode-vibrancy-style.css",
  123. "file:///C:/vscode-transparent/enable-electron-vibrancy.js"
  124. ],
  125. // 高亮的颜色,emm暂时只支持这样写
  126. "wxmlConfig.activeColor": {
  127. "color": "#e5c07b"
  128. },
  129. // 是否禁用高亮组件
  130. "wxmlConfig.activeDisable": false,
  131. // 是否开启保存自动格式化
  132. "wxmlConfig.onSaveFormat": false,
  133. "wxmlConfig.format": {
  134. "brace_style": "collapse",
  135. "end_with_newline": false,
  136. "indent_char": "",
  137. "indent_handlebars": false,
  138. "indent_inner_html": false,
  139. "indent_scripts": "keep",
  140. "indent_size": 2,
  141. "indent_with_tabs": false,
  142. "max_preserve_newlines": 1,
  143. "preserve_newlines": false,
  144. "wrap_attributes": "force-expand-multiline"
  145. },
  146. // 高亮所忽略的组件数组
  147. "wxmlConfig.tagNoActiveArr": [
  148. "view",
  149. "button",
  150. "text",
  151. "icon",
  152. "image",
  153. "navigator",
  154. "block",
  155. "input",
  156. "template",
  157. "form",
  158. "camera",
  159. "textarea"
  160. ],
  161. "zenMode.restore": true,
  162. "breadcrumbs.enabled": true,
  163. "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
  164. "[wxml]": {
  165. "editor.defaultFormatter": "qiu8310.minapp-vscode"
  166. },
  167. "gitlens.advanced.messages": {
  168. "suppressLineUncommittedWarning": true
  169. },
  170. "javascript.format.placeOpenBraceOnNewLineForControlBlocks": true,
  171. "editor.formatOnPaste": false,
  172. "vsicons.presets.hideFolders": true,
  173. "editor.cursorStyle": "line-thin",
  174. "editor.suggestSelection": "first",
  175. "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
  176. // #每次保存的时候将代码按照 eslint 格式进行修复
  177. "editor.codeActionsOnSave": {
  178. "source.fixAll.eslint": true
  179. },
  180. "terminal.integrated.rendererType": "dom",
  181. "vscode_vibrancy.opacity": 1,
  182. "npm.fetchOnlinePackageInfo": false,
  183. "[typescript]": {
  184. "editor.defaultFormatter": "esbenp.prettier-vscode"
  185. },
  186. "[vue]": {
  187. "editor.defaultFormatter": "esbenp.prettier-vscode"
  188. }
  189. }

简易格式化代码,代码高亮设置,针对代码规范的卡控,常用的一些配置,后期会进行扩充,最近再写ts,有时候eslint会出现很多报错,影响了开发效率和质量。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/762954
推荐阅读
相关标签
  

闽ICP备14008679号