vscode
prettier
Install prettier extension on vscode Click here to install visit Prettier - Code formatter
Open the vscode setting window using File > Preferences > Settings
Shortcut - Settings Window (ctrl + ,)
Search for Editor: Default Formatter
and select Prettier-code formatter
from drop-down
Search for Editor: Format On Save
and activate the format a file on save
Why does Prettier not format code in VS Code?
- Check if Prettier is the default formatter by opening settings windows
Shortcut - Settings Window (ctrl + ,)
- If Prettier is already set and still code format is not working, then
Press ctrl+shift+p > Format Document With... > Configure Default Formatter... > Prettier - Code formatter