prisma-engines
prisma-engines copied to clipboard
fix(fmt): use camel case for new fields
Make the formatter add missing fields in camelCase instead of using the model's name.
Sorry for the poor pull request but I cannot build this nor run the tests. Hopefully it's as simple as this or someone better than me can take it over.
https://github.com/prisma/language-tools/issues/793 https://github.com/prisma/language-tools/issues/713
CodSpeed Performance Report
Merging #4150 will not alter performance
Comparing emi0x7d1:fmt-camelcase
(b3dd784) with main
(1071f46)
Summary
✅ 11
untouched benchmarks
May I ask why not? Using pascal case for the generated fields is strange. Most people will end up changing the name.
I guess either following the normal convention (camel case) or generating a hole that produces a syntax error would be better so that users know a field was generated and a bad named field doesn't slip through.
I don't think it uses pascal case, it just uses the unmodified casing of the model name that is being referenced.
I don't think it uses pascal case, it just uses the unmodified casing of the model name that is being referenced.
Yep, but since that's the naming convention most projects use, the generated field ends up looking weird.
Will this question be followed up? I'm tired of manually modifying the generated field names every time.
Hey folks, just so y'all know: as part of the 5.17 release, we've added quick-fixes that handle adding missing fields / relations with the behaviour that you're looking for in this PR.
PR: https://github.com/prisma/prisma-engines/pull/4953
@Druue
…as part of the 5.17 release, we've added quick-fixes that handle adding missing fields / relations with the behaviour that you're looking for in this PR.
I don't see that being the case nor do the test cases in https://github.com/prisma/prisma-engines/pull/4953 look like they handle the case.
I just tested it with v5.20.0
and I still get Invite Invite[]
instead of invites Invite[]
when the VS Code Extension adds the relation for me.
There is still this annoying mismatch between what the Docs suggests as best practice https://www.prisma.io/docs/orm/prisma-schema/data-model/relations#relation-fields posts Post[]
and what the extension does Post Post[]
. See https://github.com/prisma/language-tools/issues/713#issuecomment-785585859 for more.