Logo with initials

How to use Prettier with Svelte in VSCode

Hello,

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. Open your settings, then open your settings.json file
  3. 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.