summaryrefslogtreecommitdiff
path: root/script/workspace/workspace.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-30 10:34:26 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-30 10:34:26 +0800
commitc2e114ddc035b096baed3931b1a8b6a08458f42e (patch)
tree46f2290d0d5b190f2e0e2fe20a6f844954420f12 /script/workspace/workspace.lua
parent0ad4308d1265ca3100c455df0d9807ff56fded05 (diff)
downloadlua-language-server-c2e114ddc035b096baed3931b1a8b6a08458f42e.zip
fix
Diffstat (limited to 'script/workspace/workspace.lua')
-rw-r--r--script/workspace/workspace.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index cc1155e1..f0ed13e3 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -191,12 +191,16 @@ local function loadFileFactory(root, progress, isLibrary)
progress.max = progress.max + 1
pub.task('loadFile', uri, function (text)
progress.read = progress.read + 1
- log.info(('Preload file at: %s , size = %.3f KB'):format(uri, #text / 1000.0))
- if isLibrary then
- log.info('++++As library of:', root)
- files.setLibraryPath(uri, root)
+ if text then
+ log.info(('Preload file at: %s , size = %.3f KB'):format(uri, #text / 1000.0))
+ if isLibrary then
+ log.info('++++As library of:', root)
+ files.setLibraryPath(uri, root)
+ end
+ files.setText(uri, text)
+ else
+ files.remove(uri)
end
- files.setText(uri, text)
end)
end
end