Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check when @id is suggested and fix #1084

Closed
Jolg42 opened this issue Mar 16, 2022 · 1 comment · Fixed by #1192
Closed

Check when @id is suggested and fix #1084

Jolg42 opened this issue Mar 16, 2022 · 1 comment · Fixed by #1192
Assignees
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/schema Issue for team Schema. topic: autocompletion
Milestone

Comments

@Jolg42
Copy link
Member

Jolg42 commented Mar 16, 2022

@tomhoule found someething by reading the code during a review and it seems that we are too strict for when we suggest @id

Code

if (!(currentLine.includes('Int') || currentLine.includes('String'))) {
// id not allowed
suggestions = suggestions.filter((sugg) => sugg.label !== '@id')
}

Bytes and BigInt are common for PKs, and other types work too.

Originally posted by @tomhoule in #1072 (comment)

@Jolg42 Jolg42 added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. topic: autocompletion team/schema Issue for team Schema. labels Mar 16, 2022
@Jolg42 Jolg42 added this to the 3.12.0 milestone Mar 16, 2022
@Jolg42 Jolg42 changed the title Check when is @id suggested and fix Check when @id is suggested and fix Mar 16, 2022
@Jolg42 Jolg42 self-assigned this Mar 16, 2022
@Jolg42 Jolg42 modified the milestones: 3.12.0, 3.13.0 Apr 8, 2022
@Jolg42 Jolg42 modified the milestones: 3.13.0, 3.14.0 May 2, 2022
@Jolg42
Copy link
Member Author

Jolg42 commented Jun 27, 2022

Docs https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#id

Can be defined on any scalar field (String, Int, enum)
Cannot be defined on a relation field

@tomhoule so here I'll check to add it for enum and see if it's suggested on relation fields, anything else to check?

@Jolg42 Jolg42 added the process/candidate Candidate for next Milestone. label Jun 27, 2022
@floelhoeffel floelhoeffel removed the process/candidate Candidate for next Milestone. label Jun 29, 2022
@Jolg42 Jolg42 modified the milestones: 3.14.0, 4.1.0 Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/schema Issue for team Schema. topic: autocompletion
Development

Successfully merging a pull request may close this issue.

2 participants