This is now an intergrated feature since Visual Studio Code v1.49.
Prettier Standard - format modified lines. A Visual Studio Code formatter extension.
Formats modified lines only via the experimental prettier-standard --lines
flag or formats the selected text via prettier-standard.
Install through VS Code extensions. Search for Prettier Standard - format modified lines
Visual Studio Marketplace: Prettier Standard - format modified lines
Can also be installed in VS Code: Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter:
ext install sebflipper.prettier-standard-format-modified-lines
To enable, add the follow to your editors or workspaces settings.json
.
{
"editor.formatOnSave": true,
"[javascript]": {
"editor.defaultFormatter": "sebflipper.prettier-standard-format-modified-lines"
},
"[javascriptreact]": {
"editor.defaultFormatter": "sebflipper.prettier-standard-format-modified-lines"
},
"[typescript]": {
"editor.defaultFormatter": "sebflipper.prettier-standard-format-modified-lines"
},
"[typescriptreact]": {
"editor.defaultFormatter": "sebflipper.prettier-standard-format-modified-lines"
},
// If needed, add additional Prettier Standard supported languages here...
}
- Only works on Mac or Linux.
See: CHANGELOG.md.