Logo with initials
Click me x5 ↓

How to use Prettier with Svelte in VSCode


That’s going to be a short one, but it’s one of these things that:

  • Took longer to find than it should
  • Has the answer hidden in a Readme file

In Visual Studio Code, you need to:

  1. Install the extension Svelte for VS Code
  2. Install the Prettier Svelte Plugin.
  3. Open your settings, then open your settings.json file
  4. Set the following value:
    "[svelte]": {
        "editor.defaultFormatter": "svelte.svelte-vscode"

The setting was the missing piece for me. I don’t know why the Svelte Extension doesn’t set it by default.