language-tools: Automatic alignment no longer works
Hi. I am not sure if I am doing something wrong, but since today, automatic formatting/alignment of schema.prisma file no longer works. It used to work properly before.
Noticed that there is some version upgrade. Any configuration to change from my end or is it a bug?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 29 (13 by maintainers)
To get this working again, I had to add the following to my
settings.json:@dkozma Thanks for your solution, it got me 99% of the way there. I had to add one more setting to get mine to work:
To be honest, no.
Simply saying add
"editor.formatOnSave": truewasn’t clear enough for me, and I doubt it would be for a few others…Changing it to…
…would be a little clearer. It would help devs who aren’t too familiar with configuring settings and associating it to an extension in VS Code.
Yeah well its fixed, just need @mavilein to do the review 😛
Can we add this to the docs or somewhere a user can access this information prior to them digging through various comments? 😃
Can confirm that this is fixed with 0.0.31 👍
Thank you for your persistence and patience on this issue everyone.
I’ve done some debugging. It looks like there was a regression in prisma’s formatter sometime in the last 8 days.
Given the following schema:
https://github.com/prisma/prisma-engines/commit/6aa23a61c78a5418a0231347458d639aa337ec1d is able to gracefully format this to:
However
prisma-fmttoday https://github.com/prisma/prisma-engines/commit/8814060fa684793b73d07dbfccd4b7777b3361ae yields this:We didn’t see this right away because our
prisma-fmthappened to be downloaded at a time when this worked. As of yesterday we’ve introduced version pinning so we’ll all share the sameprisma-fmt(assuming we’re on the same Prisma VSCode Extension version)I’ve opened an issue for the backend team to fix this regression: https://github.com/prisma/prisma-engines/issues/620
@matthewmueller
As @alexichepura mentioned, I can confirm this. After removing env(“url”) and also the new line/comment as mentioned in https://github.com/prisma/vscode/issues/62 the automatic alignment and formatting starts working properly. So, looks like a bug.
Even I got the error in devtools when I had env and new line:
I think it’s broken by
env("DATABASE_URL")This works:
And yes, there was an error in dev tools in vscode.
Thanks @dkozma and @nhuesmann! I’ll close this issue. Happy to re-open if this is still an issue after adding the setting above.