summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-03-04 18:04:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-03-04 18:04:45 +0800
commit513023b9ee1d4af55e43d530fe5ed1092beb79ce (patch)
tree220ec707146154bf752d862e446531a64e402ce7 /script
parent80aea7f979bbbacad94d10a88514c7bddf6d11cf (diff)
downloadlua-language-server-513023b9ee1d4af55e43d530fe5ed1092beb79ce.zip
update
Diffstat (limited to 'script')
-rw-r--r--script/vm/compiler.lua15
-rw-r--r--script/vm/getDef.lua4
2 files changed, 16 insertions, 3 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 1f93f130..b814cdbc 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -365,7 +365,20 @@ local compilerMap = util.switch()
: call(function (source)
local func = source.parent
local index = source.index
- if func.returns then
+ local hasMarkDoc
+ if func.bindDocs then
+ for _, doc in ipairs(func.bindDocs) do
+ if doc.type == 'doc.return' then
+ for _, rtn in ipairs(doc.returns) do
+ if rtn.returnIndex == index then
+ hasMarkDoc = true
+ m.setNode(source, m.compileNode(rtn))
+ end
+ end
+ end
+ end
+ end
+ if func.returns and not hasMarkDoc then
for _, rtn in ipairs(func.returns) do
m.setNode(source, selectNode(source, rtn, index))
end
diff --git a/script/vm/getDef.lua b/script/vm/getDef.lua
index e9bd3748..0302f9d3 100644
--- a/script/vm/getDef.lua
+++ b/script/vm/getDef.lua
@@ -163,7 +163,7 @@ end
---@param source parser.object
---@param pushResult fun(src: parser.object)
-local function searchByID(source, pushResult)
+local function searchByLocalID(source, pushResult)
local idSources = localID.getSources(source)
if not idSources then
return
@@ -230,7 +230,7 @@ function vm.getDefs(source)
end
searchBySimple(source, pushResult)
- searchByID(source, pushResult)
+ searchByLocalID(source, pushResult)
searchByParentNode(source, pushResult)
searchByNode(source, pushResult)