Closed testersen closed 5 months ago
i think this repo is dead
@ntotten
To fix this, you need to install the official astro vscode plugin then configure it as the default formatter for files ending with the .astro
extension in settings.json
After you've installed the plugin, running the Format Document
command on an astro component should warn you and provide a prompt to configure a default formatter. Select astro-build.astro-vscode
and it should automatically configure this for you.
Alternatively, you can do so manually by opening the command palette with ctrl + shift + p
and searching for Preferences: Open Settings (JSON)
(select the command variant corresponding to whichever scope you wish to configure). Add the following key-value pair to the root json object:
"[astro]": {
"editor.defaultFormatter": "astro-build.astro-vscode"
}
Save and exit and you may need to reload your editor but prettier should recognize astro files and format them as expected.
Yup, that did solve the issue, thank you! :)
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
When
editor.formatOnSave
is enabled and I save an astro file, nothing happens.When I use the
Format Document
command I the error I put as title:Extension 'Prettier - Code formatter' is configured as formatter but it cannot format 'Astro'-files
.When I use the
Format Document (Forced)
command it works.Expected result, format on save option should work along with the
Format Document
command.Versions
VS Code