summaryrefslogtreecommitdiff
path: root/script/files.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-08 17:33:01 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-08 17:33:01 +0800
commit9744eb716f3b521f14331d4769925380c3dc3d84 (patch)
treeee24b9d35e1338bd5c36331fb15be6189db3abbb /script/files.lua
parent5dd886dfe1fa7bbaf8ca898d33e45b04513f6492 (diff)
downloadlua-language-server-9744eb716f3b521f14331d4769925380c3dc3d84.zip
cleanup
Diffstat (limited to 'script/files.lua')
-rw-r--r--script/files.lua7
1 files changed, 5 insertions, 2 deletions
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