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
lsp/completions: Implement a minimal completions provider #709
Conversation
Signed-off-by: Charlie Egan <charlie@styra.com>
Signed-off-by: Charlie Egan <charlie@styra.com>
c294dd8
to
ffe275f
Compare
Signed-off-by: Charlie Egan <charlie@styra.com>
We had been showing these in places where it'd not be suitable to use them Signed-off-by: Charlie Egan <charlie@styra.com>
Signed-off-by: Charlie Egan <charlie@styra.com>
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.
This is an awesome addition, and the refactoring was icing on the cake 👍 Just had a few comments, but I'd be happy to have it merged as is.
Thank you! 👏
} | ||
|
||
path := uri.ToPath(clients.IdentifierGeneric, fileURI) | ||
dir := filepath.Base(filepath.Dir(path)) |
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.
I suppose a next iteration could look at more components of the path, and translate /regal/rules/bugs/
to regal.rules.bugs
. But this is a great start!
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.
One of the challenges here is that we'd need to know where to stop, this would require being told the workspace root. should we always suggest the longest path, or all three? e/g/ bugs, rules.bugs, and regal.rules.bugs?
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.
Yeah, that is indeed a challenge. I guess what we could do is to start from the first 3 (or so) characters that match, so if you have something like:
/Users/charlie/projects/regal/rules/bugs
And you typed in package reg
it would base the suggestion from the first matching position in the string, which would be regal/rules/bugs
in this case. But yeah, I'm sure there would be cases where it could get tricky.
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.
Using the workspace root from the server's config feels like the right option here.
Do you think that we'd always want to suggest the longest package name we can, and that one only? I.e. only suggest regal.rules.bugs
If so, that might be worth doing as part of this 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.
Sounds good to me!
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.
See c163642
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.
very nice!
Signed-off-by: Charlie Egan <charlie@styra.com>
Signed-off-by: Charlie Egan <charlie@styra.com>
Signed-off-by: Charlie Egan <charlie@styra.com>
Related to #646, but more work to do here so not to close.
here is a little demo of what is done:
Screen.Recording.2024-05-09.at.18.31.57.mov