From 6e447f52bb9cf25730115b3baa7989ff95273471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 21 Oct 2019 16:26:13 +0800 Subject: =?UTF-8?q?#101=20signature=20=E9=A2=9D=E5=A4=96=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E7=9A=84label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/hover/emmy_function.lua | 6 ++++-- server/src/core/hover/function.lua | 6 ++++-- server/src/core/hover/lib_function.lua | 6 ++++-- server/src/core/signature.lua | 14 +++++++------- 4 files changed, 19 insertions(+), 13 deletions(-) (limited to 'server/src/core') diff --git a/server/src/core/hover/emmy_function.lua b/server/src/core/hover/emmy_function.lua index 36fd4e90..e14e88c5 100644 --- a/server/src/core/hover/emmy_function.lua +++ b/server/src/core/hover/emmy_function.lua @@ -125,13 +125,15 @@ return function (name, emmy, object, select) local enum, rawEnum = buildEnum(emmy) local tip = emmy.description local headLen = #('function %s('):format(name) - local title = ('function %s(%s)%s'):format(name, argStr, returns) + 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, + label = title .. returns, + title = title, + returns = returns, description = tip, enum = enum, rawEnum = rawEnum, diff --git a/server/src/core/hover/function.lua b/server/src/core/hover/function.lua index df26cd40..25796d60 100644 --- a/server/src/core/hover/function.lua +++ b/server/src/core/hover/function.lua @@ -229,13 +229,15 @@ return function (name, func, object, select) 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, argStr, returns) + 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, + label = title .. returns, + title = title, + returns = returns, description = comment, enum = enum, rawEnum = rawEnum, diff --git a/server/src/core/hover/lib_function.lua b/server/src/core/hover/lib_function.lua index 09b1e47b..3c693961 100644 --- a/server/src/core/hover/lib_function.lua +++ b/server/src/core/hover/lib_function.lua @@ -208,13 +208,15 @@ return function (name, lib, object, select) local tip = lib.description local doc = buildDoc(lib) local headLen = #('function %s('):format(name) - local title = ('function %s(%s)%s'):format(name, argStr, returns) + 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, + label = title .. returns, + title = title, + returns = returns, description = tip, enum = enum, rawEnum = rawEnum, diff --git a/server/src/core/signature.lua b/server/src/core/signature.lua index 62aa5b3c..3c9e696c 100644 --- a/server/src/core/signature.lua +++ b/server/src/core/signature.lua @@ -63,29 +63,29 @@ local function hovers(call, pos) local object = source:get 'object' local lib, fullkey = findLib(source) local name = fullkey or buildValueName(source) - local hovers = {} + local hover if lib then - hovers[#hovers+1] = getFunctionHoverAsLib(name, lib, object, select) + hover = getFunctionHoverAsLib(name, lib, object, select) else local emmy = value:getEmmy() if emmy and emmy.type == 'emmy.functionType' then - hovers[#hovers+1] = getFunctionHoverAsEmmy(name, emmy, object, select) + hover = getFunctionHoverAsEmmy(name, emmy, object, select) else ---@type emmyFunction local func = value:getFunction() - hovers[#hovers+1] = getFunctionHover(name, func, object, select) + hover = getFunctionHover(name, func, object, select) local overLoads = func and func:getEmmyOverLoads() if overLoads then for _, ol in ipairs(overLoads) do - hovers[#hovers+1] = getFunctionHoverAsEmmy(name, ol, object, select) + hover = getFunctionHoverAsEmmy(name, ol, object, select) end end end end - if #hovers == 0 then + if not hover then return nil end - return hovers + return { hover } end local function isInFunctionOrTable(call, pos) -- cgit v1.2.3