Repository navigation
Auto imports in completion - #6553
Conversation
|
I've tried to emphasise this by adding a full qualifier to the completion label (we don't do that for anything else), but can add something else too, any particular ideas? |
60e5fe2 to
25e30c6
Compare
|
The last bullet is #6565 |
matklad
left a comment
There was a problem hiding this comment.
Nice!
I like how its' not that much code in the end: we did build some nice infrastructure for this!
| local_query.limit(40); | ||
| local_query | ||
| }, | ||
| ExternalImportablesQuery::new(name_to_import).anchor_end().case_sensitive().limit(40), |
There was a problem hiding this comment.
Why we don't set exact for External imports?
There was a problem hiding this comment.
Query objects have different methods, this one has no exact, but has achor_end with the documentation:
/// Only returns items whose paths end with the (case-insensitive) query string as their last
/// segment.
If you mean the |
|
... we might need a separate index for that though, indexing traits by their contained methods. |
25e30c6 to
d4128be
Compare
And also the code that I've used, was very performant this time, no issues with the lookup at all.
I've meant that we miss this index, yes. |
I've rebased this PR on top and rechecked, looks like the behaviour did not change much. |
|
@SomeoneToIgnore I mean you need to flip |
|
Well, if we are doing good job, we shouldn't see those messages even if every IDE feature is horrible slow :-) This messages track not whether features are fast, but whether they block the main loop. |
|
bors r+ |
|
This is so amazing! Great work @SomeoneToIgnore |
|
My feelings are quite mixed when I hear this, so I'll allow myself a little praise on the topic once to explain why I as a contributor would prefer to be ignored in this situation. Since my early days of participation in this project, I wanted to implement this feature, it felt cool and charming to be able to deliver such magic to hundreds of people across the globe. Overall, I've taken 3 serious stabs at this issue and every time it was a different experience:
Almost 2 years since the original ticket, people were pursuing their own needs, investing into RA infra, their work was supported, PRs reviewed and merged. I think, this is a remarkable (and relatively rare) sign that we're on the right track and we need to thank everybody who participates in this development. |
|
@SomeoneToIgnore This appears to be the cause of the performance regression described in #6612. Reverting this PR, building and installing rust-analyzer locally fixed it for me. |
|
Can we move the work into completionItem/resolve for clients that support it? See #6366 |
|
I feel like an "experimental completions" toggle be quicker to add for me first, we'll need it anyway later. |
6650: Make completion and assists module independent r=matklad a=SomeoneToIgnore A follow-up of #6553 (comment) Move the common code for both assists and completion modules into a separate crate. Co-authored-by: Kirill Bulatov <[email protected]>

Closes #1062 but does not handle the completion order, since it's a separate task for #4922 , #4922 and maybe something else.
2 quirks in the current implementation:
If I understand the current situation right, we cannot search for traits by a part of a method name, we need a full name with correct case to get a trait for it.
Intellij is able to refresh the completions on every new symbol added, yet VS Code does not query the completions on every symbol for me.
With a few debug prints placed in RA, I've observed the following behaviour: after the first set of completion suggestions is received, next symbol input does not trigger a server request, if the completions contain this symbol.
When more symbols added, the existing completion suggestions are filtered out until none are left and only then, on the next symbol it queries for completions.
It seems like the only alternative to get an updated set of results is to manually retrigger it with Esc and Ctrl + Space.
Despite the eerie latter bullet, the completion seems to work pretty fine and fast nontheless, but if you have any ideas on how to make it more smooth, I'll gladly try it out.