Skip to content

Instantly share code, notes, and snippets.

@davehague
Created November 25, 2024 15:43
Show Gist options
  • Save davehague/6b39271c3c19eab2834a843c01f2ba75 to your computer and use it in GitHub Desktop.
Save davehague/6b39271c3c19eab2834a843c01f2ba75 to your computer and use it in GitHub Desktop.
Configure Default Formatter in VS Code

Default Formatter in VS Code

VS code will ask you the first time but if you make the wrong choice or want to change it, here's how you change it:

  1. Access the Command Palette by pressing Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac).
  2. Type and select "Format Document With..." from the command palette.
  3. At the bottom of the list, click on "Configure Default Formatter...".

To test, on a file use Alt-Shift-F to format.

Note for Vue: Use "Vue Official", it works better than Prettier.

Format on Save

To format on save, follow these steps:

  1. Open VS code settings (key command: Ctrl + ,
  2. Search for "format on save"
  3. Check to box to format on save, and choose "Format on Save Mode: modifications"

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment