summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-01-13 18:18:09 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-01-13 18:18:09 +0800
commit7a8ffbba2af9e16225f757c7915c268125acd1e2 (patch)
treeac11f26518c4098ae3fe031d963feef44d5c9f6d /script/core
parent4be30dd4b57ac431d363dc524f375c2ccb514129 (diff)
downloadlua-language-server-7a8ffbba2af9e16225f757c7915c268125acd1e2.zip
fix #876
Diffstat (limited to 'script/core')
-rw-r--r--script/core/hover/table.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/script/core/hover/table.lua b/script/core/hover/table.lua
index bd2f81ad..1310005f 100644
--- a/script/core/hover/table.lua
+++ b/script/core/hover/table.lua
@@ -122,12 +122,24 @@ local function getOptionalMap(fields)
if field.type == 'doc.field.name' then
if field.parent.optional then
local key = vm.getKeyName(field)
+ local tp = vm.getKeyType(field)
+ if tp == 'number' or tp == 'integer' then
+ key = tonumber(key)
+ elseif tp == 'boolean' then
+ key = key == 'true'
+ end
optionals[key] = true
end
end
if field.type == 'doc.type.field' then
if field.optional then
local key = vm.getKeyName(field)
+ local tp = vm.getKeyType(field)
+ if tp == 'number' or tp == 'integer' then
+ key = tonumber(key)
+ elseif tp == 'boolean' then
+ key = key == 'true'
+ end
optionals[key] = true
end
end