@@ -370,7 +370,7 @@ object Completion:
370
370
* For the results of all `xyzCompletions` methods term names and type names are always treated as different keys in the same map
371
371
* and they never conflict with each other.
372
372
*/
373
- class Completer (val mode : Mode , pos : SourcePosition , untpdPath : List [untpd.Tree ], matches : Name => Boolean ):
373
+ class Completer (val mode : Mode , pos : SourcePosition , untpdPath : List [untpd.Tree ], matches : Name => Boolean )( using Context ) :
374
374
/** Completions for terms and types that are currently in scope:
375
375
* the members of the current class, local definitions and the symbols that have been imported,
376
376
* recursively adding completions from outer scopes.
@@ -384,7 +384,7 @@ object Completion:
384
384
* (even if the import follows it syntactically)
385
385
* - a more deeply nested import shadowing a member or a local definition causes an ambiguity
386
386
*/
387
- def scopeCompletions ( using context : Context ) : CompletionResult =
387
+ lazy val scopeCompletions : CompletionResult =
388
388
389
389
/** Temporary data structure representing denotations with the same name introduced in a given scope
390
390
* as a member of a type, by a local definition or by an import clause
@@ -619,8 +619,7 @@ object Completion:
619
619
// There are four possible ways for an extension method to be applicable
620
620
621
621
// 1. The extension method is visible under a simple name, by being defined or inherited or imported in a scope enclosing the reference.
622
- val termCompleter = new Completer (Mode .Term , pos, untpdPath, matches)
623
- val extMethodsInScope = termCompleter.scopeCompletions.names.toList.flatMap:
622
+ val extMethodsInScope = scopeCompletions.names.toList.flatMap:
624
623
case (name, denots) => denots.collect:
625
624
case d : SymDenotation if d.isTerm && d.termRef.symbol.is(Extension ) => (d.termRef, name.asTermName)
626
625
0 commit comments