vs code 代码格式化文件
操作步骤:
- 选择左下角settings

- 选择右上角 open settings

3.将js复制到其中即可
{
"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": 120, // 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": 320,
"wrapped_attributes_per_line": "multiple",
"wrapped_attributes_indent": "auto",
"wrapped_attributes_end": "auto"
}
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"explorer.confirmDelete": false,
"files.associations": {
"*.js": "html"
}
}
本文详细介绍如何在VSCode中设置代码格式化选项,包括调整tab大小、使用双引号而非单引号、指定默认的代码美化器等,适用于JS、Vue等前端开发语言。

被折叠的 条评论
为什么被折叠?



