VS Code uses js-beautify internally, but it lacks the ability to modify the style you wish to use. This extension enables running js-beautify in VS Code, AND honouring any .jsbeautifyrc file in the open file”s path tree to load your code styling. Run with F1 Beautify (to beautify a selection) or F1 Beautify file.
Đang xem: Làm đẹp code javascript
For help on the settings in the .jsbeautifyrc see Settings.md
When not using a multi-root workspace:
If there is a valid .jsbeautifyrc in the file”s path tree, up to project root, these will be the only settings used.If an option is a file path or object of configuration specified in the user or workspace settings like this: “beautify.config” : “string|Object.”, these will be the only settings used. The file path is interpreted relative to the workspace”s root folder.If there is a valid .jsbeautifyrc in the file”s path tree, above project root, these will be the only settings used.If there is a valid .jsbeautifyrc in your home directory, these will be the only settings used.
When using a multi-root workspace:Same as above, but the search ends at the nearest parent workspace root to the open file.
otherwise…
Settings are translated from your VS Code workspace/user settings.Any open editor settings (indent spaces/tabs) for the specific file are merged in.
.jsbeautifyrc settingVS Code setting
indent_inner_html
html.format.indentInnerHtml