当前位置:   article > 正文

基于vscode配置setting.json格式化文档,适合vue,react_vscode 格式化json

vscode 格式化json
  1. 安装vsCode prettier插件
  2. 修改配置文件 setting.json
    1. {
    2. "git.enableSmartCommit": true,
    3. // 修改注释颜色
    4. "editor.tokenColorCustomizations": {
    5. "comments": {
    6. "fontStyle": "bold",
    7. "foreground": "#82e0aa"
    8. }
    9. },
    10. // 配置文件类型识别
    11. "files.associations": {
    12. "*.js": "javascript",
    13. "*.json": "jsonc",
    14. "*.cjson": "jsonc",
    15. "*.wxss": "css",
    16. "*.wxs": "javascript"
    17. },
    18. "extensions.ignoreRecommendations": false,
    19. "files.exclude": {
    20. "**/.DS_Store": true,
    21. "**/.git": true,
    22. "**/.hg": true,
    23. "**/.svn": true,
    24. "**/CVS": true,
    25. "**/node_modules": false,
    26. "**/tmp": true
    27. },
    28. // "javascript.implicitProjectConfig.experimentalDecorators": true,
    29. "explorer.confirmDragAndDrop": false,
    30. "typescript.updateImportsOnFileMove.enabled": "prompt",
    31. "git.confirmSync": false,
    32. "editor.tabSize": 2,
    33. "editor.fontWeight": "500",
    34. "[json]": {},
    35. "editor.tabCompletion": "on",
    36. "vsicons.projectDetection.autoReload": true,
    37. "editor.fontFamily": "Monaco, 'Courier New', monospace, Meslo LG M for Powerline",
    38. "[html]": {
    39. "editor.defaultFormatter": "vscode.html-language-features"
    40. },
    41. "editor.fontSize": 16,
    42. "debug.console.fontSize": 14,
    43. "vsicons.dontShowNewVersionMessage": true,
    44. "editor.minimap.enabled": true,
    45. "emmet.extensionsPath": [
    46. ""
    47. ],
    48. // vue eslint start 保存时自动格式化代码
    49. "editor.formatOnSave": true,
    50. // eslint配置项,保存时自动修复错误
    51. "editor.codeActionsOnSave": {
    52. "source.fixAll": true
    53. },
    54. "vetur.ignoreProjectWarning": true,
    55. // 让vetur使用vs自带的js格式化工具
    56. // uni-app和vue 项目使用
    57. "vetur.format.defaultFormatter.js": "vscode-typescript",
    58. "javascript.format.semicolons": "remove",
    59. // // 指定 *.vue 文件的格式化工具为vetur
    60. "[vue]": {
    61. "editor.defaultFormatter": "octref.vetur"
    62. },
    63. // // 指定 *.js 文件的格式化工具为vscode自带
    64. "[javascript]": {
    65. "editor.defaultFormatter": "vscode.typescript-language-features"
    66. },
    67. // // 默认使用prettier格式化支持的文件
    68. "editor.defaultFormatter": "esbenp.prettier-vscode",
    69. "prettier.jsxBracketSameLine": true,
    70. // 函数前面加个空格
    71. "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    72. "prettier.singleQuote": true,
    73. "prettier.semi": false,
    74. // eslint end
    75. // react
    76. // 当按tab键的时候,会自动提示
    77. "emmet.triggerExpansionOnTab": true,
    78. "emmet.showAbbreviationSuggestions": true,
    79. "emmet.includeLanguages": {
    80. // jsx的提示
    81. "javascript": "javascriptreact",
    82. "vue-html": "html",
    83. "vue": "html",
    84. "wxml": "html"
    85. },
    86. // end
    87. "[jsonc]": {
    88. "editor.defaultFormatter": "vscode.json-language-features"
    89. },
    90. // @路径提示
    91. "path-intellisense.mappings": {
    92. "@": "${workspaceRoot}/src"
    93. },
    94. "security.workspace.trust.untrustedFiles": "open",
    95. "git.ignoreMissingGitWarning": true,
    96. "window.zoomLevel": 1
    97. }
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/733898
推荐阅读
相关标签
  

闽ICP备14008679号