diff options
-rw-r--r-- | server/src/matcher/definition.lua | 34 | ||||
-rw-r--r-- | server/src/matcher/vm.lua | 1 |
2 files changed, 24 insertions, 11 deletions
diff --git a/server/src/matcher/definition.lua b/server/src/matcher/definition.lua index 57c4be5d..2f52c9b8 100644 --- a/server/src/matcher/definition.lua +++ b/server/src/matcher/definition.lua @@ -5,8 +5,9 @@ local function parseResult(vm, result) local tp = result.type if tp == 'local' then if result.value.uri ~= vm.uri then - for _, info in ipairs(result) do - if info.type == 'set' then + -- 跨越文件时,遍历的是值的绑定信息 + for _, info in ipairs(result.value) do + if info.type == 'set'then positions[#positions+1] = { info.source.start, info.source.finish, @@ -14,16 +15,27 @@ local function parseResult(vm, result) } end end + if #positions == 0 then + for _, info in ipairs(result.value) do + if info.type == 'return'then + positions[#positions+1] = { + info.source.start, + info.source.finish, + info.source.uri, + } + end + 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 + 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 for _, info in ipairs(result) do diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index 00b21ffc..ecb07bd5 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -269,6 +269,7 @@ function mt:setValue(var, value, source) end if source and source.start then self:addInfo(var, 'set', source) + self:addInfo(value, 'set', source) if not value.declarat then value.declarat = source end |