mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 00:18:33 +00:00
fix(diagnostic): remove invalid buffers from cache (#16397)
Errors were being caused by invalid buffers being kept around in diagnostic_cache, so add a metatable to diagnostic_cache which attaches to new buffers in the cache, removing them after they are invalidated. Closes #16391. Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
This commit is contained in:
@@ -343,6 +343,16 @@ describe('vim.diagnostic', function()
|
||||
eq(0, result[5])
|
||||
eq(3, result[6])
|
||||
end)
|
||||
|
||||
it("doesn't error after bwipeout on buffer", function()
|
||||
exec_lua [[
|
||||
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { lnum = 0, end_lnum = 0, col = 0, end_col = 0 })
|
||||
vim.cmd("bwipeout! " .. diagnostic_bufnr)
|
||||
|
||||
vim.diagnostic.show(diagnostic_ns)
|
||||
vim.diagnostic.hide(diagnostic_ns)
|
||||
]]
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('enable() and disable()', function()
|
||||
@@ -629,6 +639,15 @@ describe('vim.diagnostic', function()
|
||||
]])
|
||||
|
||||
end)
|
||||
|
||||
it("doesn't error after bwipeout called on buffer", function()
|
||||
exec_lua [[
|
||||
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { lnum = 0, end_lnum = 0, col = 0, end_col = 0 })
|
||||
vim.cmd("bwipeout! " .. diagnostic_bufnr)
|
||||
|
||||
vim.diagnostic.reset(diagnostic_ns)
|
||||
]]
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('get_next_pos()', function()
|
||||
|
Reference in New Issue
Block a user