Skip to content

Fix completion mode filtering + optimize scopeCompletions #23172

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rochala
Copy link
Contributor

@rochala rochala commented May 15, 2025

I've changed scopeCompletions to lazy val to memoize because I beliveve we don't need to recompute it. The actual fix is at the comment. There is no need to create a new Completer just to filter all of remaining completions at later stage.

Fixes #23150


// There are four possible ways for an extension method to be applicable

// 1. The extension method is visible under a simple name, by being defined or inherited or imported in a scope enclosing the reference.
val termCompleter = new Completer(Mode.Term, pos, untpdPath, matches)
val extMethodsInScope = termCompleter.scopeCompletions.names.toList.flatMap:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actual fix, I was also thinking about adding

case d: SymDenotation if d.isTerm && d.termRef.symbol.is(Extension) && include(d, name)

but the issue was actually the whole creation of new completer

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.

Presentation compiler still tries to complete package definition
1 participant