Skip to content

Commit 8dc5f8f

Browse files
committed
Show documentation for all imported symbols
When doing hover on an imported node, the window now shows the documentation for all the imported symbols.
1 parent ec6882c commit 8dc5f8f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@ class DottyLanguageServer extends LanguageServer
442442
Interactive.enclosingSourceSymbols(path, pos) match {
443443
case Nil =>
444444
null
445-
case symbol :: _ =>
446-
val docComment = ParsedComment.docOf(symbol)
447-
val content = hoverContent(Some(tpw.show), docComment)
445+
case symbols =>
446+
val docComments = symbols.flatMap(ParsedComment.docOf)
447+
val content = hoverContent(Some(tpw.show), docComments)
448448
new Hover(content, null)
449449
}
450450
}
@@ -810,7 +810,7 @@ object DottyLanguageServer {
810810
}
811811

812812
private def hoverContent(typeInfo: Option[String],
813-
comment: Option[ParsedComment]
813+
comments: List[ParsedComment]
814814
)(implicit ctx: Context): lsp4j.MarkupContent = {
815815
val buf = new StringBuilder
816816
typeInfo.foreach { info =>
@@ -819,8 +819,7 @@ object DottyLanguageServer {
819819
|```
820820
|""".stripMargin)
821821
}
822-
823-
comment.foreach { comment =>
822+
comments.foreach { comment =>
824823
buf.append(comment.renderAsMarkdown)
825824
}
826825

0 commit comments

Comments
 (0)