diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 19:44:29 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 19:44:29 +0800 |
commit | 43a29d8842d5533750c8cfc5198f5df603fa8ca5 (patch) | |
tree | 858d8a0740f55a89e3d88e13177aa654427e820b /script/workspace | |
parent | 954826cb2dcbdb25fde09d6fd38760a69d06475a (diff) | |
download | lua-language-server-43a29d8842d5533750c8cfc5198f5df603fa8ca5.zip |
wait for workspace ready
Diffstat (limited to 'script/workspace')
-rw-r--r-- | script/workspace/workspace.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 94b1d9e5..76dbd195 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -402,14 +402,27 @@ function m.getCache(name) end function m.reload() + await.call(m.awaitReload) +end + +function m.awaitReload() local rpath = require 'workspace.require-path' local plugin = require 'plugin' + m.ready = false files.flushAllLibrary() files.removeAllClosed() files.flushCache() rpath.flush() plugin.init() - await.call(m.awaitPreload) + m.awaitPreload() + m.ready = true +end + +---等待工作目录加载完成 +function m.awaitReady() + while not m.ready do + await.sleep(0.1) + end end files.watch(function (ev, uri) |