From 3417d0696d8a0c2847c20af6235165221d2a70fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 15 Dec 2021 11:42:11 +0800 Subject: `FIX` completion: incorrect cache --- changelog.md | 1 + script/core/completion/completion.lua | 4 ++++ 2 files changed, 5 insertions(+) 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)) -- cgit v1.2.3