diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-19 15:51:51 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-19 15:51:51 +0800 |
commit | 55b9f79c900990756b2948efabb85d1651ff61ec (patch) | |
tree | d4da8ef59e043109dac3f50a55c95011ebce3e16 /server | |
parent | e591cd30fc0a7ab992ca25a909f562d75df06c70 (diff) | |
download | lua-language-server-55b9f79c900990756b2948efabb85d1651ff61ec.zip |
修正一些bug
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/definition.lua | 5 | ||||
-rw-r--r-- | server/src/vm/value.lua | 30 |
2 files changed, 11 insertions, 24 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua index 27c6f8eb..abf0b3f6 100644 --- a/server/src/core/definition.lua +++ b/server/src/core/definition.lua @@ -95,13 +95,14 @@ end local function parseLocal(vm, source, lsp) local loc = source:bindLocal() local value = source:bindValue() - if value.uri ~= vm.uri then + if value.uri ~= '' and value.uri ~= vm.uri then return parseValueCrossFile(vm, source, lsp) end local positions = {} positions[#positions+1] = { loc:getSource().start, loc:getSource().finish, + loc:getSource():getUri(), } if #positions == 0 then return nil @@ -111,7 +112,7 @@ end local function parseValue(vm, source, lsp) local value = source:bindValue() - if value.uri ~= vm.uri then + if value.uri ~= '' and value.uri ~= vm.uri then return parseValueCrossFile(vm, source, lsp) end local positions = {} diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua index 06a7ba30..c4336ad4 100644 --- a/server/src/vm/value.lua +++ b/server/src/vm/value.lua @@ -97,13 +97,13 @@ function mt:rawSet(index, value, source) end if self._child[index] then self._child[index]:mergeValue(value) - self._child[index] = value + --self._child[index] = value else self._child[index] = value end - self:addInfo('set child', source, index, value) + self:addInfo('set child', source, index, self._child[index]) if self._global then - value:markGlobal() + self._child[index]:markGlobal() end end @@ -266,26 +266,12 @@ function mt:mergeValue(value) --end --value._child = self._child - if self._infoCount > value._infoCount then - for srcId, info in pairs(value._info) do - local src = sourceMgr.list[srcId] - if src and not self._info[srcId] then - self._infoCount = self._infoCount + 1 - self._info[srcId] = info - end - end - value._info = self._info - value._infoCount = self._infoCount - else - for srcId, info in pairs(self._info) do - local src = sourceMgr.list[srcId] - if src and not value._info[srcId] then - value._infoCount = value._infoCount + 1 - value._info[srcId] = info - end + for srcId, info in pairs(value._info) do + local src = sourceMgr.list[srcId] + if src and not self._info[srcId] then + self._infoCount = self._infoCount + 1 + self._info[srcId] = info end - self._info = value._info - self._infoCount = value._infoCount end if value._meta then |