summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-05-25 15:54:50 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-05-25 15:54:50 +0800
commit8f420030bf306d78583863356b13b716d30bebda (patch)
treed60ca7a6cd0118d04ad436e27b971d33de8a34e9 /script/core
parentd7c638969636879dd465e785b6edef0007c2b435 (diff)
downloadlua-language-server-8f420030bf306d78583863356b13b716d30bebda.zip
update
Diffstat (limited to 'script/core')
-rw-r--r--script/core/infer.lua5
-rw-r--r--script/core/noder.lua15
-rw-r--r--script/core/searcher.lua4
3 files changed, 18 insertions, 6 deletions
diff --git a/script/core/infer.lua b/script/core/infer.lua
index 002a82a0..0c04e0cd 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -203,6 +203,11 @@ local function cleanInfers(infers)
infers['integer'] = nil
infers['number'] = true
end
+ -- stringlib 就是 string
+ if infers['stringlib'] then
+ infers['stringlib'] = nil
+ infers['string'] = true
+ end
-- 如果是通过 .. 来推测的,且结果里没有 number 与 integer,则推测为string
if infers[BE_CONNACT] then
infers[BE_CONNACT] = nil
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 11d20f40..9031dd07 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -155,11 +155,11 @@ local function getKey(source)
end
elseif source.type == 'doc.class'
or source.type == 'doc.type'
- or source.type == 'doc.alias'
or source.type == 'doc.param'
or source.type == 'doc.vararg'
or source.type == 'doc.field.name'
or source.type == 'doc.type.enum'
+ or source.type == 'doc.resume'
or source.type == 'doc.type.table'
or source.type == 'doc.type.array'
or source.type == 'doc.type.function' then
@@ -223,9 +223,6 @@ local function checkMode(source)
if source.type == 'doc.param' then
return 'dp:'
end
- if source.type == 'doc.alias' then
- return 'da:'
- end
if source.type == 'doc.type.function' then
return 'dfun:'
end
@@ -238,7 +235,8 @@ local function checkMode(source)
if source.type == 'doc.vararg' then
return 'dv:'
end
- if source.type == 'doc.type.enum' then
+ if source.type == 'doc.type.enum'
+ or source.type == 'doc.resume' then
return 'de:'
end
if source.type == 'generic.closure' then
@@ -436,6 +434,13 @@ function m.compileNode(noders, source)
for _, enumUnit in ipairs(source.enums) do
pushForward(noders, id, getID(enumUnit))
end
+ for _, resumeUnit in ipairs(source.resumes) do
+ pushForward(noders, id, getID(resumeUnit))
+ end
+ end
+ -- 分解 @alias
+ if source.type == 'doc.alias' then
+ pushForward(noders, getID(source.alias), getID(source.extends))
end
-- 分解 @class
if source.type == 'doc.class' then
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 254ab2ed..3f3d4036 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -72,6 +72,7 @@ function m.pushResult(status, mode, source, force)
or source.type == 'doc.alias.name'
or source.type == 'doc.field.name'
or source.type == 'doc.type.enum'
+ or source.type == 'doc.resume'
or source.type == 'doc.type.array'
or source.type == 'doc.type.table'
or source.type == 'doc.type.function' then
@@ -116,6 +117,7 @@ function m.pushResult(status, mode, source, force)
or source.type == 'doc.extends.name'
or source.type == 'doc.field.name'
or source.type == 'doc.type.enum'
+ or source.type == 'doc.resume'
or source.type == 'doc.type.array'
or source.type == 'doc.type.table'
or source.type == 'doc.type.function' then
@@ -460,7 +462,6 @@ function m.searchRefsByID(status, uri, expect, mode)
end
checkGlobal(id, node, field)
- checkClass(id, node, field)
checkMainReturn(id, node, field)
if node.call then
@@ -478,6 +479,7 @@ function m.searchRefsByID(status, uri, expect, mode)
if node then
searchNode(id, node, field)
end
+ checkClass(id, node, field)
local lastID = checkLastID(id, field)
if not lastID then
return