Skip to content

Commit

Permalink
show only syms from defs
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek committed Apr 30, 2024
1 parent b53fa91 commit 0656479
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class AutoImportsProvider(
val isSeen = mutable.Set.empty[String]
val symbols = List.newBuilder[Symbol]

def visit(fromWorkspace: Boolean)(sym: Symbol): Boolean = {
def visit(sym: Symbol): Boolean = {
val id = sym.fullName
if (!isSeen(id)) {
isSeen += id
Expand All @@ -40,10 +40,10 @@ final class AutoImportsProvider(
false
}

compiler.searchOutline(visit(fromWorkspace = false), name)
compiler.searchOutline(visit, name)

val visitor =
new CompilerSearchVisitor(context, visit(fromWorkspace = true))
new CompilerSearchVisitor(context, visit)
search.search(name, buildTargetIdentifier, visitor)

def isInImportTree: Boolean = lastVisitedParentTrees match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait WorkspaceSymbolSearch { compiler: MetalsGlobal =>
def loop(trees: List[Tree]): Unit = {
trees match {
case Nil =>
case tree :: tail =>
case (tree: MemberDef) :: tail =>
val sym = tree.symbol
def matches = if (sym.isType)
CompletionFuzzy.matchesSubCharacters(query, sym.name.toString())
Expand All @@ -37,6 +37,8 @@ trait WorkspaceSymbolSearch { compiler: MetalsGlobal =>
}
}
loop(tree.children ++ tail)
case tree :: tail =>
loop(tree.children ++ tail)
}
}
loop(List(unit.body))
Expand Down

0 comments on commit 0656479

Please sign in to comment.