diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-20 19:34:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-20 19:34:05 +0800 |
commit | 4120a40427f4d859044a626cac2e78ea5671e6e2 (patch) | |
tree | f248c7f9d7743056f6d12f705ac61d38ec84b155 /server/src/matcher | |
parent | 55f584fd59b485cba0742218f57b134b93ff20e2 (diff) | |
download | lua-language-server-4120a40427f4d859044a626cac2e78ea5671e6e2.zip |
uri绑在source上
Diffstat (limited to 'server/src/matcher')
-rw-r--r-- | server/src/matcher/definition.lua | 48 | ||||
-rw-r--r-- | server/src/matcher/vm.lua | 2 |
2 files changed, 29 insertions, 21 deletions
diff --git a/server/src/matcher/definition.lua b/server/src/matcher/definition.lua index b325f46c..57c4be5d 100644 --- a/server/src/matcher/definition.lua +++ b/server/src/matcher/definition.lua @@ -5,36 +5,43 @@ local function parseResult(vm, result) local tp = result.type if tp == 'local' then if result.value.uri ~= vm.uri then - positions[#positions+1] = { - result.value.source.start, - result.value.source.finish, - result.value.uri, - } - else for _, info in ipairs(result) do - if info.type == 'local' then - positions[#positions+1] = {info.source.start, info.source.finish} + if info.type == 'set' then + positions[#positions+1] = { + info.source.start, + info.source.finish, + info.source.uri, + } end end + else + for _, info in ipairs(result) do + if info.type == 'local' then + positions[#positions+1] = { + info.source.start, + info.source.finish, + info.source.uri, + } + end + end end elseif tp == 'field' then - if result.value.uri ~= vm.uri then - positions[#positions+1] = { - result.value.source.start, - result.value.source.finish, - result.value.uri, - } - else - for _, info in ipairs(result) do - if info.type == 'set' then - positions[#positions+1] = {info.source.start, info.source.finish} - end + for _, info in ipairs(result) do + if info.type == 'set' then + positions[#positions+1] = { + info.source.start, + info.source.finish, + info.source.uri, + } end end elseif tp == 'label' then for _, info in ipairs(result) do if info.type == 'set' then - positions[#positions+1] = {info.source.start, info.source.finish} + positions[#positions+1] = { + info.source.start, + info.source.finish, + } end end end @@ -46,6 +53,7 @@ return function (vm, pos) if not result then return nil end + local positions = parseResult(vm, result) return positions end diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index b7941b2c..b8b3a18b 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -107,6 +107,7 @@ function mt:addInfo(obj, type, source) source = source or DefaultSource, } if source then + source.uri = self.uri local other = self.results.sources[source] if other then if other.type == 'multi-source' then @@ -578,7 +579,6 @@ function mt:createValue(tp, source, v) type = tp, source = source or DefaultSource, value = v, - uri = self.uri, } local lib = library.object[tp] if lib then |