diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-12-11 19:03:55 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-12-11 19:03:55 +0800 |
commit | b745c50723f8e9becc0224b868992d116ffc1e3b (patch) | |
tree | a3645acc256fcb2a705ae5293789bd17da149a87 /script-beta/workspace/workspace.lua | |
parent | 17f34d6a6880ad4e5d029ff91c4cb670a5a606b8 (diff) | |
download | lua-language-server-b745c50723f8e9becc0224b868992d116ffc1e3b.zip |
跳过过大的文件
Diffstat (limited to 'script-beta/workspace/workspace.lua')
-rw-r--r-- | script-beta/workspace/workspace.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/script-beta/workspace/workspace.lua b/script-beta/workspace/workspace.lua index deee764a..f24f825a 100644 --- a/script-beta/workspace/workspace.lua +++ b/script-beta/workspace/workspace.lua @@ -12,6 +12,7 @@ local m = {} m.type = 'workspace' m.ignoreVersion = -1 m.ignoreMatcher = nil +m.preloadVersion = 0 m.uri = '' m.path = '' @@ -133,7 +134,9 @@ function m.awaitPreload() if read >= max then break end - await.sleep(0.1) + await.sleep(0.1, function () + return m.preloadVersion + end) end log.info('Preload finish.') @@ -193,4 +196,12 @@ function m.getRelativePath(uri) return fs.relative(fs.path(path), fs.path(m.path)):string() end +function m.reload() + m.preloadVersion = m.preloadVersion + 1 + files.removeAll() + await.create(function () + m.awaitPreload() + end) +end + return m |