-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: named constraints + improvements #919
Conversation
@do4gr Could you check if I missed something here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The completion utility changes are bit hard for me to navigate, maybe we can discuss that in our call this afternoon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, main remaining questions are around connector aware suggestions and test expectations as per my comments.
@@ -179,7 +227,8 @@ | |||
] | |||
}, | |||
{ | |||
"label": "@default()", | |||
"label": "@default", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on SQL Server defaults are also named. So there they will have a map argument. I'm not sure we currently have the capability to give connector aware autocomplete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have that, we also should adjust the map argument on primary keys, since on mysql and sqlite these are not named. Same goes for foreign keys on sqlite, we use no names there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, we could build that I think using some regex then.
{ line: 34, character: 13 }, | ||
{ | ||
isIncomplete: false, | ||
items: [fieldsProperty, nameProperty, mapProperty], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand it correctly that the items are the generated suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
{ line: 40, character: 33 }, | ||
{ | ||
isIncomplete: false, | ||
items: [fieldsProperty, nameProperty, mapProperty], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are then fields still suggested if already present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of @@unique()
it's expected to have all suggestions
In the case of @@unique([email, something], )
it is indeed not expected to have all suggestions, fields should be removed though this looks like something we should do in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that @@unique(fields: [email, something], )
would then work as expected (not suggest fields)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had a zoom call to review this, and it's indeed a big improvement, kudos!
Closes #825
The goal of this PR is to add auto-completion for named index / constraints added in 2.29.
I also used the available feature
insertText
which makes it possible to display something but insert a different version which we insert in snippet mode and$0
means that the cursor will move to that position for better auto-completion experience.