fix(picker): only show extmark errors when debug is enabled. Closes #988

This commit is contained in:
Folke Lemaitre 2025-02-07 11:39:45 +01:00
parent 5af04ab667
commit f6d9af7410
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 3 additions and 8 deletions

View file

@ -399,6 +399,7 @@ local defaults = {
explorer = false, -- show explorer debug info
files = false, -- show file debug info
grep = false, -- show file debug info
extmarks = false, -- show extmarks errors
},
}

View file

@ -524,14 +524,8 @@ function M:_render(item, row)
extmark.row = nil
extmark.field = nil
local ok, err = pcall(vim.api.nvim_buf_set_extmark, self.win.buf, ns, row - 1, col, extmark)
if not ok then
Snacks.notify.error(
"Failed to set extmark. This should not happen. Please report.\n"
.. err
.. "\n```lua\n"
.. vim.inspect(extmark)
.. "\n```"
)
if not ok and self.picker.opts.debug.extmarks then
Snacks.notify.error("Failed to set extmark.\n" .. err .. "\n```lua\n" .. vim.inspect(extmark) .. "\n```")
end
end
end