summaryrefslogtreecommitdiff
path: root/server/src/matcher
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-21 18:27:37 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-21 18:27:37 +0800
commit8f5725af96853b31afe6473b741e0b918b4a0210 (patch)
treed66bdf05dc8897666c5a8b2004ca66544a82cb70 /server/src/matcher
parent0d56d8653a28f12601deba8b1a137557cf42f6cd (diff)
downloadlua-language-server-8f5725af96853b31afe6473b741e0b918b4a0210.zip
修正用常量做对象时无法找到可用函数的bug
Diffstat (limited to 'server/src/matcher')
-rw-r--r--server/src/matcher/completion.lua3
-rw-r--r--server/src/matcher/vm.lua10
2 files changed, 11 insertions, 2 deletions
diff --git a/server/src/matcher/completion.lua b/server/src/matcher/completion.lua
index ce6fd277..5d651034 100644
--- a/server/src/matcher/completion.lua
+++ b/server/src/matcher/completion.lua
@@ -307,5 +307,8 @@ return function (vm, pos)
searchAsSuffix(result, callback)
end
end
+ if #list == 0 then
+ return nil
+ end
return list
end
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua
index 6248e550..e7863e47 100644
--- a/server/src/matcher/vm.lua
+++ b/server/src/matcher/vm.lua
@@ -778,11 +778,17 @@ function mt:getSimple(simple, mode)
local value = self:getExp(simple[1])
local field
local parentName
- if simple[1].type == 'name' then
+ local tp = simple[1].type
+ if tp == 'name' then
field = self:getName(simple[1][1])
parentName = field.key
+ elseif tp == 'string' or tp == 'number' or tp == 'nil' or tp == 'boolean' then
+ local v = self:createValue(tp, simple[1], simple[1][1])
+ field = self:createLocal('', simple[1], v)
+ parentName = '*' .. tp
else
- field = self:createValue('any', simple[1])
+ local v = self:createValue('any', simple[1])
+ field = self:createLocal('', simple[1], v)
parentName = '?'
end
local object