summaryrefslogtreecommitdiff
path: root/script/workspace
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2022-01-23 02:41:20 +0800
committersumneko <sumneko@hotmail.com>2022-01-23 02:41:20 +0800
commit37760683528051654ceff5026b28462ebc22df7c (patch)
treea8a746ea62875dda2acfca0be0f3c8d9af9bafc0 /script/workspace
parentfecdb2af1ceba45021486d1e28d8e11f490d2b36 (diff)
downloadlua-language-server-37760683528051654ceff5026b28462ebc22df7c.zip
fix
Diffstat (limited to 'script/workspace')
-rw-r--r--script/workspace/loading.lua56
1 files changed, 26 insertions, 30 deletions
diff --git a/script/workspace/loading.lua b/script/workspace/loading.lua
index a54f4504..41aa3537 100644
--- a/script/workspace/loading.lua
+++ b/script/workspace/loading.lua
@@ -81,23 +81,21 @@ function mt:loadFile(uri, libraryUri)
if files.getFile(uri) then
self.read = self.read + 1
self:update()
- self._cache[uri] = true
- files.addRef(uri)
log.info(('Skip loaded file: %s'):format(uri))
- return
- end
- local content = pub.awaitTask('loadFile', furi.decode(uri))
- self.read = self.read + 1
- self:update()
- if not content then
- return
- end
- if self._cache[uri] then
- return
+ else
+ local content = pub.awaitTask('loadFile', furi.decode(uri))
+ if self._cache[uri] then
+ return
+ end
+ self._cache[uri] = true
+ self.read = self.read + 1
+ self:update()
+ if not content then
+ return
+ end
+ log.info(('Preload file at: %s , size = %.3f KB'):format(uri, #content / 1024.0))
+ files.setText(uri, content, false)
end
- log.info(('Preload file at: %s , size = %.3f KB'):format(uri, #content / 1024.0))
- self._cache[uri] = true
- files.setText(uri, content, false)
files.addRef(uri)
if libraryUri then
log.info('++++As library of:', libraryUri)
@@ -112,23 +110,21 @@ function mt:loadFile(uri, libraryUri)
if files.getFile(uri) then
self.read = self.read + 1
self:update()
- self._cache[uri] = true
- files.addRef(uri)
log.info(('Skip loaded file: %s'):format(uri))
- return
- end
- local content = pub.awaitTask('loadFile', furi.decode(uri))
- self.read = self.read + 1
- self:update()
- if not content then
- return
- end
- if self._cache[uri] then
- return
+ else
+ local content = pub.awaitTask('loadFile', furi.decode(uri))
+ if self._cache[uri] then
+ return
+ end
+ self._cache[uri] = true
+ self.read = self.read + 1
+ self:update()
+ if not content then
+ return
+ end
+ log.info(('Preload dll at: %s , size = %.3f KB'):format(uri, #content / 1024.0))
+ files.saveDll(uri, content)
end
- log.info(('Preload dll at: %s , size = %.3f KB'):format(uri, #content / 1024.0))
- self._cache[uri] = true
- files.saveDll(uri, content)
files.addRef(uri)
if libraryUri then
log.info('++++As library of:', libraryUri)