Filtering by LSP aka “source”
I like cSpell, but I don’t need a spell checker in my trouble.nvim diagnostics window. This can also be used for other LSPs/sources, but cSpell is the only LSP I want to keep around, just not when I toggle trouble.nvim:
{
"folke/trouble.nvim",
opts = {
modes = {
diagnostics = {
filter = function(items)
return vim.tbl_filter(function(item)
local source = item["item.source"] or (item.item and item.item.source)
return not (source and string.find(string.lower(source), "cspell", 1, true))
end, items)
end,
},
},
}
}