summaryrefslogtreecommitdiff
path: root/server/src/matcher/find_result.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/matcher/find_result.lua')
-rw-r--r--server/src/matcher/find_result.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/server/src/matcher/find_result.lua b/server/src/matcher/find_result.lua
index 940ef80c..ac8dc3f4 100644
--- a/server/src/matcher/find_result.lua
+++ b/server/src/matcher/find_result.lua
@@ -5,7 +5,7 @@ local function isContainPos(obj, pos)
return false
end
-local function findAtPos(results, pos)
+local function findAtPos(results, pos, level)
local res = {}
for sources, object in pairs(results.sources) do
if sources.type == 'multi-source' then
@@ -35,9 +35,13 @@ local function findAtPos(results, pos)
table.sort(res, function (a, b)
return a.range < b.range
end)
- return res[1].object, res[1].source
+ local data = res[level or 1]
+ if not data then
+ return nil
+ end
+ return data.object, data.source
end
-return function (vm, pos)
- return findAtPos(vm.results, pos)
+return function (vm, pos, level)
+ return findAtPos(vm.results, pos, level)
end