From 94a9de07f5042e18927ce996f151c846fca432f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 26 Feb 2019 15:29:10 +0800 Subject: =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/find_result.lua | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 server/src/core/find_result.lua (limited to 'server/src/core/find_result.lua') diff --git a/server/src/core/find_result.lua b/server/src/core/find_result.lua deleted file mode 100644 index a562f192..00000000 --- a/server/src/core/find_result.lua +++ /dev/null @@ -1,41 +0,0 @@ -local function isContainPos(obj, pos) - if obj.start <= pos and obj.finish + 1 >= pos then - return true - end - return false -end - -local function isValidSource(source) - return source.type ~= 'simple' -end - -local function findAtPos(results, pos, level) - local res = {} - for _, source in ipairs(results.sources) do - if isValidSource(source) and isContainPos(source, pos) then - res[#res+1] = { - object = source.bind, - source = source, - range = source.finish - source.start, - } - if not source.bind then - error('Miss source object') - end - end - end - if #res == 0 then - return nil - end - table.sort(res, function (a, b) - return a.range < b.range - end) - local data = res[level or 1] - if not data then - return nil - end - return data.object, data.source -end - -return function (vm, pos, level) - return findAtPos(vm.results, pos, level) -end -- cgit v1.2.3