Skip to content

Commit

Permalink
speed up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Jul 19, 2023
1 parent 0108cc7 commit 83aa702
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions script/await.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions script/workspace/workspace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,6 @@ function m.flushFiles(scp)
for uri in pairs(cachedUris) do
files.delRef(uri)
end
collectgarbage()
collectgarbage()
end

---@param scp scope
Expand All @@ -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)
Expand Down

0 comments on commit 83aa702

Please sign in to comment.