{
// 文件目录图标
"workbench.iconTheme": "vscode-icons",
// vscode 调整窗口的缩放级别
"window.zoomLevel": 0.5,
//设置文字行高
"editor.lineHeight": 24,
// 设置字体
// "editor.fontFamily": "'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
//开启行数提示
"editor.lineNumbers": "on",
// 在输入时显示含有参数文档和类型信息的小面板。
"editor.parameterHints.enabled": true,
"diffEditor.ignoreTrimWhitespace": false,
// 每次保存的时候自动格式化
"editor.formatOnSave": true,
// vscode默认启用了根据文件类型自动设置tabsize的选项
"editor.detectIndentation": false,
// 空格键所占字符数
"editor.tabSize": 2,
// 代码自动换行
"editor.wordWrap": "on",
// 开启 vscode 文件路径导航
"breadcrumbs.enabled": true,
"javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single",
// #让函数(名)和后面的括号之间加个空格
// "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
// 预览模式关闭
"workbench.editor.enablePreview": true,
// 保存时运行的代码ESLint操作类型。
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
// -------------------- vetur 配置 --------------------
// vue文件默认格式化工具:vetur,vue 格式 格式化插件
"[vue]": {
"editor.defaultFormatter": "Vue.volar",
"editor.formatOnSave": true // 保存时是否自动格式化
},
// json格式 格式化插件
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// js格式 格式化插件
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// 配置 ESLint 检查的文件类型
"eslint.validate": ["javascript", "vue", "html", "javascriptreact"],
// 指定 vscode 的 eslint 所处理的文件的后缀
"eslint.options": {
"extensions": [".js", ".vue", ".ts", ".jsx", ".tsx"]
},
// 在onSave还是onType时执行linter。默认为onType。
"eslint.run": "onSave",
// 启用ESLint作为已验证文件的格式化程序。
"eslint.format.enable": true,
// 语言标识符的数组,为此ESLint扩展应被激活,并应尝试验证文件。
"eslint.probe": ["javascript", "javascriptreact", "vue-html", "vue", "html"],
"git.enableSmartCommit": true,
"editor.quickSuggestions": {
"strings": true,
"singleQuote": true
},
// #这个按用户自身习惯选择
"vetur.format.defaultFormatter.html": "js-beautify-html",
// #让vue中的js按编辑器自带的ts格式进行格式化
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.format.defaultFormatterOptions": {
"prettier": {
"printWidth": 200,
"tabWidth": 2, // prettier的tabWidth未明确设置时,取"vetur.format.options.tabSize" (useTabs 工作方式相同)
// 格式化不加分号
"semi": false,
// 格式化以单引号为主
"singleQuote": true,
"trailingComma": "none", // 禁止末尾添加逗号
"javascript.format.insertSpaceBeforeFunctionParenthesis": true, // 函数括号前是否加空格
"typescript.format.insertSpaceBeforeFunctionParenthesis": true, // 函数括号前是否加空格
"arrowParens": "avoid" // (x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号
},
"js-beautify-html": {
// "wrap_attributes": "force-aligned",
"wrap_attributes": "aligned-multiple", //当超出折行长度时,将属性进行垂直对齐
"wrap_line_length": 200,
"wrap_width_line": false,
"semi": false,
"singleQuote": true,
"max_preserve_newlines": 0
},
"prettyhtml": {
"printWidth": 300, //每行300字符
"singleQuote": true, //单引号强制转双引号
"wrapAttributes": false,
"sortAttributes": true
}
},
// "vetur.format.defaultFormatter.html": "js-beautify-html",
// "vetur.format.defaultFormatter.js": "prettier",
"javascript.updateImportsOnFileMove.enabled": "never",
"javascript.implicitProjectConfig.experimentalDecorators": true,
"workbench.editor.showTabs": true,
"gitlens.advanced.messages": {
"suppressCommitHasNoPreviousCommitWarning": false,
"suppressCommitNotFoundWarning": false,
"suppressFileNotUnderSourceControlWarning": false,
"suppressGitVersionWarning": false,
"suppressLineUncommittedWarning": false,
"suppressNoRepositoryWarning": false,
"suppressResultsExplorerNotice": false,
"suppressShowKeyBindingsNotice": true,
"suppressUpdateNotice": false,
"suppressWelcomeNotice": true
},
"gitlens.keymap": "alternate",
"gitlens.views.lineHistory.enabled": true,
// 文件折叠控制
"explorer.compactFolders": false,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
// tab 代码补全
"files.associations": {
"*.wpy": "vue",
"*.vue": "vue",
"*.cjson": "jsonc",
"*.wxss": "css",
"*.wxs": "javascript"
},
// 添加emmet支持vue文件
"emmet.includeLanguages": {
"wxml": "html",
"vue": "html"
},
// 两个选择器中是否换行
"minapp-vscode.disableAutoConfig": true,
//快速预览(右侧)
"editor.minimap.enabled": true,
"workbench.colorCustomizations": {
"minimapSlider.activeBackground": "#00FF00",
"minimapSlider.hoverBackground": "#00FF00",
"minimapSlider.background": "#FF0000"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[less]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"settingsSync.ignoredExtensions": [],
"workbench.startupEditor": "newUntitledFile",
"editor.semanticTokenColorCustomizations": null,
"editor.suggest.filterGraceful": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"settingsSync.ignoredSettings": [],
// 100 列后换行
"editor.wordWrapColumn": 200,
"git.confirmSync": false,
"singleQuote": true,
"semi": false,
"trailingComma": "none",
// #让prettier使用eslint的代码格式进行校验
"prettier.eslintIntegration": true,
"prettier.semi": true,
"prettier.singleQuote": true,
// style默认偏移一个indent
"vetur.format.styleInitialIndent": true,
// 定义匿名函数的函数关键字后面的空格处理。
"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
// 定义函数参数括号前的空格处理方式。#让函数(名)和后面的括号之间加个空格
"typescript.format.insertSpaceBeforeFunctionParenthesis": true,
"explorer.confirmDelete": true,
// 使用eslint-plugin-vue验证<template>中的vue-html
"vetur.validation.template": false,
"files.autoSave": "afterDelay",
"workbench.settings.applyToAllProfiles": [
]
// 指定用在工作台中的颜色主题。
// "workbench.colorTheme": "One Dark Pro"
}
Vscode 中的 settings.json
最新推荐文章于 2024-04-08 10:32:49 发布