summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-05 03:54:59 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-05 03:54:59 +0800
commit9310038417408a5c2f6c148447d951f248fce2fe (patch)
tree2b7a6e3c199608627e12144e5c48f6206facfed2 /script
parent6eba8cd590beb5ea52d880bdfe01b79e7828e5b4 (diff)
downloadlua-language-server-9310038417408a5c2f6c148447d951f248fce2fe.zip
update
Diffstat (limited to 'script')
-rw-r--r--script/core/hover/table.lua6
-rw-r--r--script/vm/compiler.lua8
2 files changed, 9 insertions, 5 deletions
diff --git a/script/core/hover/table.lua b/script/core/hover/table.lua
index a21910e3..88808daa 100644
--- a/script/core/hover/table.lua
+++ b/script/core/hover/table.lua
@@ -113,8 +113,8 @@ end
local function getOptMap(fields, keyMap)
local optMap = {}
for _, field in ipairs(fields) do
- if field.type == 'doc.field.name' then
- if field.parent.optional then
+ if field.type == 'doc.field' then
+ if field.optional then
local key = vm.getKeyName(field)
if keyMap[key] then
optMap[key] = true
@@ -145,7 +145,7 @@ local function getInferMap(fields, keyMap)
await.delay()
local ifr = infer.getInfer(field)
if inferMap[key] then
- inferMap[key]:merge(ifr)
+ inferMap[key] = inferMap[key]:merge(ifr)
else
inferMap[key] = ifr
end
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 4dc3edef..fd1d1d5d 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -111,14 +111,14 @@ local searchFieldSwitch = util.switch()
or (fn.name == 'number' and type(key) == 'number')
or (fn.name == 'integer' and math.tointeger(key))
or (fn.name == 'string' and type(key) == 'string') then
- pushResult(field.extends)
+ pushResult(field)
end
end
end
end
if fieldKey.type == 'doc.field.name' then
if key == nil or fieldKey[1] == key then
- pushResult(field.extends)
+ pushResult(field)
end
end
end
@@ -852,6 +852,10 @@ local compilerSwitch = util.switch()
: call(function (source)
nodeMgr.setNode(source, m.compileNode(source.extends))
end)
+ : case 'doc.type.field'
+ : call(function (source)
+ nodeMgr.setNode(source, m.compileNode(source.extends))
+ end)
: case 'doc.param'
: call(function (source)
nodeMgr.setNode(source, m.compileNode(source.extends))