diff options
-rw-r--r-- | changelog.md | 3 | ||||
-rw-r--r-- | script/workspace/loading.lua | 13 | ||||
-rw-r--r-- | script/workspace/workspace.lua | 1 |
3 files changed, 10 insertions, 7 deletions
diff --git a/changelog.md b/changelog.md index c2e1860e..d7bbca8c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # changelog +## 2.6.3 +* `FIX` new files are not loaded correctly + ## 2.6.2 `2022-1-25` * `FIX` [#925](https://github.com/sumneko/lua-language-server/issues/925) diff --git a/script/workspace/loading.lua b/script/workspace/loading.lua index 5fc5a134..12683a23 100644 --- a/script/workspace/loading.lua +++ b/script/workspace/loading.lua @@ -81,13 +81,15 @@ function mt:loadFile(uri, libraryUri) if files.getFile(uri) then self.read = self.read + 1 self:update() + files.addRef(uri) + self._cache[uri] = true log.info(('Skip loaded file: %s'):format(uri)) else local content = pub.awaitTask('loadFile', furi.decode(uri)) self.read = self.read + 1 self:update() - if self._cache[uri] then - return + if not self._cache[uri] then + files.addRef(uri) end self._cache[uri] = true if not content then @@ -96,7 +98,6 @@ function mt:loadFile(uri, libraryUri) log.info(('Preload file at: %s , size = %.3f KB'):format(uri, #content / 1024.0)) files.setText(uri, content, false) end - files.addRef(uri) if libraryUri then log.info('++++As library of:', libraryUri) end @@ -109,13 +110,14 @@ function mt:loadFile(uri, libraryUri) if files.getFile(uri) then self.read = self.read + 1 self:update() + files.addRef(uri) log.info(('Skip loaded file: %s'):format(uri)) else local content = pub.awaitTask('loadFile', furi.decode(uri)) self.read = self.read + 1 self:update() - if self._cache[uri] then - return + if not self._cache[uri] then + files.addRef(uri) end self._cache[uri] = true if not content then @@ -124,7 +126,6 @@ function mt:loadFile(uri, libraryUri) log.info(('Preload dll at: %s , size = %.3f KB'):format(uri, #content / 1024.0)) files.saveDll(uri, content) end - files.addRef(uri) if libraryUri then log.info('++++As library of:', libraryUri) end diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index e8a61665..ad28d76b 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -228,7 +228,6 @@ function m.awaitLoadFile(uri) log.info('Scan files at:', uri) ---@async native:scan(furi.decode(uri), function (path) - files.remove(furi.encode(path)) ld:loadFile(furi.encode(path)) end) ld:loadAll() |