feat(diagnostic): add enabled filter (#33981)

This commit is contained in:
Maria José Solano
2025-05-13 21:32:00 -05:00
committed by GitHub
parent 40b64e9100
commit 4fae013a21
4 changed files with 46 additions and 0 deletions

View File

@@ -1531,6 +1531,29 @@ describe('vim.diagnostic', function()
end)
)
end)
it('allows filtering by enablement', function()
eq(
{ 3, 1, 2 },
exec_lua(function()
vim.diagnostic.set(_G.diagnostic_ns, _G.diagnostic_bufnr, {
_G.make_error('Error 1', 1, 1, 1, 5),
})
vim.diagnostic.set(_G.other_ns, _G.diagnostic_bufnr, {
_G.make_error('Error 2', 1, 1, 1, 5),
_G.make_error('Error 3', 3, 1, 3, 5),
})
vim.diagnostic.enable(false, { ns_id = _G.other_ns })
return {
#vim.diagnostic.get(_G.diagnostic_bufnr),
#vim.diagnostic.get(_G.diagnostic_bufnr, { enabled = true }),
#vim.diagnostic.get(_G.diagnostic_bufnr, { enabled = false }),
}
end)
)
end)
end)
describe('count', function()