summaryrefslogtreecommitdiff
path: root/server/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/core')
-rw-r--r--server/src/core/hover/emmy_function.lua11
-rw-r--r--server/src/core/hover/function.lua11
-rw-r--r--server/src/core/hover/lib_function.lua11
-rw-r--r--server/src/core/signature.lua22
4 files changed, 24 insertions, 31 deletions
diff --git a/server/src/core/hover/emmy_function.lua b/server/src/core/hover/emmy_function.lua
index e14e88c5..37b44a79 100644
--- a/server/src/core/hover/emmy_function.lua
+++ b/server/src/core/hover/emmy_function.lua
@@ -124,15 +124,10 @@ return function (name, emmy, object, select)
local returns = buildEmmyReturns(emmy)
local enum, rawEnum = buildEnum(emmy)
local tip = emmy.description
- local headLen = #('function %s('):format(name)
- local title = ('function %s(%s)'):format(name, argStr)
- if argLabel then
- argLabel[1] = argLabel[1] + headLen
- argLabel[2] = argLabel[2] + headLen
- end
return {
- label = title .. returns,
- title = title,
+ label = ('function %s(%s)%s'):format(name, argStr, returns),
+ name = name,
+ argStr = argStr,
returns = returns,
description = tip,
enum = enum,
diff --git a/server/src/core/hover/function.lua b/server/src/core/hover/function.lua
index 25796d60..8796be57 100644
--- a/server/src/core/hover/function.lua
+++ b/server/src/core/hover/function.lua
@@ -228,15 +228,10 @@ return function (name, func, object, select)
local enum, rawEnum = buildEnum(func)
local comment = getComment(func)
local overloads = getOverLoads(name, func, object, select)
- local headLen = #('function %s('):format(name)
- local title = ('function %s(%s)'):format(name, argStr)
- if argLabel then
- argLabel[1] = argLabel[1] + headLen
- argLabel[2] = argLabel[2] + headLen
- end
return {
- label = title .. returns,
- title = title,
+ label = ('function %s(%s)%s'):format(name, argStr, returns),
+ name = name,
+ argStr = argStr,
returns = returns,
description = comment,
enum = enum,
diff --git a/server/src/core/hover/lib_function.lua b/server/src/core/hover/lib_function.lua
index 3c693961..bd9cddaa 100644
--- a/server/src/core/hover/lib_function.lua
+++ b/server/src/core/hover/lib_function.lua
@@ -207,15 +207,10 @@ return function (name, lib, object, select)
local enum, rawEnum = buildEnum(lib)
local tip = lib.description
local doc = buildDoc(lib)
- local headLen = #('function %s('):format(name)
- local title = ('function %s(%s)'):format(name, argStr)
- if argLabel then
- argLabel[1] = argLabel[1] + headLen
- argLabel[2] = argLabel[2] + headLen
- end
return {
- label = title .. returns,
- title = title,
+ label = ('function %s(%s)%s'):format(name, argStr, returns),
+ name = name,
+ argStr = argStr,
returns = returns,
description = tip,
enum = enum,
diff --git a/server/src/core/signature.lua b/server/src/core/signature.lua
index 3c9e696c..bbe35ffa 100644
--- a/server/src/core/signature.lua
+++ b/server/src/core/signature.lua
@@ -47,7 +47,7 @@ local function getFunctionSource(call)
return nil
end
-local function hovers(call, pos)
+local function getHover(call, pos)
local args = call:bindCall()
if not args then
return nil
@@ -82,10 +82,7 @@ local function hovers(call, pos)
end
end
end
- if not hover then
- return nil
- end
- return { hover }
+ return hover
end
local function isInFunctionOrTable(call, pos)
@@ -119,7 +116,18 @@ return function (vm, pos)
return nil
end
- local hovers = hovers(nearCall, pos)
+ local hover = getHover(nearCall, pos)
+ if not hover then
+ return nil
+ end
- return hovers
+ -- skip `name(`
+ local head = #hover.name + 1
+ hover.label = ('%s(%s)'):format(hover.name, hover.argStr)
+ if hover.argLabel then
+ hover.argLabel[1] = hover.argLabel[1] + head
+ hover.argLabel[2] = hover.argLabel[2] + head
+ end
+
+ return { hover }
end