withastro / language-tools

Language tools for Astro
MIT License
262 stars 52 forks source link

VSCode formatting doesn't work right after running `npm astro-create@latest` #946

Open mihailthebuilder opened 2 weeks ago

mihailthebuilder commented 2 weeks ago

Astro Info

Astro                    v4.14.5
Node                     v20.9.0
System                   Windows (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When I create a new Astro project with npm create-astro@latest, formatting in VSCode doesn't work. After I downgrade to an earlier version (4.11.3), it starts working again. I then upgrade to the latest version, and it works.

What's the expected result?

VSCode formatting works.

Link to Minimal Reproducible Example

https://github.com/mihailthebuilder/astro-format-bug

Participation

bluwy commented 2 weeks ago

Do you mean formatting of Astro files, or other files? Seems like this is more specific to vscode or the astro extension.

mihailthebuilder commented 2 weeks ago

@bluwy formatting of Astro files. Let me know if I should raise this issue in another repo.

kingman1016 commented 2 weeks ago

https://github.com/withastro/language-tools/issues/627#issuecomment-2307507501

kabirsync commented 2 weeks ago

adding prettier as a dev dependency seemed to fix this for me

"devDependencies": { "prettier": "^3.0.0" }

Princesseuh commented 2 weeks ago

This happens because of yaml-language-server, used now with content intellisense, having a dependency on Prettier 2, which cause formatting to fail.

I'm not sure what we'll be able to do for this, might need to fork upstream 😔