Search for Unibeautify
extension and click Install
.
See Install an extension for more details.
code --install-extension Glavin001.unibeautify-vscode
See https://github.com/Unibeautify/vscode/blob/master/src/beautifiers.ts for list of supported beautifiers.
# | Beautifier | Documentation |
---|---|---|
1 | Black | https://unibeautify.com/docs/beautifier-black.html |
2 | CSScomb | https://unibeautify.com/docs/beautifier-csscomb.html |
3 | ClangFormat | https://unibeautify.com/docs/beautifier-clangformat.html |
4 | ESLint | https://unibeautify.com/docs/beautifier-eslint.html |
5 | Gofmt | https://unibeautify.com/docs/beautifier-gofmt.html |
6 | JS-Beautify | https://unibeautify.com/docs/beautifier-js-beautify.html |
7 | PHP-CS-Fixer | https://unibeautify.com/docs/beautifier-php-cs-fixer.html |
8 | PHP_CodeSniffer | https://unibeautify.com/docs/beautifier-php_codesniffer.html |
9 | Prettier | https://unibeautify.com/docs/beautifier-prettier.html |
10 | Pretty Diff | https://unibeautify.com/docs/beautifier-pretty-diff.html |
11 | TSLint | https://unibeautify.com/docs/beautifier-tslint.html |
12 | YAPF | https://unibeautify.com/docs/beautifier-yapf.html |
13 | sqlformat | https://unibeautify.com/docs/beautifier-sqlformat.html |
14 | stylelint | https://unibeautify.com/docs/beautifier-stylelint.html |
Important: You must first configure for the extension to work properly.
Use the Unibeautify Assistant for an interactive setup of your configuration file. Simply select the languages you want and the configuration assistant will walk you though the options available. At the end, simply download or copy to your clipboard your configuration.
See https://unibeautify.com/docs/config-file.html for details.
Given the following scenario:
indent_style
to be space
indent_size
to be 2
Create a .unibeautifyrc.yml
file in your project's root directory with the following contents:
---
JavaScript: # Enable language
beautifiers: ["Prettier"] # Enable beautifiers
indent_style: "space"
indent_size: 2
Then look at https://unibeautify.com/docs/beautifier-prettier.html and https://unibeautify.com/docs/options-for-languages.html for more supported options.
We provide the option to set a path to a default configuration file, so whenever a project of yours has no, e.g. .unibeautifyrc.yml
, the default configuration will be used as a fallback.
To enable this, just add this to your VSCode settings:
"unibeautify.defaultConfig": "/path/to/your/.unibeautifyrc.yml",
From Stack Overflow:
Open the Command Palette (Ctrl +Shift+ P or Command + Shift + P on Mac) and search for format
:
Format Document
- Formats the entire editor document.Format Selection
- Formats only the selection. Only appears when text selected.See CONTRIBUTING.md.