summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-05-27 15:40:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-05-27 15:40:43 +0800
commit507bb6852f6ae523dca4370c38cac8581329a2c3 (patch)
tree6b62242a7a6d83ce36894c9333bc19868ad93cf6 /script
parentc5bd11601ba7eac883d4c7e7b4adc35e3b3a4f1e (diff)
downloadlua-language-server-507bb6852f6ae523dca4370c38cac8581329a2c3.zip
generic param
Diffstat (limited to 'script')
-rw-r--r--script/core/infer.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/script/core/infer.lua b/script/core/infer.lua
index 2578aac4..ce89a6c9 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -327,7 +327,11 @@ local function getDocName(doc)
if doc.type == 'doc.class.name'
or doc.type == 'doc.type.name' then
local name = doc[1] or '?'
- return name
+ if doc.typeGeneric then
+ return '<' .. name .. '>'
+ else
+ return name
+ end
end
if doc.type == 'doc.type.array' then
local nodeName = getDocName(doc.node) or '?'
@@ -478,6 +482,17 @@ function m.searchInfers(source, field)
searchInfer(def, infers)
end
end
+ if source.docParam then
+ local docType = source.docParam.extends
+ if docType.type == 'doc.type' then
+ for _, def in ipairs(docType.types) do
+ if def.typeGeneric and not mark[def] then
+ mark[def] = true
+ searchInfer(def, infers)
+ end
+ end
+ end
+ end
cleanInfers(infers)
return infers
end