Prettier x64Download this extension from the Visual Studio Marketplace Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary. This extension was originally forked from Mads Kristensen's JavaScript Prettier. It was renamed, refactored, and updated for Visual Studio 2022+ x64 compatibility. It also now supports any file types supported by Prettier. See the change log for changes and road map. Features
PrettifyThis extension calls the Prettier node module behind the scenes to format any supported file type to its standards. For example, take the following code:
That looks like the right way to format it. However, we've all run into this situation:
Suddenly our previous format for calling function breaks down because this is too long. What you would probably do is this instead:
Invoke the command from the context menu in the editor or via hotkey CTRL + K + J.
FAQConfiguration via .prettierrcIt is quite easy to setup Prettier to format a little bit differently, like having 4 spaces instead of 2 spaces per tab. The easiest way is to create a Here is an example containing the two most common settings that people want to change:
Read more about Prettier configuration options here. SettingsAccess extension settings within Visual Studio via Tools >>> Options, Prettier.
Can it use my bundled version of Prettier?Yes, the plugin will search for a locally (relative to the open file) installed Prettier version before falling back to its own version. It does not currently support using a globally installed version of Prettier, and will use its embedded version instead. TroubleshootingIf Prettier isn't formatting your files:
License |
