Skip to content

Commit 71885b1

Browse files
committed
export name and comment in returns
1 parent 1c2ea34 commit 71885b1

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

script/cli/doc.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ local function packObject(source, mark)
5959
end
6060
new['view'] = getLabel(source, source.parent.type == 'setmethod')
6161
end
62+
if source.type == 'local'
63+
or source.type == 'self' then
64+
new['name'] = source[1]
65+
end
66+
if source.type == 'function.return' then
67+
new['desc'] = source.comment and getDesc(source.comment)
68+
end
6269
if source.type == 'doc.type.table' then
6370
new['fields'] = packObject(source.fields, mark)
6471
end

script/core/hover/description.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,9 @@ return function (source)
512512
if source.type == 'string' then
513513
return asString(source)
514514
end
515+
if source.type == 'doc.tailcomment' then
516+
return source.text
517+
end
515518
if source.type == 'field' then
516519
source = source.parent
517520
end

script/vm/compiler.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ function vm.getReturnOfFunction(func, index)
478478
parent = func,
479479
returnIndex = index,
480480
}
481+
vm.compileNode(func._returns[index])
481482
end
482483
return func._returns[index]
483484
end
@@ -1382,6 +1383,10 @@ local compilerSwitch = util.switch()
13821383
lastReturn = rtn
13831384
if rtn.returnIndex == index then
13841385
hasMarkDoc = true
1386+
source.comment = doc.comment
1387+
if rtn.name then
1388+
source.name = rtn.name[1]
1389+
end
13851390
local hasGeneric
13861391
if sign then
13871392
guide.eachSourceType(rtn, 'doc.generic.name', function (src)

0 commit comments

Comments
 (0)