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

Tweak completion thresholds for quick completions #6918

Closed
wants to merge 1 commit into from

Conversation

matklad
Copy link
Member

@matklad matklad commented Dec 17, 2020

No description provided.

* don't even start auto-complete if fewer than 3 chars
* look for 100 fuzzy matched symbols, but *stop* at the first ten
  actually importable.
@matklad
Copy link
Member Author

matklad commented Dec 17, 2020

r? @SomeoneToIgnore

Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth to update the feature description about the 3 symbol trigger now.

I'm not sure about the limit(n) usage here: in my experiments, the rest of the completion item rendering was not that heavy after the import insert was moved away.
It also spoils the completion results a bit: I feel like precision might be more important in such case.

I wonder if we can come up with some heuristical order of importance we could put those completions in before calling take

@@ -144,6 +150,7 @@ fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()
})
})
.filter(|(mod_path, _)| mod_path.len() > 1)
.take(10)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will, most probably, will cause #6594 to reappear: in my experiments, this one had appeared somewhere after 20th result.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've installed your version and fiddling with it, so far we cannot propose PhantomData for phant input, we need more than 10 here for sure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it definitelly shows for me:

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha!

image

So looks like VS Code rejects some of the completions we are showing. And I've noticed something very interesting as well!

Note how the untaken list contains std::sync::mpsc::channel. I think thisshoudn't be a suggestion for phan, because phan spanns several path components. cc @jonas-schievink

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we need to support #![doc(hidden)] (inner) -- thtat's why flt2dec there. rust-analyzer discloses all of the compiler's easer eggs :D

@matklad
Copy link
Member Author

matklad commented Dec 17, 2020 via email

@SomeoneToIgnore
Copy link
Contributor

My main issue is that we start to loose some common results from stdlib with this threshold set.

What if we use something as simple as #6922 with this threshold?
I've checked both my and your PRs together and it shows PhantomData for pha input now, but still does not show std::env::var.

@matklad
Copy link
Member Author

matklad commented Dec 17, 2020

Yeah, #6922 is a great idea regardless of whether we go forward with this or not. But, looking carefully at the second screenshot, seems like we can prune quite a bit of things at the text maching level.

@matklad
Copy link
Member Author

matklad commented Dec 18, 2020

Found a surprising reason for high (persieved) completion latency: for some reason, my dispaly switched to 30Hz refresh rate =/

@lnicola
Copy link
Member

lnicola commented Dec 19, 2020

So the main issue is that we suggest substring completions across path segments, right?

@matklad
Copy link
Member Author

matklad commented Dec 19, 2020 via email

@matklad
Copy link
Member Author

matklad commented Dec 23, 2020

I think we should still improve filtering/ordering here, but I don't think it makes sense to merge this particular PR without that work first.

@matklad matklad closed this Dec 23, 2020
bors bot added a commit that referenced this pull request Dec 29, 2020
7064: Ignore qualifiers when doing autoimport completions lookup r=lnicola a=SomeoneToIgnore

A follow-up of #6918 (comment) and the PR itself.

Tweaks the `import_map` query api to be more flexible with the ways to match against the import path and now fuzzy imports search in names only.
This had improved the completion speed for me locally in ~5 times for `fuzzy_completion` span time, but please recheck me here.

IMO we're fast and presice enough now, so I've added the modules back to the fuzzy search output.

Also tweaks the the expect tests to display functions explicitly, to avoid confusing "duplicate" results.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants