diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-12 17:24:19 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-12 17:24:19 +0800 |
commit | 8d112ba2f517e9ca6cf4146c16d713f8d7eabd03 (patch) | |
tree | 0223cc006bb1debb51ba9a6714863f084a1e1639 /server/src/matcher/definition.lua | |
parent | 3b48f52ca21700f928e3e463736e280f46b2a2c7 (diff) | |
download | lua-language-server-8d112ba2f517e9ca6cf4146c16d713f8d7eabd03.zip |
优化性能
Diffstat (limited to 'server/src/matcher/definition.lua')
-rw-r--r-- | server/src/matcher/definition.lua | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/server/src/matcher/definition.lua b/server/src/matcher/definition.lua index 57e4b237..13015cac 100644 --- a/server/src/matcher/definition.lua +++ b/server/src/matcher/definition.lua @@ -4,31 +4,29 @@ local function parseResult(result) local positions = {} local tp = result.type if tp == 'local' then - for _, info in ipairs(result.object) do + for _, info in ipairs(result) do if info.type == 'local' then positions[#positions+1] = {info.source.start, info.source.finish} end end elseif tp == 'field' then - for _, info in ipairs(result.object) do + for _, info in ipairs(result) do if info.type == 'set' then positions[#positions+1] = {info.source.start, info.source.finish} end end elseif tp == 'label' then - for _, info in ipairs(result.object) do + for _, info in ipairs(result) do if info.type == 'set' then positions[#positions+1] = {info.source.start, info.source.finish} end end - else - error('Unknow result type:' .. result.type) end return positions end return function (vm, pos) - local result = findResult(vm.results, pos) + local result = findResult(vm, pos) if not result then return nil end |