diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-06-20 16:25:12 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-06-20 16:25:12 +0800 |
commit | 8c9fef46b8592ed5cd043b8b922a40ab414d3598 (patch) | |
tree | de7874717a8554f02828aadd19f0cd2951f54534 | |
parent | c16e3da5a1f1944d4d2f7cea49bf05c20b9311ab (diff) | |
download | lua-language-server-8c9fef46b8592ed5cd043b8b922a40ab414d3598.zip |
#51
-rw-r--r-- | server/src/core/hover/emmy_function.lua | 7 | ||||
-rw-r--r-- | server/src/emmy/funcType.lua | 4 | ||||
-rw-r--r-- | server/test/hover/init.lua | 9 |
3 files changed, 19 insertions, 1 deletions
diff --git a/server/src/core/hover/emmy_function.lua b/server/src/core/hover/emmy_function.lua index 6306957f..313b5276 100644 --- a/server/src/core/hover/emmy_function.lua +++ b/server/src/core/hover/emmy_function.lua @@ -41,7 +41,12 @@ local function buildEmmyArgs(emmy, object, select) end local function buildEmmyReturns(emmy) - return '\n -> ' .. emmy:getReturn():getType() + local rtn = emmy:getReturn() + if rtn then + return '\n -> ' .. rtn:getType() + else + return '\n -> ' .. 'any' + end end local function buildEnum(lib) diff --git a/server/src/emmy/funcType.lua b/server/src/emmy/funcType.lua index 2acf8d28..f467f763 100644 --- a/server/src/emmy/funcType.lua +++ b/server/src/emmy/funcType.lua @@ -9,6 +9,10 @@ function mt:getType() return 'function' end +function mt:getName() + return 'function' +end + function mt:getSource() return listMgr.get(self.source) end diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua index c6e01f25..f1a18c06 100644 --- a/server/test/hover/init.lua +++ b/server/test/hover/init.lua @@ -760,6 +760,15 @@ local r: boolean ]] TEST [[ +---@param f fun():void +function t(<?f?>) end +]] +[[ +function () + -> any +]] + +TEST [[ ---@param names string[] local function f(<?names?>) end |