setting.json

这篇文章详细解读了VSCode配置文件settings.json中的各项设置,重点关注了与Vue、HTML、CSS等前端开发相关的语法高亮、代码格式化、终端集成以及对屏幕阅读器用户的优化选项。
摘要由CSDN通过智能技术生成
{
  "files.associations": {
    "*.vue": "vue",
    "*.wpy": "vue",
    "*.wxml": "html",
    "*.wxss": "css",
    "*.html": "html"
  },
  "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
  "git.enableSmartCommit": true,
  "git.autofetch": true,
  "emmet.triggerExpansionOnTab": true,
  "emmet.showAbbreviationSuggestions": true,
  "emmet.showExpandedAbbreviation": "always",
  "emmet.includeLanguages": {
    "vue-html": "html",
    "vue": "html",
    "wpy": "html"
  },
  "git.confirmSync": false,
  "explorer.confirmDelete": false,
  "editor.fontSize": 14,
  "window.zoomLevel": 1,
  "editor.wordWrap": "on",
  // 控制编辑器是否应在对屏幕阅读器进行了优化的模式下运行。设置为“开”将禁用自动换行。
  //  - auto: 编辑器将使用平台 API 以检测是否附加了屏幕阅读器。
  //  - on: 编辑器将针对与屏幕阅读器搭配使用进行永久优化。将禁用自动换行。
  //  - off: 编辑器将不再对屏幕阅读器的使用进行优化。
  "editor.accessibilitySupport": "auto",
  "editor.detectIndentation": false,
  //  - off: 永不换行。
  //  - on: 将在视区宽度处换行。
  //  - inherit: 将根据 `editor.wordWrap` 设置换行。
  "diffEditor.wordWrap": "inherit",
  // 控制编辑器中可由屏幕阅读器一次读出的行数。我们检测到屏幕阅读器时,会自动将默认值设置为 500。警告: 如果行数大于默认值,可能会影响性能。
  "editor.accessibilityPageSize": 10,
  "diffEditor.ignoreTrimWhitespace": false, // 启用后,差异编辑器将忽略前导空格或尾随空格中的更改。
  // 重新设定tabsize
  "editor.tabSize": 2,
  // #值设置为true时,每次保存的时候自动格式化;
  "editor.formatOnSave": true,
  //每120行就显示一条线
  "editor.rulers": [],
  // 在使用搜索功能时,将这些文件夹/文件排除在外
  // "search.exclude": {
  // "**/node_modules": true,
  // "**/bower_components": true,
  // "**/target": true,
  // "**/logs": true,
  // 这些文件将不会显示在工作空间中
  "files.exclude": {
    //     "**/.git": true,
    //     "**/.svn": true,
    //     "**/.hg": true,
    //     "**/CVS": true,
    //     "**/.DS_Store": true,
    //     "**/*.js": {
    //         "when": "$(basename).ts" //ts编译后生成的js文件将不会显示在工作空中
    //     },
    //     "**/node_modules": true
  },
  // #让vue中的js按"prettier"格式进行格式化
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  "vetur.format.defaultFormatter.js": "prettier",
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      // #vue组件中html代码格式化样式
      "wrap_attributes": "force-aligned", //也可以设置为“auto”,效果会不一样
      "wrap_line_length": 200,
      "end_with_newline": false,
      "semi": false,
      "singleQuote": true
    },
    "prettier": {
      "printWidth": 200, // 代码宽度  js超过 300换行
      "bracketSameLine": true,
      "trailingComma": "none", //禁止随时添加逗号,这个很重要。找了好久
      "singleQuote": true, // 单引号不自动转换双引号
      "semi": false, // 不添加分号
      "proseWrap": "preserve", // 代码超出是否要换行 preserve保留
      "arrowParens": "avoid", // 箭头函数一个参数不加括号
      "editor.tabSize": 2
    },
    "prettyhtml": {
      "printWidth": 160,
      "singleQuote": false,
      "wrapAttributes": false,
      "sortAttributes": false
    }
  },
  "workbench.iconTheme": "vscode-icons",
  "vsicons.dontShowNewVersionMessage": true,
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "[css]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "backgroundCover.autoStatus": true,
  "editor.tabCompletion": "on", // 用来在出现推荐值时,按下Tab键是否自动填入最佳推荐值
  // "editor.codeActionsOnSave": {
  //   "source.fixAll.eslint": true,
  //   "source.organizeImports": true // 这个属性能够在保存时,自动调整 import 语句相关顺序,能够让你的 import 语句按照字母顺序进行排列
  // },
  "editor.lineNumbers": "on", // 设置代码行号
  "terminal.integrated.shell.osx": "zsh",
  "[jsonc]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "files.autoSave": "afterDelay",
  "liveServer.settings.donotShowInfoMsg": true,
  "[scss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.unicodeHighlight.invisibleCharacters": false,
  "editor.unicodeHighlight.ambiguousCharacters": false
}

参考:

vscode中setting.json配置详解_vscode的settings.json-CSDN博客

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值