vscode使用的大坑,配置Vue保存格式化
直接复制下面代码到首选项的settings.json
{
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "Material Theme Palenight",
"editor.fontSize": 18,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.defaultFormatter": "octref.vetur",
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "force-expand-multiline",
"wrap_line_length": 250, //换行长度
"end_with_newline": false
},
"prettyhtml": {
"printWidth": 100, // No line exceeds 100 characters
"singleQuote": false // Prefer double quotes over single quotes
},
"prettier": {
"semi": false,
"singleQuote": true,
}
},
"vetur.format.defaultFormatter.js": "vscode-typescript", // js 使用 typescript
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
}