diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-30 17:08:03 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-30 17:08:03 +0800 |
commit | 40135e7d6bb96e34aafd133b24cdff2e73d1a892 (patch) | |
tree | 2c4d08901db0d574c089a47580d78854becf7140 | |
parent | b964c31fb2e9aba9e29c19218ba75538e2ce19fd (diff) | |
download | lua-language-server-40135e7d6bb96e34aafd133b24cdff2e73d1a892.zip |
修正会遍历2次文件的bug
-rw-r--r-- | script-beta/await.lua | 3 | ||||
-rw-r--r-- | script-beta/workspace/workspace.lua | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/script-beta/await.lua b/script-beta/await.lua index a26adff8..a718dbb6 100644 --- a/script-beta/await.lua +++ b/script-beta/await.lua @@ -100,6 +100,9 @@ function m.sleep(time) end local co = coroutine.running() timer.wait(time, function () + if coroutine.status(co) == 'dead' then + return + end return m.checkResult(co, coroutine.resume(co)) end) return coroutine.yield() diff --git a/script-beta/workspace/workspace.lua b/script-beta/workspace/workspace.lua index d2a0637f..e75e280f 100644 --- a/script-beta/workspace/workspace.lua +++ b/script-beta/workspace/workspace.lua @@ -159,6 +159,8 @@ function m.awaitPreload() if not m.uri then return end + await.close 'preload' + await.setID 'preload' local progress = { max = 0, read = 0, @@ -186,6 +188,11 @@ function m.awaitPreload() await.sleep(0.1) end + --for i = 1, 100 do + -- await.sleep(0.1) + -- log.info('sleep', i) + --end + log.info('Preload finish.') local diagnostic = require 'provider.diagnostic' @@ -262,8 +269,7 @@ end function m.reload() files.removeAll() rpath.flush() - await.close 'preload' - await.call(m.awaitPreload, 'preload') + await.call(m.awaitPreload) end files.watch(function (ev, uri) |