summaryrefslogtreecommitdiff
path: root/server-beta/src/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-10-22 14:46:29 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-10-22 14:46:29 +0800
commit7e10ca9e3f60c5a108ee3d9bccf9c42da3d74c02 (patch)
tree0f2cb64c98379382483a339f1ac31bc889d057f4 /server-beta/src/workspace
parent6ff3fcc8a106a3429e5bf7dfd4ca6db5a3cc3e1c (diff)
downloadlua-language-server-7e10ca9e3f60c5a108ee3d9bccf9c42da3d74c02.zip
修改预读流程
Diffstat (limited to 'server-beta/src/workspace')
-rw-r--r--server-beta/src/workspace/workspace.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/server-beta/src/workspace/workspace.lua b/server-beta/src/workspace/workspace.lua
index efe2f1cf..70334134 100644
--- a/server-beta/src/workspace/workspace.lua
+++ b/server-beta/src/workspace/workspace.lua
@@ -86,6 +86,8 @@ function m.preload()
if not m.uri then
return
end
+ local max = 0
+ local read = 0
log.info('Preload start.')
local ignore = m.getIgnoreMatcher()
@@ -111,22 +113,21 @@ function m.preload()
if not files.isLua(uri) then
return
end
+ max = max + 1
pub.syncTask('loadFile', uri, function (text)
+ read = read + 1
log.info(('Preload file at: %s , size = %.3f KB'):format(uri, #text / 1000.0))
files.setText(uri, text)
end)
end)
+ log.info(('Found %d files.'):format(max))
while true do
- local count = 0
- for _, file in pairs(files.fileMap) do
- if file.compiling then
- task.sleep(0.1)
- goto CONTINUE
- end
- count = count + 1
+ log.info(('Loaded %d/%d files'):format(read, max))
+ if read < max then
+ task.sleep(0.1)
+ goto CONTINUE
end
- log.info(('Preloaded %d files.'):format(count))
break
::CONTINUE::
end