vscode 代码格式化
这种长长的代码格式看着很难受
看到这种就很舒服了
怎么改呢?
在vs code 按住快捷键Ctrl+shift+P搜索setting.json,加入以下代码块即可
{
"vetur.format.options.tabSize": 2,
"vetur.format.options.useTabs": false,
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatter.js": "vscode-typ=script",
"vetur.format.defaultFormatterOptions": {
"prettyhtml": {
"printWidth": 100, // No line exceeds 100 characters
"singleQuote": false // Prefer double quotes over single quotes
},
"js-beautify-html": {
"wrap_attributes": "auto",
"wrap_attributes_mode": "auto",
"wrap-line-length": 100,
"wrapped_attributes_per_line": "multiple",
"wrapped_attributes_indent": "auto",
"wrapped_attributes_end": "auto"
}
}
}
Vue3
下载插件Vue-Official
settings.json
"[vue]": {
"editor.defaultFormatter": "Vue.volar"
},