在码云clone一个公司的项目,但是在家里Alt shift F 不能格式化文件, 相关插件有 ESLint,language-stylus,Manya's Stylus,Vetur,vue,vue 2 Snippets,Vue VSCode Snippets,以为是插件太多冲突了,禁用之后只留ES跟Vetur也无效,之后查看是不是设置有问题
{
"workbench.colorTheme": "Visual Studio Dark",
"git.ignoreMissingGitWarning": true,
"window.zoomLevel": 1,
"files.autoSave": "onFocusChange", // 自动保存
"workbench.iconTheme": "vscode-icons",
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true,
},
"editor.detectIndentation": false,
"less.compile": {
"compress": true,
"sourceMap": true,
"out": "${workspaceRoot}/css/",
},
// 强制单引号
"prettier.singleQuote": true,
// 开启 eslint 支持
"prettier.eslintIntegration": true,
// 保存时自动fix
"eslint.autoFixOnSave": true,
// 添加 vue 支持
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "vue",
"autoFix": true
}
],
// 使用插件格式化 html
"vetur.format.defaultFormatter.html": "js-beautify-html",
// 格式化插件的配置
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
// 属性强制折行对齐
"wrap_attributes": "force-aligned",
}
},
// 以下为stylus配置
"stylusSupremacy.insertColons": true, // 是否插入冒号
"stylusSupremacy.insertSemicolons": false, // 是否插入分好
"stylusSupremacy.insertBraces": false, // 是否插入大括号
"stylusSupremacy.insertNewLineAroundImports": false, // import之后是否换行
"stylusSupremacy.insertNewLineAroundBlocks": false // 两个选择器中是否换行
}
应该也没什么问题, 后来重新打开一个新的项目新建了一个vue文件,好使了,但是切回这个项目又不好使了...
思路中断ing
vscode在个别项目中无法格式化vue文件 项目出现,其他(无问题)项目并未出现
[Error - 6:23:27 PM] Request textDocument/formatting failed.
Message: Request textDocument/formatting failed with message: expected "indent", got ";"
Code: -32603
附上.editorconfig文件
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
搜索之后 发现是stylus写错了 所以格式化失败
.aa
.list
width: 100%
height: 200px
.ppp
width: 100%
width: 100px
height: 200px
更改css之后
.aa
.list
width: 100%
height: 200px
.ppp
width: 100%
width: 100px
height: 200px
stylus写错了 所以格式化 失败 检查下css就好了
vscode报错并未有提示 stylus 字样 Message: Request textDocument/formatting failed with message: expected "indent", got ";"
浪费了好多时间 Stylus ParseError: expected "indent", got "outdent"