diff options
Diffstat (limited to 'server-beta/src')
-rw-r--r-- | server-beta/src/core/hover/function.lua | 10 | ||||
-rw-r--r-- | server-beta/src/core/hover/init.lua | 39 |
2 files changed, 49 insertions, 0 deletions
diff --git a/server-beta/src/core/hover/function.lua b/server-beta/src/core/hover/function.lua new file mode 100644 index 00000000..15e54306 --- /dev/null +++ b/server-beta/src/core/hover/function.lua @@ -0,0 +1,10 @@ +local m = {} + +function m.label(source) + if source.type ~= 'function' then + return + end + +end + +return m diff --git a/server-beta/src/core/hover/init.lua b/server-beta/src/core/hover/init.lua new file mode 100644 index 00000000..af1bf6da --- /dev/null +++ b/server-beta/src/core/hover/init.lua @@ -0,0 +1,39 @@ +local files = require 'files' +local guide = require 'parser.guide' +local vm = require 'vm' +local funcHover = require 'core.hover.function' + +local function getHoverAsFunction(source) + local values = vm.getValue(source) + for _, value in ipairs(values) do + if value.type == 'function' then + local funcLabel = funcHover.label(value.source) + end + end +end + +local function getHover(source) + local isFunction = vm.hasType(source, 'function') + if isFunction then + getHoverAsFunction(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 |