diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/hover/function.lua | 17 | ||||
-rw-r--r-- | server/src/method/textDocument/hover.lua | 3 |
2 files changed, 19 insertions, 1 deletions
diff --git a/server/src/core/hover/function.lua b/server/src/core/hover/function.lua index 52402f83..5976806c 100644 --- a/server/src/core/hover/function.lua +++ b/server/src/core/hover/function.lua @@ -1,3 +1,5 @@ +local emmyFunction = require 'core.hover.emmy_function' + local function buildValueArgs(func, object, select) if not func then return '', nil @@ -155,11 +157,25 @@ local function getComment(func) return func:getComment() end +local function getOverLoads(name, func, object, select) + local overloads = func and func:getEmmyOverLoads() + if not overloads then + return nil + end + local list = {} + for _, ol in ipairs(overloads) do + local hover = emmyFunction(name, ol, object, select) + list[#list+1] = hover.label + end + return table.concat(list, '\n') +end + return function (name, func, object, select) local args, argLabel = buildValueArgs(func, object, select) local returns = buildValueReturns(func) local enum = buildEnum(func) local comment = getComment(func) + local overloads = getOverLoads(name, func, object, select) local headLen = #('function %s('):format(name) local title = ('function %s(%s)%s'):format(name, args, returns) if argLabel then @@ -171,5 +187,6 @@ return function (name, func, object, select) description = comment, enum = enum, argLabel = argLabel, + overloads = overloads, } end diff --git a/server/src/method/textDocument/hover.lua b/server/src/method/textDocument/hover.lua index 4e4b754d..c8645d2b 100644 --- a/server/src/method/textDocument/hover.lua +++ b/server/src/method/textDocument/hover.lua @@ -22,13 +22,14 @@ return function (lsp, params) local text = ([[ ```lua %s +%s ``` %s ```lua %s ``` %s -]]):format(hover.label or '', hover.description or '', hover.enum or '', hover.doc or '') +]]):format(hover.label or '', hover.overloads or '', hover.description or '', hover.enum or '', hover.doc or '') local response = { contents = { |