Skip to content

Commit

Permalink
Weekly backport from metals (#19787)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek authored Feb 28, 2024
1 parent e994cf0 commit 4742d7d
Show file tree
Hide file tree
Showing 6 changed files with 368 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,18 @@ class Completions(
val query = completionPos.query
if completionMode.is(Mode.Scope) && query.nonEmpty then
val visitor = new CompilerSearchVisitor(sym =>
indexedContext.lookupSym(sym) match
case IndexedContext.Result.InScope => false
case _ =>
completionsWithSuffix(
sym,
sym.decodedName,
CompletionValue.Workspace(_, _, _, sym)
).map(visit).forall(_ == true),
if !(sym.is(Flags.ExtensionMethod) ||
(sym.maybeOwner.is(Flags.Implicit) && sym.maybeOwner.isClass))
then
indexedContext.lookupSym(sym) match
case IndexedContext.Result.InScope => false
case _ =>
completionsWithSuffix(
sym,
sym.decodedName,
CompletionValue.Workspace(_, _, _, sym)
).map(visit).forall(_ == true)
else false,
)
Some(search.search(query, buildTargetIdentifier, visitor).nn)
else if completionMode.is(Mode.Member) then
Expand All @@ -526,16 +530,18 @@ class Completions(
)
end isImplicitClass

def isImplicitClassMethod = sym.is(Flags.Method) && !sym.isConstructor &&
isImplicitClass(sym.maybeOwner)
def isDefaultVariableSetter = sym.is(Flags.Accessor) && sym.is(Flags.Method)
def isImplicitClassMember =
isImplicitClass(sym.maybeOwner) && !sym.is(Flags.Synthetic) && sym.isPublic
&& !sym.isConstructor && !isDefaultVariableSetter

if isExtensionMethod then
completionsWithSuffix(
sym,
sym.decodedName,
CompletionValue.Extension(_, _, _)
).map(visit).forall(_ == true)
else if isImplicitClassMethod then
else if isImplicitClassMember then
completionsWithSuffix(
sym,
sym.decodedName,
Expand Down
Loading

0 comments on commit 4742d7d

Please sign in to comment.