diff options
Diffstat (limited to 'server-beta/src/core/hover')
-rw-r--r-- | server-beta/src/core/hover/label.lua | 5 | ||||
-rw-r--r-- | server-beta/src/core/hover/return.lua | 20 |
2 files changed, 24 insertions, 1 deletions
diff --git a/server-beta/src/core/hover/label.lua b/server-beta/src/core/hover/label.lua index a9e7ba13..da8a0c84 100644 --- a/server-beta/src/core/hover/label.lua +++ b/server-beta/src/core/hover/label.lua @@ -6,7 +6,10 @@ local function asFunction(source) local name = buildName(source) local arg = buildArg(source) local rtn = buildReturn(source) - return ('function %s(%s)'):format(name, arg) + local lines = {} + lines[1] = ('function %s(%s)'):format(name, arg) + lines[2] = rtn + return table.concat(lines, '\n') end return function (source) diff --git a/server-beta/src/core/hover/return.lua b/server-beta/src/core/hover/return.lua index dbc3df85..c22626a6 100644 --- a/server-beta/src/core/hover/return.lua +++ b/server-beta/src/core/hover/return.lua @@ -5,6 +5,26 @@ local function asFunction(source) if not source.returns then return nil end + local returns = {} + for _, rtn in ipairs(source.returns) do + for i = 1, #rtn do + local values = vm.getValue(rtn[i]) + returns[#returns+1] = values + end + break + end + if #returns == 0 then + return nil + end + local lines = {} + for i = 1, #returns do + if i == 1 then + lines[i] = (' -> %s'):format(vm.viewType(returns[i])) + else + lines[i] = ('% 3d. %s'):format(i, returns[i]) + end + end + return table.concat(lines, '\n') end return function (source) |