diff options
-rw-r--r-- | script/await.lua | 2 | ||||
-rw-r--r-- | script/core/hover/label.lua | 6 | ||||
-rw-r--r-- | test/hover/init.lua | 8 |
3 files changed, 14 insertions, 2 deletions
diff --git a/script/await.lua b/script/await.lua index a887664a..cea5667b 100644 --- a/script/await.lua +++ b/script/await.lua @@ -25,7 +25,7 @@ local function setID(id, co, callback) end --- 设置错误处理器 ----@param errHandle function {comment = '当有错误发生时,会以错误堆栈为参数调用该函数'} +---@param errHandle function # 当有错误发生时,会以错误堆栈为参数调用该函数 function m.setErrorHandle(errHandle) m.errorHandle = errHandle end diff --git a/script/core/hover/label.lua b/script/core/hover/label.lua index 44459bb6..803b9596 100644 --- a/script/core/hover/label.lua +++ b/script/core/hover/label.lua @@ -16,7 +16,11 @@ local function asFunction(source, oop) local arg = buildArg(source, oop) local rtn = buildReturn(source) local lines = {} - lines[1] = ('%s %s(%s)'):format(oop and 'method' or 'function', name or '', arg) + lines[1] = ('%s%s %s(%s)'):format( + vm.isAsync(source) and 'async ' or '', + oop and 'method' or 'function', + name or '', arg + ) lines[2] = rtn return table.concat(lines, '\n') end diff --git a/test/hover/init.lua b/test/hover/init.lua index 54fab5fc..404adb44 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -1724,3 +1724,11 @@ local function <?f?>() end function f() -> nil ]] + +TEST [[ +---@async +local function <?f?>() end +]] +[[ +async function f() +]] |