There's an Astro extension for VS Code that provides syntax highlighting, completion and emmet support, but as of April 2022 it doesn't support auto-formatting.
There's a prettier plugin for Astro. We can install that and then configure VS Code to run Prettier when we save a file.
Let's start by installing prettier
and the Astro plugin into our project:
npm install -D prettier prettier-plugin-astro