如果要在保存时自动格式化内容,请在Visual Studio Code的工作区设置中添加以下代码片段。
菜单文件→偏好→工作区设置
{// Controls if the editor should automatically format the line after typing"beautify.onSave": true,
"editor.formatOnSave": true,
// You can auto format any files based on the file extensions type."beautify.JSfiles": ["js","json","jsbeautifyrc","jshintrc","ts"]}