settings.json粘贴一下代码即可,下图所示settings.json位置
{
// vscode默认启用了根据文件类型自动设置tabsize的选项
"editor.detectIndentation": false,
"diffEditor.ignoreTrimWhitespace": false,
"workbench.startupEditor": "newUntitledFile",
// 设置默认tab空格
"editor.tabSize": 2,
"security.workspace.trust.untrustedFiles": "open",
"explorer.confirmDelete": false,
"javascript.updateImportsOnFileMove.enabled": "always",
// 这几个设置默认的格式化工具,hmtl用beautify
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[html]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
// "[html]": {
// "editor.defaultFormatter": "dbaeumer.vscode-eslint"
// },
// 用这个来代替eslint中的source.fixAll
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.fixAll.eslint": true
},
// 添加 vue 支持,现在不用这种方式了
// "eslint.validate": [
// "html",
// "javascript",
// "vue",
// "html",
// ".js"
// ],
"eslint.alwaysShowStatus": true
//用ESLint作为已验证文件的格式化程序
// 更好的方式是使用 "[javascript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }
// 这个enable也不需要,会冲突,
// "eslint.format.enable": true,
// "vetur.validation.template": true,
// "workbench.editor.untitled.hint": "hidden"
}