@@ -22,6 +22,7 @@ import core._, core.Decorators.{sourcePos => _, _}
2222import Comments ._ , Contexts ._ , Flags ._ , Names ._ , NameOps ._ , Symbols ._ , SymDenotations ._ , Trees ._ , Types ._
2323import classpath .ClassPathEntries
2424import reporting ._ , reporting .diagnostic .MessageContainer
25+ import typer .Typer
2526import util ._
2627import interactive ._ , interactive .InteractiveDriver ._
2728import Interactive .Include
@@ -347,7 +348,16 @@ class DottyLanguageServer extends LanguageServer
347348 if (tpw == NoType ) null // null here indicates that no response should be sent
348349 else {
349350 val symbol = Interactive .enclosingSourceSymbol(trees, pos)
350- val docComment = ctx.docCtx.flatMap(_.docstring(symbol))
351+ val docComment = ctx.docCtx.flatMap(_.docstring(symbol)).map {
352+ case comment if ! comment.isExpanded =>
353+ val typer = new Typer ()
354+ val owner = symbol.owner
355+ val cookingCtx = ctx.withOwner(owner)
356+ typer.cookComment(symbol, owner)(cookingCtx)
357+ ctx.docCtx.get.docstring(symbol).get
358+ case comment =>
359+ comment
360+ }
351361 val content = hoverContent(tpw.show, docComment)
352362 new Hover (content, null )
353363 }
@@ -470,7 +480,7 @@ object DottyLanguageServer {
470480 val markup = new lsp4j.MarkupContent
471481 markup.setKind(" markdown" )
472482 markup.setValue((
473- comment.map (_.raw ) match {
483+ comment.flatMap (_.expandedBody ) match {
474484 case Some (comment) =>
475485 s """ ```scala
476486 | $typeInfo
0 commit comments