diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-30 14:23:06 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-30 14:23:06 +0800 |
commit | 024f7be5227c9e010f0dacad55d7e923065d6eff (patch) | |
tree | e586238146e939a94243ed5e28c96701df037a44 | |
parent | b14edd27b790ea984276f40202e5ba4acba652ba (diff) | |
download | lua-language-server-024f7be5227c9e010f0dacad55d7e923065d6eff.zip |
值的获取信息
-rw-r--r-- | server/src/core/references.lua | 4 | ||||
-rw-r--r-- | server/src/core/vm.lua | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/server/src/core/references.lua b/server/src/core/references.lua index 7262ca91..9486dafe 100644 --- a/server/src/core/references.lua +++ b/server/src/core/references.lua @@ -4,7 +4,7 @@ local function parseResult(vm, result, declarat) local positions = {} local tp = result.type if tp == 'local' then - vm:eachInfo(result, function (info) + result.value:eachInfo(function (info) if info.source.uri == '' or not info.source.uri then return end @@ -13,7 +13,7 @@ local function parseResult(vm, result, declarat) end end) elseif tp == 'field' then - vm:eachInfo(result, function (info) + result.value:eachInfo(function (info) if info.source.uri == '' or not info.source.uri then return end diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua index 7ae4e4e1..0ad858e2 100644 --- a/server/src/core/vm.lua +++ b/server/src/core/vm.lua @@ -48,6 +48,7 @@ function mt:createLocal(key, source, value) source.bind = loc self.results.sources[#self.results.sources+1] = source source.isLocal = true + source.uri = self.uri end local shadow = self.scope.locals[key] @@ -756,6 +757,7 @@ function mt:getIndex(obj) local var = self:getName(obj[1], obj) local value = self:getValue(var) self:addInfo(var, 'get', obj) + value:addInfo('get', obj) return value elseif (tp == 'string' or tp == 'number' or tp == 'boolean') then return obj[1] @@ -887,6 +889,7 @@ function mt:getSimple(simple, mode) field.parentValue = value value = self:getValue(field) self:addInfo(field, 'get', obj) + value:addInfo('get', obj) else field = self:createField(value, index, obj) field.parentValue = value @@ -908,6 +911,7 @@ function mt:getSimple(simple, mode) field.parentValue = value value = self:getValue(field) self:addInfo(field, 'get', obj) + value:addInfo('get', obj) else field = self:createField(value, obj[1], obj) field.parentValue = value @@ -1114,6 +1118,7 @@ function mt:getExp(exp) local var = self:getName(exp[1], exp) local value = self:getValue(var) self:addInfo(var, 'get', exp) + value:addInfo('get', exp) return value elseif tp == 'simple' then return self:getSimple(exp, 'value') |