fix(diagnostic): check for sign namespace instead of sign group

This commit is contained in:
Gregory Anders
2023-12-13 09:26:39 -06:00
parent 8122470f83
commit 29d5ff6ac4
2 changed files with 37 additions and 22 deletions

View File

@@ -897,7 +897,7 @@ M.handlers.signs = {
end, end,
hide = function(namespace, bufnr) hide = function(namespace, bufnr)
local ns = M.get_namespace(namespace) local ns = M.get_namespace(namespace)
if ns.user_data.sign_group and api.nvim_buf_is_valid(bufnr) then if ns.user_data.sign_ns and api.nvim_buf_is_valid(bufnr) then
api.nvim_buf_clear_namespace(bufnr, ns.user_data.sign_ns, 0, -1) api.nvim_buf_clear_namespace(bufnr, ns.user_data.sign_ns, 0, -1)
end end
end, end,

View File

@@ -1495,7 +1495,8 @@ end)
]]) ]])
end) end)
it('sets signs', function() it('sets and clears signs #26193 #26555', function()
do
local result = exec_lua [[ local result = exec_lua [[
vim.diagnostic.config({ vim.diagnostic.config({
signs = true, signs = true,
@@ -1521,6 +1522,20 @@ end)
eq({2, 'DiagnosticSignError'}, {result[1].lnum, result[1].name}) eq({2, 'DiagnosticSignError'}, {result[1].lnum, result[1].name})
eq({4, 'DiagnosticSignWarn'}, {result[2].lnum, result[2].name}) eq({4, 'DiagnosticSignWarn'}, {result[2].lnum, result[2].name})
end
do
local result = exec_lua [[
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {})
local ns = vim.diagnostic.get_namespace(diagnostic_ns)
local sign_ns = ns.user_data.sign_ns
return vim.api.nvim_buf_get_extmarks(diagnostic_bufnr, sign_ns, 0, -1, {type ='sign', details = true})
]]
eq({}, result)
end
end) end)
end) end)