Open jonyo opened 3 months ago
This is controlled by your Prettier settings, we don't really set something there. It's possible that the default Prettier setting changed, not sure.
This is controlled by your Prettier settings, we don't really set something there. It's possible that the default Prettier setting changed, not sure.
The prettier version did not change on the app I'm seeing this on, not for a while. And looking at the prettier docs, it did change, see the docs - in version 3 they went from es5
to all
, so if anything the opposite should have happened (it would have added more commas, not taken them away).
Like I said, it works fine if I downgrade the vscode Astro extension to version 2.8.0, and I found this isn't the only thing that was affected: I found that other bug #829 also affected by upgrading volar-service-prettier
internally, that one was already fixed.
That other issue isn't related to volar-service-prettier
, it was related to another dep upgrade that was done in the same patch that wasn't supposed to have an effect.
Do you set any Prettier config anywhere? Or is this using completely default config? Using the Prettier playground, the snippet you shared always get its last trailling comma removed when using the default settings
Using the Prettier playground, the snippet you shared always get its last trailling comma removed when using the default settings
Ah, yeah my example is too short, it ends up combining it to a single line foo(var1, var2)
and it does not use trailing comma in that case.
If you use something that is long enough to go multi-line, like this:
someReallyLongNAmeThingThatIsReallyLong(
someReallyLongVarThatISLongAnd,
SomeOtherReallyLongThing,
);
You'll see it does add the last comma in the default prettier playground here.
Just to see what happened, I specifically set trailingComma: always
in the prettier config in my project. Upgraded the Astro extension to the latest, reloaded the window, saved an astro file, it still removed the trailing comma on all multi-line function calls. Downgraded to 2.8.0 and save, it added them back.
Sorry I forgot to answer your question:
Do you set any Prettier config anywhere? Or is this using completely default config?
We set singleQuote: true
and it also inherits settings from our .editorconfig
file, but we do not set that setting specifically. As mentioned, I tried it just now and it still had no effect.
Describe the Bug
When I save an astro file, it removes trailing commas from multi-line function calls.
If I downgrade to version 2.8.0 and save, it adds them back again when I save.
I wonder if it is also related to #823 - I found another issue that sounded like it was similarly affected, #829 - though the specific fix for that one did not address this one.
Steps to Reproduce
EDIT: After comments, here is a better example, since the above ends up on a single line which does not have trailing comma: