summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-02-09 20:16:39 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-02-09 20:16:39 +0800
commit3932717d816bfc4f98cd9640daca51fb6f2afe8c (patch)
tree934e153b2a5b1427de71e4dc87074bc6b7ae9b71 /script/core
parent2a439122a6d6d841fb99f08a1276c4400e5360fa (diff)
downloadlua-language-server-3932717d816bfc4f98cd9640daca51fb6f2afe8c.zip
cleanup
merge `doc.type.enums` and `doc.type.resumes` into `doc.type.types`
Diffstat (limited to 'script/core')
-rw-r--r--script/core/generic.lua2
-rw-r--r--script/core/hover/description.lua11
-rw-r--r--script/core/infer.lua3
-rw-r--r--script/core/noder.lua10
4 files changed, 9 insertions, 17 deletions
diff --git a/script/core/generic.lua b/script/core/generic.lua
index b383ee5d..2eb454ff 100644
--- a/script/core/generic.lua
+++ b/script/core/generic.lua
@@ -52,8 +52,6 @@ local function createValue(closure, proto, callback, road)
end
local value = instantValue(closure, proto)
value.types = types
- value.enums = proto.enums
- value.resumes = proto.resumes
noder.compileNode(noder.getNoders(proto), value)
return value
end
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index 8733fa25..43d15c39 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -160,7 +160,10 @@ local function buildEnumChunk(docType, name)
end
local types = {}
for _, tp in ipairs(docType.types) do
- types[#types+1] = tp[1]
+ if tp.type ~= 'doc.enum'
+ and tp.type ~= 'doc.resume' then
+ types[#types+1] = tp[1]
+ end
end
local lines = {}
for _, typeUnit in ipairs(docType.types) do
@@ -171,12 +174,12 @@ local function buildEnumChunk(docType, name)
end
end
end
- lines[#lines+1] = ('%s: %s'):format(name, table.concat(types))
+ lines[#lines+1] = ('%s: %s'):format(name, table.concat(types, '|'))
for _, enum in ipairs(enums) do
local enumDes = (' %s %s'):format(
(enum.default and '->')
- or (enum.additional and '+>')
- or ' |',
+ or (enum.additional and '+>')
+ or ' |',
enum[1]
)
if enum.comment then
diff --git a/script/core/infer.lua b/script/core/infer.lua
index 982b8ef3..3c62712e 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -337,9 +337,6 @@ function m.viewDocName(doc)
for _, tp in ipairs(doc.types) do
list[#list+1] = m.getDocName(tp)
end
- for _, enum in ipairs(doc.enums) do
- list[#list+1] = m.getDocName(enum)
- end
return table.concat(list, '|')
end
return m.getDocName(doc)
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 4ecfb032..0a04a744 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -174,7 +174,7 @@ local function getFieldEventName(field)
if not firstType then
return nil
end
- local firstEnum = #firstType.enums == 1 and #firstType.types == 0 and firstType.enums[1]
+ local firstEnum = firstType.types[1]
if not firstEnum then
return nil
end
@@ -182,7 +182,7 @@ local function getFieldEventName(field)
if not secondType then
return nil
end
- local secondTypeUnit = #secondType.enums == 0 and #secondType.types == 1 and secondType.types[1]
+ local secondTypeUnit = secondType.types[1]
if not secondTypeUnit or secondTypeUnit.type ~= 'doc.type.function' then
return nil
end
@@ -1026,12 +1026,6 @@ compileNodeMap = util.switch()
end
end
end
- 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
for _, typeUnit in ipairs(source.types) do
local unitID = getID(typeUnit)
pushForward(noders, id, unitID)