diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-08 13:46:50 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-08 13:46:50 +0800 |
commit | f53b68d739ab7aad9c6aae2b902f34fbb8fc97ea (patch) | |
tree | b98df4754836a32e9896bc60095d5f925cb5852f /server-beta/src/workspace/workspace.lua | |
parent | 26d718bba628a337ffeea9e20f2b9af7581af1d7 (diff) | |
download | lua-language-server-f53b68d739ab7aad9c6aae2b902f34fbb8fc97ea.zip |
整理代码
Diffstat (limited to 'server-beta/src/workspace/workspace.lua')
-rw-r--r-- | server-beta/src/workspace/workspace.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server-beta/src/workspace/workspace.lua b/server-beta/src/workspace/workspace.lua index c8deb001..79fd03df 100644 --- a/server-beta/src/workspace/workspace.lua +++ b/server-beta/src/workspace/workspace.lua @@ -41,7 +41,7 @@ function m.getIgnoreMatcher() end -- config.workspace.ignoreSubmodules if config.config.workspace.ignoreSubmodules then - local buf = pub.task('loadFile', furi.encode(m.path .. '/.gitmodules')) + local buf = pub.awaitTask('loadFile', furi.encode(m.path .. '/.gitmodules')) if buf then for path in buf:gmatch('path = ([^\r\n]+)') do log.info('Ignore by .gitmodules:', path) @@ -51,7 +51,7 @@ function m.getIgnoreMatcher() end -- config.workspace.useGitIgnore if config.config.workspace.useGitIgnore then - local buf = pub.task('loadFile', furi.encode(m.path .. '/.gitignore')) + local buf = pub.awaitTask('loadFile', furi.encode(m.path .. '/.gitignore')) if buf then for line in buf:gmatch '[^\r\n]+' do log.info('Ignore by .gitignore:', line) @@ -82,8 +82,8 @@ function m.isIgnored(uri) return ignore(path) end ---- 预读工作区内所有文件(异步) -function m.preload() +--- 预读工作区内所有文件 +function m.awaitPreload() if not m.uri then return end @@ -114,7 +114,7 @@ function m.preload() return end max = max + 1 - pub.syncTask('loadFile', uri, function (text) + pub.task('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) |