diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-12-15 11:42:11 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-12-15 11:42:11 +0800 |
commit | 3417d0696d8a0c2847c20af6235165221d2a70fd (patch) | |
tree | aa52f47c0e08fc9dace3652af520de42606a251f | |
parent | 90861b509d62c59ee32212ee2dda2d2fb4f04ff1 (diff) | |
download | lua-language-server-3417d0696d8a0c2847c20af6235165221d2a70fd.zip |
`FIX` completion: incorrect cache
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/core/completion/completion.lua | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md index 015c70e5..f4317b92 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## 2.5.4 * `FIX` [#848](https://github.com/sumneko/lua-language-server/issues/848) +* `FIX` completion: incorrect cache ## 2.5.3 `2021-12-6` diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua index cb2ce8dd..efd62fb6 100644 --- a/script/core/completion/completion.lua +++ b/script/core/completion/completion.lua @@ -1945,6 +1945,7 @@ local function makeCache(uri, position, results) cache.position= position cache.word = word:lower() cache.length = #word + cache.uri = uri end local function isValidCache(word, result) @@ -1969,6 +1970,9 @@ local function getCache(uri, position) if not cache.results then return nil end + if cache.uri ~= uri then + return nil + end local text = files.getText(uri) local state = files.getState(uri) local word = lookBackward.findWord(text, guide.positionToOffset(state, position)) |