Skip to content

Commit

Permalink
Show documentation for value forwarders in completions
Browse files Browse the repository at this point in the history
  • Loading branch information
jkciesluk committed Dec 5, 2023
1 parent fab3f21 commit 601922a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ object CompletionItemResolver extends ItemResolver:
fullDocstring(tr.symbol, search)
case _ =>
""
else if gsym.isTerm && gsym.info.typeSymbol.is(Module) then
fullDocstring(gsym.info.typeSymbol.companion, search)
else ""
else gsymDoc
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ object CompletionValue:
s"${labelWithSuffix(printer)} -${description(printer)}"
else s"${labelWithSuffix(printer)}${description(printer)}"
else if symbol.isType then labelWithSuffix(printer)
else if symbol.isTerm && symbol.info.typeSymbol.is(Module) then
s"${label}${description(printer)}"
else s"$label: ${description(printer)}"

private def labelWithSuffix(printer: ShortenedTypePrinter)(using Context): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class CompletionDocSuite extends BaseCompletionSuite:
""".stripMargin,
"""
|> Found documentation for scala/package.Vector.
|Vector: scala.collection.immutable
|Vector scala.collection.immutable
|""".stripMargin,
includeDocs = true
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CompletionSuite extends BaseCompletionSuite:
| Lis@@
|}""".stripMargin,
"""
|List: scala.collection.immutable
|List scala.collection.immutable
|List - java.awt
|List - java.util
|List - scala.collection.immutable
Expand Down Expand Up @@ -647,7 +647,7 @@ class CompletionSuite extends BaseCompletionSuite:
|}
|""".stripMargin,
"""|None scala
|NoManifest: scala.reflect
|NoManifest scala.reflect
|""".stripMargin,
topLines = Some(2)
)
Expand All @@ -660,8 +660,8 @@ class CompletionSuite extends BaseCompletionSuite:
|}
|""".stripMargin,
"""|Some(value) scala
|Seq: scala.collection.immutable
|Set: scala.collection.immutable
|Seq scala.collection.immutable
|Set scala.collection.immutable
|""".stripMargin,
topLines = Some(3)
)
Expand Down

0 comments on commit 601922a

Please sign in to comment.