diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-02-02 16:59:55 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-02-02 16:59:55 +0800 |
commit | f5ae885f62c8bf5a3b6086177b5a703406459916 (patch) | |
tree | e36ff1eba467da2fee9c462fba97c2737c74741f /script/workspace | |
parent | cd5b93f0308ca9e3f494344a626730efdc10f219 (diff) | |
download | lua-language-server-f5ae885f62c8bf5a3b6086177b5a703406459916.zip |
stash
Diffstat (limited to 'script/workspace')
-rw-r--r-- | script/workspace/workspace.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index edde3ab9..2e47bb7e 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -246,6 +246,25 @@ local function loadFileFactory(root, progressData, isLibrary) end end +function m.awaitLoadFile(uri) + local progressBar <close> = progress.create(lang.script.WORKSPACE_LOADING) + local progressData = { + max = 0, + read = 0, + preload = 0, + update = function (self) + progressBar:setMessage(('%d/%d'):format(self.read, self.max)) + progressBar:setPercentage(self.read / self.max * 100) + end + } + local nativeLoader = loadFileFactory(m.path, progressData) + local native = m.getNativeMatcher() + if native then + log.info('Scan files at:', m.path) + native:scan(uri, nativeLoader) + end +end + --- 预读工作区内所有文件 function m.awaitPreload() local diagnostic = require 'provider.diagnostic' |