diff options
author | sumneko <sumneko@hotmail.com> | 2022-01-22 05:11:18 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2022-01-22 05:11:18 +0800 |
commit | 877306a927b098e25853f38ea792dd5ee663bbfd (patch) | |
tree | 3829c4fe0efebef33ee54c364df1def099d8fc5c | |
parent | 66fe2c2eb0d75aee1ec2c21e9967f2eff66d80fc (diff) | |
download | lua-language-server-877306a927b098e25853f38ea792dd5ee663bbfd.zip |
skip loaded files
-rw-r--r-- | script/workspace/loading.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/script/workspace/loading.lua b/script/workspace/loading.lua index 8091cadf..1fcd0d77 100644 --- a/script/workspace/loading.lua +++ b/script/workspace/loading.lua @@ -76,8 +76,13 @@ function mt:loadFile(uri, libraryUri) self.max = self.max + 1 self:update() self._stash[#self._stash+1] = function () - local content = util.loadFile(furi.decode(uri)) self.read = self.read + 1 + if files.getFile(uri) then + files.addRef(uri) + log.info(('Skip loaded file: %s'):format(uri)) + return + end + local content = util.loadFile(furi.decode(uri)) self:update() if not content then return @@ -98,8 +103,13 @@ function mt:loadFile(uri, libraryUri) self.max = self.max + 1 self:update() self._stash[#self._stash+1] = function () - local content = util.loadFile(furi.decode(uri)) self.read = self.read + 1 + if files.getFile(uri) then + files.addRef(uri) + log.info(('Skip loaded file: %s'):format(uri)) + return + end + local content = util.loadFile(furi.decode(uri)) self:update() if not content then return |