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.lua28
1 files changed, 13 insertions, 15 deletions
diff --git a/server/src/matcher/find_result.lua b/server/src/matcher/find_result.lua
index e8128008..33f333e7 100644
--- a/server/src/matcher/find_result.lua
+++ b/server/src/matcher/find_result.lua
@@ -2,22 +2,20 @@ local function isContainPos(obj, pos)
return obj.start <= pos and obj.finish + 1 >= pos
end
-local function findIn(name, group, pos)
- for _, obj in ipairs(group) do
- for _, info in ipairs(obj) do
- if isContainPos(info.source, pos) then
- return {
- type = name,
- object = obj,
- info = info,
- }
+return function (vm, pos)
+ local results = vm.results
+ for source, object in pairs(results.sources) do
+ if source.type == 'multi-source' then
+ for _, source in ipairs(source) do
+ if isContainPos(source, pos) then
+ return object, source
+ end
+ end
+ else
+ if isContainPos(source, pos) then
+ return object, source
end
end
end
-end
-
-return function (results, pos)
- return findIn('local', results.locals, pos)
- or findIn('field', results.fields, pos)
- or findIn('label', results.labels, pos)
+ return nil
end