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

Improve autoimports on completion speed #6614

Merged
merged 1 commit into from
Nov 26, 2020

Conversation

SomeoneToIgnore
Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore commented Nov 24, 2020

Presumably closes #6594
May help #6612

  • Ignore modules eagerly
  • Do less completion string rendering

* Ignore modules eaferly
* Do less completion string rendering
Copy link
Member

@matklad matklad left a comment

Choose a reason for hiding this comment

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

bors r+

&ctx.sema,
ctx.krate?,
&potential_import_name,
50,
Copy link
Member

Choose a reason for hiding this comment

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

I wonder what heuristic is used by IntelliJ here to limit the set of auto-import candidates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll look at it at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like the results are not limited there at all.

This is the analogue of our imports_locator: https://github.com/intellij-rust/intellij-rust/blob/48d051f0b040e4cad5fc4dac7f07578e801c808e/src/main/kotlin/org/rust/ide/utils/import/ImportCandidatesCollector.kt

and its usage related to completions seems to be here:
https://github.com/intellij-rust/intellij-rust/blob/48d051f0b040e4cad5fc4dac7f07578e801c808e/src/main/kotlin/org/rust/lang/core/completion/RsCommonCompletionProvider.kt#L198

I think we can safely remove the limit from the imports_locator::find_similar_imports invocation, but still have to have the .take(40) or similar in the unqualified_path::fuzzy_completion function to avoid excessive insert imports calculation.

@bors
Copy link
Contributor

bors bot commented Nov 26, 2020

@bors bors bot merged commit db6988d into rust-lang:master Nov 26, 2020
@SomeoneToIgnore SomeoneToIgnore deleted the speed-up-completion-imports branch November 26, 2020 11:29
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.

Autoimport completion doesn't suggest std::env::var
2 participants