summaryrefslogtreecommitdiff
path: root/server/src/core/find_result.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-02-26 15:29:10 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-02-26 15:29:10 +0800
commit94a9de07f5042e18927ce996f151c846fca432f9 (patch)
tree2152f984a509242dd0ad2dd122d57bf518ab26f3 /server/src/core/find_result.lua
parentae9734ee608897b48c2f1ef730d30cc168377e31 (diff)
downloadlua-language-server-94a9de07f5042e18927ce996f151c846fca432f9.zip
暂存
Diffstat (limited to 'server/src/core/find_result.lua')
-rw-r--r--server/src/core/find_result.lua41
1 files changed, 0 insertions, 41 deletions
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