Logo with initials
Click me x5 ↓

VSCode isn’t formatting my Astro files

You start using Astro, it’s exciting! You install the VSCode extension, you restart VSCode. You install Prettier in your project, you install the prettier extension. It’s not formatting! What’s wrong?

A previous fix was to do the following:

  "[astro]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },

Now the above does not work

As of Astro v3, this works for me:

"[astro]": {
"editor.defaultFormatter": "astro-build.astro-vscode"
},

My thanks to Benedicte Raae and Khaled Garbaya for showing this to me.