summaryrefslogtreecommitdiff
path: root/server-beta/src/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-09-24 15:01:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-09-24 15:01:58 +0800
commit80b0ccb95c65a7c50f1dff91e377740b9dcdc8b0 (patch)
tree13bca832ca300abb2fbf004bba3d675b25454357 /server-beta/src/workspace
parentfd94e26e163e40ca0d932b84abc056522e5a049d (diff)
downloadlua-language-server-80b0ccb95c65a7c50f1dff91e377740b9dcdc8b0.zip
预读文件
Diffstat (limited to 'server-beta/src/workspace')
-rw-r--r--server-beta/src/workspace/workspace.lua15
1 files changed, 10 insertions, 5 deletions
diff --git a/server-beta/src/workspace/workspace.lua b/server-beta/src/workspace/workspace.lua
index 1684f224..8368df69 100644
--- a/server-beta/src/workspace/workspace.lua
+++ b/server-beta/src/workspace/workspace.lua
@@ -1,6 +1,7 @@
-local pub = require 'pub'
-local fs = require 'bee.filesystem'
-local furi = require 'file-uri'
+local pub = require 'pub'
+local fs = require 'bee.filesystem'
+local furi = require 'file-uri'
+local files = require 'files'
local m = {}
m.type = 'workspace'
@@ -32,8 +33,12 @@ function m.preload()
end
end
scan(m.uri, function (uri)
- local text = pub.task('loadFile', uri)
- log.debug('Preload file at: ' .. uri, #text)
+ if files.isLua(uri) then
+ pub.syncTask('loadFile', uri, function (text)
+ log.debug('Preload file at: ' .. uri, #text)
+ files.setText(uri, text)
+ end)
+ end
end)
log.info('Preload finish.')
end