Skip to content

Commit 3417d06

Browse files
committed
FIX completion: incorrect cache
1 parent 90861b5 commit 3417d06

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 2.5.4
44
* `FIX` [#848](https://github.com/sumneko/lua-language-server/issues/848)
5+
* `FIX` completion: incorrect cache
56

67
## 2.5.3
78
`2021-12-6`

script/core/completion/completion.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,6 +1945,7 @@ local function makeCache(uri, position, results)
19451945
cache.position= position
19461946
cache.word = word:lower()
19471947
cache.length = #word
1948+
cache.uri = uri
19481949
end
19491950

19501951
local function isValidCache(word, result)
@@ -1969,6 +1970,9 @@ local function getCache(uri, position)
19691970
if not cache.results then
19701971
return nil
19711972
end
1973+
if cache.uri ~= uri then
1974+
return nil
1975+
end
19721976
local text = files.getText(uri)
19731977
local state = files.getState(uri)
19741978
local word = lookBackward.findWord(text, guide.positionToOffset(state, position))

0 commit comments

Comments
 (0)