如题,网上有相关的解决方法,但使用后仍不生效,附setting.json设置
{
// vue提示配置
"emmet.syntaxProfiles": {
"vue‐html": "html",
"vue": "html"
},
// 主题使用Vue Theme
// "workbench.colorTheme": "Vue Theme",
// 使用vetur格式化vue文件
"vetur.format.defaultFormatter.html": "prettyhtml", // 默认html的方法
// 自动保存时使用eslint标准格式化文件
"eslint.autoFixOnSave": true,
// 自动保存时使用tslint标准格式化文件
"tslint.autoFixOnSave": true,
// eslint标准检测(需要格式化的语言必须在这里添加,否则格式化无效)
"eslint.validate": [
{
"language": "vue",
"autoFix": true
},
{
"language": "html",
"autoFix": true
},
{
"language": "javascript",
"autoFix": true
},
{
"language": "typescript",
"autoFix": true
},
{
"language": "json",
"autoFix": true
}
],
// vetur相关配置
"vetur.format.defaultFormatterOptions": {
// "js‐beautify‐html": {
// "wrap_attributes": "force‐expand‐multiline"
// },
// vetur对html片段配置
"prettyhtml": {
// 一行最长80个字符
"printWidth": 80,
// 使用单引号
"singleQuote": false,
"jsxBrackets": false,
// "wrapAttributes": true,
// 属性排序
"sortAttributes": false
},
// vetur对js格式化配置
"prettier": {
// 使用单引号
"singleQuote": true, // ' or ""
"semi": false, // 分号
"eslintIntegration": true, // 走eslint
}
},
// tab键为2个空格长度
"editor.tabSize": 2,
// 关闭,否则会影响eslint格式化配置
"editor.formatOnSave": false,
// 编辑器字体大小
"editor.fontSize": 22,
// 启用或禁用在 VS Code 中重命名或移动文件时自动更新 import 语句的路径。
"typescript.updateImportsOnFileMove.enabled": "always",
"git.confirmSync": false,
"emmet.triggerExpansionOnTab": true,
// "editor.quickSuggestions": {
// "other": true,
// "comments": false,
// "strings": true
// }
}