Skip to content

Commit 4742d7d

Browse files
authored
1 parent e994cf0 commit 4742d7d

File tree

6 files changed

+368
-203
lines changed

6 files changed

+368
-203
lines changed

presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala

+17-11
Original file line numberDiff line numberDiff line change
@@ -497,14 +497,18 @@ class Completions(
497497
val query = completionPos.query
498498
if completionMode.is(Mode.Scope) && query.nonEmpty then
499499
val visitor = new CompilerSearchVisitor(sym =>
500-
indexedContext.lookupSym(sym) match
501-
case IndexedContext.Result.InScope => false
502-
case _ =>
503-
completionsWithSuffix(
504-
sym,
505-
sym.decodedName,
506-
CompletionValue.Workspace(_, _, _, sym)
507-
).map(visit).forall(_ == true),
500+
if !(sym.is(Flags.ExtensionMethod) ||
501+
(sym.maybeOwner.is(Flags.Implicit) && sym.maybeOwner.isClass))
502+
then
503+
indexedContext.lookupSym(sym) match
504+
case IndexedContext.Result.InScope => false
505+
case _ =>
506+
completionsWithSuffix(
507+
sym,
508+
sym.decodedName,
509+
CompletionValue.Workspace(_, _, _, sym)
510+
).map(visit).forall(_ == true)
511+
else false,
508512
)
509513
Some(search.search(query, buildTargetIdentifier, visitor).nn)
510514
else if completionMode.is(Mode.Member) then
@@ -526,16 +530,18 @@ class Completions(
526530
)
527531
end isImplicitClass
528532

529-
def isImplicitClassMethod = sym.is(Flags.Method) && !sym.isConstructor &&
530-
isImplicitClass(sym.maybeOwner)
533+
def isDefaultVariableSetter = sym.is(Flags.Accessor) && sym.is(Flags.Method)
534+
def isImplicitClassMember =
535+
isImplicitClass(sym.maybeOwner) && !sym.is(Flags.Synthetic) && sym.isPublic
536+
&& !sym.isConstructor && !isDefaultVariableSetter
531537

532538
if isExtensionMethod then
533539
completionsWithSuffix(
534540
sym,
535541
sym.decodedName,
536542
CompletionValue.Extension(_, _, _)
537543
).map(visit).forall(_ == true)
538-
else if isImplicitClassMethod then
544+
else if isImplicitClassMember then
539545
completionsWithSuffix(
540546
sym,
541547
sym.decodedName,

0 commit comments

Comments
 (0)