diff options
-rw-r--r-- | server/src/matcher/definition.lua | 6 | ||||
-rw-r--r-- | server/src/matcher/implementation.lua | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/server/src/matcher/definition.lua b/server/src/matcher/definition.lua index 5b79aedd..3ca27b89 100644 --- a/server/src/matcher/definition.lua +++ b/server/src/matcher/definition.lua @@ -2,7 +2,7 @@ local function parseResultAcrossUri(positions, vm, result) -- 跨越文件时,遍历的是值的绑定信息 for _, info in ipairs(result.value) do if info.type == 'set' and info.source.uri == result.value.uri then - positions[#positions+1] = { + positions[1] = { info.source.start, info.source.finish, info.source.uri, @@ -12,7 +12,7 @@ local function parseResultAcrossUri(positions, vm, result) if #positions == 0 then for _, info in ipairs(result.value) do if info.type == 'return' and info.source.uri == result.value.uri then - positions[#positions+1] = { + positions[1] = { info.source.start, info.source.finish, info.source.uri, @@ -21,7 +21,7 @@ local function parseResultAcrossUri(positions, vm, result) end end if #positions == 0 then - positions[#positions+1] = { + positions[1] = { 0, 0, result.value.uri, } diff --git a/server/src/matcher/implementation.lua b/server/src/matcher/implementation.lua index 6f90484e..9ff3fdca 100644 --- a/server/src/matcher/implementation.lua +++ b/server/src/matcher/implementation.lua @@ -2,7 +2,7 @@ local function parseResultAcrossUri(positions, vm, result) -- 跨越文件时,遍历的是值的绑定信息 for _, info in ipairs(result.value) do if info.type == 'set' and info.source.uri == result.value.uri then - positions[#positions+1] = { + positions[1] = { info.source.start, info.source.finish, info.source.uri, @@ -12,7 +12,7 @@ local function parseResultAcrossUri(positions, vm, result) if #positions == 0 then for _, info in ipairs(result.value) do if info.type == 'return' and info.source.uri == result.value.uri then - positions[#positions+1] = { + positions[1] = { info.source.start, info.source.finish, info.source.uri, @@ -20,6 +20,12 @@ local function parseResultAcrossUri(positions, vm, result) end end end + if #positions == 0 then + positions[1] = { + 0, 0, + result.value.uri, + } + end end local function parseResult(vm, result) |