summaryrefslogtreecommitdiff
path: root/server-beta/src/core/hover/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/src/core/hover/init.lua')
-rw-r--r--server-beta/src/core/hover/init.lua56
1 files changed, 0 insertions, 56 deletions
diff --git a/server-beta/src/core/hover/init.lua b/server-beta/src/core/hover/init.lua
deleted file mode 100644
index b99c14b2..00000000
--- a/server-beta/src/core/hover/init.lua
+++ /dev/null
@@ -1,56 +0,0 @@
-local files = require 'files'
-local guide = require 'parser.guide'
-local vm = require 'vm'
-local getLabel = require 'core.hover.label'
-
-local function getHoverAsFunction(source)
- local values = vm.getValue(source)
- local labels = {}
- for _, value in ipairs(values) do
- if value.type == 'function' then
- labels[#labels+1] = getLabel(value.source)
- end
- end
-
- local label = table.concat(labels, '\n')
- return {
- label = label,
- source = source,
- }
-end
-
-local function getHoverAsValue(source)
- local label = getLabel(source)
- return {
- label = label,
- source = source,
- }
-end
-
-local function getHover(source)
- local isFunction = vm.hasType(source, 'function')
- if isFunction then
- return getHoverAsFunction(source)
- else
- return getHoverAsValue(source)
- end
-end
-
-return function (uri, offset)
- local ast = files.getAst(uri)
- if not ast then
- return nil
- end
- local hover = guide.eachSourceContain(ast.ast, offset, function (source)
- if source.type == 'local'
- or source.type == 'setlocal'
- or source.type == 'getlocal'
- or source.type == 'setglobal'
- or source.type == 'getglobal'
- or source.type == 'field'
- or source.type == 'method' then
- return getHover(source)
- end
- end)
- return hover
-end