diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-08 17:33:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-08 17:33:01 +0800 |
commit | 9744eb716f3b521f14331d4769925380c3dc3d84 (patch) | |
tree | ee24b9d35e1338bd5c36331fb15be6189db3abbb | |
parent | 5dd886dfe1fa7bbaf8ca898d33e45b04513f6492 (diff) | |
download | lua-language-server-9744eb716f3b521f14331d4769925380c3dc3d84.zip |
cleanup
-rw-r--r-- | meta/template/basic.lua | 8 | ||||
-rw-r--r-- | meta/template/coroutine.lua | 6 | ||||
-rw-r--r-- | meta/template/debug.lua | 18 | ||||
-rw-r--r-- | meta/template/string.lua | 2 | ||||
-rw-r--r-- | script/await.lua | 1 | ||||
-rw-r--r-- | script/files.lua | 7 | ||||
-rw-r--r-- | script/glob/gitignore.lua | 2 | ||||
-rw-r--r-- | script/utility.lua | 1 |
8 files changed, 26 insertions, 19 deletions
diff --git a/meta/template/basic.lua b/meta/template/basic.lua index c3916eba..b26d3959 100644 --- a/meta/template/basic.lua +++ b/meta/template/basic.lua @@ -55,7 +55,7 @@ _G = {} ---@version 5.1 ---#DES 'getfenv' ----@param f? async fun(...):... +---@param f? async fun() ---@return table ---@nodiscard function getfenv(f) end @@ -151,7 +151,7 @@ function pairs(t) end ---#if VERSION == 5.1 and not JIT then ---@param f function ---#else ----@param f async fun(...):... +---@param f async fun() ---#end ---@param arg1? any ---@return boolean success @@ -197,7 +197,7 @@ function select(index, ...) end ---@version 5.1 ---#DES 'setfenv' ----@param f async fun(...):...|integer +---@param f async fun()|integer ---@param table table ---@return function function setfenv(f, table) end @@ -263,7 +263,7 @@ function warn(message, ...) end function xpcall(f, err) end ---#else ---#DES 'xpcall>5.2' ----@param f async fun(...):... +---@param f async fun() ---@param msgh function ---@param arg1? any ---@return boolean success diff --git a/meta/template/coroutine.lua b/meta/template/coroutine.lua index 390be21b..0b07bf5c 100644 --- a/meta/template/coroutine.lua +++ b/meta/template/coroutine.lua @@ -5,7 +5,7 @@ coroutine = {} ---#DES 'coroutine.create' ----@param f async fun(...):... +---@param f async fun() ---@return thread ---@nodiscard function coroutine.create(f) end @@ -55,8 +55,8 @@ function coroutine.running() end function coroutine.status(co) end ---#DES 'coroutine.wrap' ----@param f async fun(...):... ----@return fun(...):... +---@param f async fun() +---@return fun() ---@nodiscard function coroutine.wrap(f) end diff --git a/meta/template/debug.lua b/meta/template/debug.lua index bb31ee1a..c8b506f5 100644 --- a/meta/template/debug.lua +++ b/meta/template/debug.lua @@ -63,7 +63,7 @@ function debug.gethook(co) end ---#DES 'debug.getinfo' ---@overload fun(f: integer|function, what?: infowhat):debuginfo ---@param thread thread ----@param f integer|async fun(...):... +---@param f integer|async fun() ---@param what? infowhat ---@return debuginfo ---@nodiscard @@ -81,9 +81,9 @@ function debug.getinfo(thread, f, what) end function debug.getlocal(thread, level, index) end ---#else ---#DES 'debug.getlocal>5.2' ----@overload fun(f: integer|async fun(...), index: integer):string, any +---@overload fun(f: integer|async fun(), index: integer):string, any ---@param thread thread ----@param f integer|async fun(...):... +---@param f integer|async fun() ---@param index integer ---@return string name ---@return any value @@ -103,7 +103,7 @@ function debug.getmetatable(object) end function debug.getregistry() end ---#DES 'debug.getupvalue' ----@param f async fun(...):... +---@param f async fun() ---@param up integer ---@return string name ---@return any value @@ -148,7 +148,7 @@ function debug.setfenv(object, env) end ---#DES 'debug.sethook' ---@overload fun(hook: function, mask: hookmask, count?: integer) ---@param thread thread ----@param hook async fun(...):... +---@param hook async fun() ---@param mask hookmask ---@param count? integer function debug.sethook(thread, hook, mask, count) end @@ -170,7 +170,7 @@ function debug.setlocal(thread, level, index, value) end function debug.setmetatable(value, meta) end ---#DES 'debug.setupvalue' ----@param f async fun(...):... +---@param f async fun() ---@param up integer ---@param value any ---@return string name @@ -202,7 +202,7 @@ function debug.traceback(thread, message, level) end ---@version >5.2, JIT ---#DES 'debug.upvalueid' ----@param f async fun(...):... +---@param f async fun() ---@param n integer ---@return lightuserdata id ---@nodiscard @@ -210,9 +210,9 @@ function debug.upvalueid(f, n) end ---@version >5.2, JIT ---#DES 'debug.upvaluejoin' ----@param f1 async fun(...):... +---@param f1 async fun() ---@param n1 integer ----@param f2 async fun(...):... +---@param f2 async fun() ---@param n2 integer function debug.upvaluejoin(f1, n1, f2, n2) end diff --git a/meta/template/string.lua b/meta/template/string.lua index 0673afa8..e61c3688 100644 --- a/meta/template/string.lua +++ b/meta/template/string.lua @@ -22,7 +22,7 @@ function string.byte(s, i, j) end function string.char(byte, ...) end ---#DES 'string.dump' ----@param f async fun(...):... +---@param f async fun() ---@param strip? boolean ---@return string ---@nodiscard diff --git a/script/await.lua b/script/await.lua index d8b9ef38..ff840956 100644 --- a/script/await.lua +++ b/script/await.lua @@ -245,6 +245,7 @@ function m.disable() end --- 注册事件 +---@param callback async fun(ev: string, ...) function m.watch(callback) m.watchList[#m.watchList+1] = callback end diff --git a/script/files.lua b/script/files.lua index eca3d58d..6bf3dcaf 100644 --- a/script/files.lua +++ b/script/files.lua @@ -709,13 +709,16 @@ function m.getDllWords(uri) end --- 注册事件 +---@param callback async fun(ev: string, uri: uri) function m.watch(callback) m.watchList[#m.watchList+1] = callback end -function m.onWatch(ev, ...) +function m.onWatch(ev, uri) for _, callback in ipairs(m.watchList) do - xpcall(callback, log.error, ev, ...) + await.call(function () + callback(ev, uri) + end) end end diff --git a/script/glob/gitignore.lua b/script/glob/gitignore.lua index 3f7c564f..09be1415 100644 --- a/script/glob/gitignore.lua +++ b/script/glob/gitignore.lua @@ -164,6 +164,7 @@ function mt:getRelativePath(path) end ---@param callback async fun() +---@async function mt:scan(path, callback) local files = {} if type(callback) ~= 'function' then @@ -171,6 +172,7 @@ function mt:scan(path, callback) end local list = {} + ---@async local function check(current) local fileType = self:callInterface('type', current) if fileType == 'file' then diff --git a/script/utility.lua b/script/utility.lua index b5eb4095..85c98cb1 100644 --- a/script/utility.lua +++ b/script/utility.lua @@ -691,6 +691,7 @@ function m.switch() return obj end +---@param f async fun() function m.getUpvalue(f, name) for i = 1, 999 do local uname, value = getupvalue(f, i) |