Skip to content

Commit

Permalink
cleanup + unignore tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek committed Feb 28, 2024
1 parent 07c9a4f commit f1835c4
Show file tree
Hide file tree
Showing 5 changed files with 250 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class CompletionProvider(
d.label
case o: TextEditMember =>
o.label.getOrElse(labelWithSig)
case _: ExtensionMethod =>
case _: WorkspaceImplicitMember =>
s"$labelWithSig (implicit)"
case o: WorkspaceMember =>
s"$ident - ${o.sym.owner.fullName}"
Expand Down Expand Up @@ -154,19 +154,19 @@ class CompletionProvider(
item.setAdditionalTextEdits(i.autoImports.asJava)
case d: DependecyMember =>
item.setTextEdit(d.edit)
case e: ExtensionMethod =>
case m: WorkspaceImplicitMember =>
val impPos = importPosition.getOrElse(AutoImportPosition(0, 0, false))
val suffix =
if (
clientSupportsSnippets && e.sym.paramss.headOption.exists(
clientSupportsSnippets && m.sym.paramss.headOption.exists(
_.nonEmpty
)
) "($0)"
else ""
val (short, edits) = ShortenedNames.synthesize(
TypeRef(
ThisType(e.sym.owner),
e.sym,
ThisType(m.sym.owner),
m.sym,
Nil
),
pos,
Expand All @@ -175,7 +175,7 @@ class CompletionProvider(
)
val edit: l.TextEdit = textEdit(
short + suffix,
e.editRange.getOrElse(editRange)
editRange
)
item.setTextEdit(edit)
item.setAdditionalTextEdits(edits.asJava)
Expand Down Expand Up @@ -422,7 +422,7 @@ class CompletionProvider(
param.info,
typeParams
) =>
visit(new ExtensionMethod(sym))
visit(new WorkspaceImplicitMember(sym))
case _ => false
}
} else false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ trait Completions { this: MetalsGlobal =>
def editRange: Option[l.Range] = None
}

class ExtensionMethod(sym: Symbol) extends WorkspaceMember(sym)
class WorkspaceImplicitMember(sym: Symbol)
extends ScopeMember(sym, sym.tpe, true, EmptyTree)

class WorkspaceInterpolationMember(
sym: Symbol,
Expand Down
Loading

0 comments on commit f1835c4

Please sign in to comment.