DEV Community

Discussion on: VS Code - You don't need a formatting extension (Prettier and friends)

Collapse
 
marblewraith profile image
Matthew Rath

This kind of "light touch" formatting is more akin to autocorrecting typo's with more granular control, and it's a welcome addition 👍

Impossible to use prettier, it does weird shit to arrays and style selectors.

Earlier this year vscode added multi-lang definitions, you can significantly shorten the config required in settings.json, instead of the above do the following:

"[javascript][javascriptreact][typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},

"[json][jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},

"[css][scss][less]": {
"editor.defaultFormatter": "vscode.css-language-features"
},

Collapse
 
robole profile image
Rob OLeary

Thanks for sharing the multi-lang syntax! I had wondered why it wasn't supported in the past! 🤔