blob: 33f333e762e4f63e3167f66a9b9268917cfb3452 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
local function isContainPos(obj, pos)
return obj.start <= pos and obj.finish + 1 >= pos
end
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
return nil
end
|