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)
349
349
end
350
350
351
351
local function tryDocComment (source )
352
+ local md = markdown ()
352
353
if source .type == ' function' then
353
354
local comment = getFunctionComment (source )
354
- if comment then
355
- return comment
356
- end
355
+ md :add (' md' , comment )
357
356
source = source .parent
358
357
end
359
358
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
361
369
end
362
370
363
371
local function tryDocOverloadToComment (source )
Original file line number Diff line number Diff line change @@ -1471,3 +1471,29 @@ function A()
1471
1471
1472
1472
comments]]
1473
1473
}
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