summaryrefslogtreecommitdiff
path: root/script-beta/parser/guide.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-26 10:22:17 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-26 10:22:17 +0800
commit67f0fb20a3acb616cd700a2cd77afd616a68868d (patch)
tree5a5d8fa22c0d70fc47ea87ee595c89d523a6104f /script-beta/parser/guide.lua
parent025fb18d576f2edb0863ab2d69f4f30db3fab835 (diff)
downloadlua-language-server-67f0fb20a3acb616cd700a2cd77afd616a68868d.zip
doc.param
Diffstat (limited to 'script-beta/parser/guide.lua')
-rw-r--r--script-beta/parser/guide.lua16
1 files changed, 13 insertions, 3 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index 0e79fb08..694d37d0 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -2513,7 +2513,7 @@ function m.getDocTypeNames(doc)
return results
end
-function m.inferByDoc(status, source)
+function m.inferCheckDoc(status, source)
while source.type == 'select' or source.type == 'call' do
local parent = source.parent
if parent.type == 'local'
@@ -2545,8 +2545,18 @@ function m.inferByDoc(status, source)
for _, res in ipairs(results) do
status.results[#status.results+1] = res
end
+ elseif doc.type == 'doc.param' then
+ if source.type == 'local'
+ and m.getName(source) == doc.param[1]
+ and source.parent.type == 'funcargs' then
+ status.results[#status.results+1] = {
+ type = m.viewInferType(m.getDocTypeNames(doc.extends)),
+ source = doc,
+ }
+ end
end
end
+ return true
end
function m.inferCheckUnary(status, source)
@@ -3237,7 +3247,8 @@ function m.searchInfer(status, obj)
status.cache.clock = status.cache.clock or osClock()
end
- local checked = m.inferCheckLibrary(status, obj)
+ local checked = m.inferCheckDoc(status, obj)
+ or m.inferCheckLibrary(status, obj)
or m.inferCheckLiteral(status, obj)
or m.inferCheckUnary(status, obj)
or m.inferCheckBinary(status, obj)
@@ -3249,7 +3260,6 @@ function m.searchInfer(status, obj)
return
end
- m.inferByDoc(status, obj)
if not status.simple then
m.inferByDef(status, obj)
end