summaryrefslogtreecommitdiff
path: root/script/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-01-27 19:44:29 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-01-27 19:44:29 +0800
commit43a29d8842d5533750c8cfc5198f5df603fa8ca5 (patch)
tree858d8a0740f55a89e3d88e13177aa654427e820b /script/workspace
parent954826cb2dcbdb25fde09d6fd38760a69d06475a (diff)
downloadlua-language-server-43a29d8842d5533750c8cfc5198f5df603fa8ca5.zip
wait for workspace ready
Diffstat (limited to 'script/workspace')
-rw-r--r--script/workspace/workspace.lua15
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)