分享一波自己的vscode配置settings.json
{
// 保存后自动格式化
"editor.formatOnSave": true,
// jsx代码补全
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[html]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
// vscode默认启用了根据文件类型自动设置tabsize的选项
"editor.detectIndentation": false,
"editor.cursorStyle": "line", //光标为细竖线
// 重新设定tabsize
"editor.tabSize": 4,
// "javascript.format.insertSpaceBeforeFunctionParenthesis": true, //在方括号之间插入空格
// 标签代码不换行
"vetur.format.defaultFormatter.html": "js-beautify-html",
// #让vue中的js按编辑器自带的ts格式进行格式化
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "auto"
},
"prettyhtml": {
"printWidth": 100,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
}
},
"eslint.autoFixOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true // 每次保存的时候将代码按eslint格式进行修复
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"vetur.validation.template": false,
"editor.quickSuggestions": {
"strings": true
},
"files.autoSave": "off",
"files.associations": {},
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"tabnine.experimentalAutoImports": true,
"diffEditor.ignoreTrimWhitespace": false
}