-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: Improve parameter completion #12040
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
Conversation
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.
Another possible approach is to calculate and remove common prefix (attrs) and suffix (type params) existing in current param from completion's newText, but seems more difficult to do?
fn g(foo: (), mut ba$0: u32) | ||
fn f(foo: (), mut bar: u32) {} |
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.
Only when editor's insert mode set to replace
? Is there a way to test edit results with lsp cap and editor settings? Not seems possible with CompletionConfig
yet
fn f(foo: (), #[baz = "qux"] mut bar: u32) {} | ||
fn g(foo: (), mut ba$0) |
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.
Tests pass for both completion listing and edit, but doesn't work on my machine, not sure what's wrong.
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 might be the same bug that I fixed in #11967 - basically, the completion's lookup_by
must start with the characters in its range, otherwise the editor will filter out the completion
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 I understand correctly, 8f8f20f should fix this? At least it became working in my environment.
Works great for me, thanks! @bors r+ |
📌 Commit 8f8f20f has been approved by |
☀️ Test successful - checks-actions |
fix #12016 and handles some extra cases.