diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-07-19 16:14:06 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-07-19 16:14:06 +0800 |
commit | 83aa702b33d5dd66e35ddb6883cd8d7417b5f83b (patch) | |
tree | 6c50f1b147e3de3ddea5de7b79074c3f5eaf4ff2 | |
parent | 0108cc7c485a2885976d33e2da9419b97223e66e (diff) | |
download | lua-language-server-83aa702b33d5dd66e35ddb6883cd8d7417b5f83b.zip |
speed up tests
-rw-r--r-- | script/await.lua | 5 | ||||
-rw-r--r-- | script/workspace/workspace.lua | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/script/await.lua b/script/await.lua index fa2aea13..22745570 100644 --- a/script/await.lua +++ b/script/await.lua @@ -108,6 +108,11 @@ function m.hasID(id, co) return m.idMap[id] and m.idMap[id][co] ~= nil end +function m.unique(id, callback) + m.close(id) + m.setID(id, callback) +end + --- 休眠一段时间 ---@param time number ---@async diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index a55e6246..da2f9daf 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -469,8 +469,6 @@ function m.flushFiles(scp) for uri in pairs(cachedUris) do files.delRef(uri) end - collectgarbage() - collectgarbage() end ---@param scp scope @@ -491,6 +489,8 @@ end ---@async ---@param scp scope function m.awaitReload(scp) + await.unique('workspace reload:' .. scp:getName()) + await.sleep(0.1) scp:set('ready', false) scp:set('nativeMatcher', nil) scp:set('libraryMatcher', nil) |