diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-02-24 14:51:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-02-24 14:51:57 +0800 |
commit | 5ba257313e9e6398e97476407aea43dd80ab996f (patch) | |
tree | d3569611d711dc726fc1c87090cf178f386fa8ae | |
parent | 6a41f28c76daec6f9bc1f4505ad9e005c5412306 (diff) | |
download | lua-language-server-5ba257313e9e6398e97476407aea43dd80ab996f.zip |
cache globals when loading
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/files.lua | 2 | ||||
-rw-r--r-- | script/vm/getGlobals.lua | 3 |
3 files changed, 6 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md index ce57ea9c..9f5e9816 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ * `NEW` diagnostic: `duplicate-set-field` * `NEW` diagnostic: `no-implicit-any`, disabled by default * `CHG` completion: improve field and table +* `CHG` cache globals when loading * `FIX` diagnositc: may open file with wrong uri case * `FIX` [#406](https://github.com/sumneko/lua-language-server/issues/406) diff --git a/script/files.lua b/script/files.lua index 6dab8a01..fb7487bf 100644 --- a/script/files.lua +++ b/script/files.lua @@ -266,6 +266,7 @@ end --- 移除所有文件 function m.removeAll() + local ws = require 'workspace.workspace' m.globalVersion = m.globalVersion + 1 await.close('files.version') m._pairsCache = nil @@ -278,6 +279,7 @@ function m.removeAll() m.onWatch('remove', uri) end end + ws.flushCache() --m.notifyCache = {} end diff --git a/script/vm/getGlobals.lua b/script/vm/getGlobals.lua index 0c502ecd..75512a75 100644 --- a/script/vm/getGlobals.lua +++ b/script/vm/getGlobals.lua @@ -264,5 +264,8 @@ files.watch(function (ev, uri) end end needUpdateGlobals[uri] = true + elseif ev == 'create' then + getGlobalsOfFile(uri) + getGlobalSetsOfFile(uri) end end) |