@@ -22,6 +22,7 @@ import core._, core.Decorators.{sourcePos => _, _}
22
22
import Comments ._ , Contexts ._ , Flags ._ , Names ._ , NameOps ._ , Symbols ._ , SymDenotations ._ , Trees ._ , Types ._
23
23
import classpath .ClassPathEntries
24
24
import reporting ._ , reporting .diagnostic .MessageContainer
25
+ import typer .Typer
25
26
import util ._
26
27
import interactive ._ , interactive .InteractiveDriver ._
27
28
import Interactive .Include
@@ -367,7 +368,16 @@ class DottyLanguageServer extends LanguageServer
367
368
if (tpw == NoType ) null // null here indicates that no response should be sent
368
369
else {
369
370
val symbol = Interactive .enclosingSourceSymbol(trees, pos)
370
- val docComment = ctx.docCtx.flatMap(_.docstring(symbol))
371
+ val docComment = ctx.docCtx.flatMap(_.docstring(symbol)).map {
372
+ case comment if ! comment.isExpanded =>
373
+ val typer = new Typer ()
374
+ val owner = symbol.owner
375
+ val cookingCtx = ctx.withOwner(owner)
376
+ typer.cookComment(symbol, owner)(cookingCtx)
377
+ ctx.docCtx.get.docstring(symbol).get
378
+ case comment =>
379
+ comment
380
+ }
371
381
val content = hoverContent(tpw.show, docComment)
372
382
new Hover (content, null )
373
383
}
@@ -490,7 +500,7 @@ object DottyLanguageServer {
490
500
val markup = new lsp4j.MarkupContent
491
501
markup.setKind(" markdown" )
492
502
markup.setValue((
493
- comment.map (_.raw ) match {
503
+ comment.flatMap (_.expandedBody ) match {
494
504
case Some (comment) =>
495
505
s """ ```scala
496
506
| $typeInfo
0 commit comments