File tree Expand file tree Collapse file tree 2 files changed +38
-4
lines changed
Expand file tree Collapse file tree 2 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -349,15 +349,23 @@ local function getFunctionComment(source)
349349end
350350
351351local function tryDocComment (source )
352+ local md = markdown ()
352353 if source .type == ' function' then
353354 local comment = getFunctionComment (source )
354- if comment then
355- return comment
356- end
355+ md :add (' md' , comment )
357356 source = source .parent
358357 end
359358 local comment = lookUpDocComments (source )
360- return comment
359+ md :add (' md' , comment )
360+ if source .type == ' doc.alias' then
361+ local enums = buildEnumChunk (source , source .alias [1 ], guide .getUri (source ))
362+ md :add (' lua' , enums )
363+ end
364+ local result = md :string ()
365+ if result == ' ' then
366+ return nil
367+ end
368+ return result
361369end
362370
363371local function tryDocOverloadToComment (source )
Original file line number Diff line number Diff line change @@ -1471,3 +1471,29 @@ function A()
14711471
14721472 comments]]
14731473}
1474+
1475+ TEST {
1476+ {
1477+ path = ' a.lua' ,
1478+ content = [[
1479+ ---@alias A
1480+ ---| 1 # comment1
1481+ ---| 2 # comment2
1482+
1483+ ---@type A
1484+ local <?x?>
1485+ ]]
1486+ },
1487+ hover = [[
1488+ ```lua
1489+ local x: 1|2
1490+ ```
1491+
1492+ ---
1493+
1494+ ```lua
1495+ A:
1496+ | 1 -- comment1
1497+ | 2 -- comment2
1498+ ```]]
1499+ }
You can’t perform that action at this time.
0 commit comments