How do I disable diagnostics from a single LSP server?

Can I disable all diagnostics for a single LSP server in Neovim?


I have an LSP (Pyright) which does basic linting, which overlaps with other plugins I have that provide more thorough linting. Unfortunately Pyright doesn’t have a setting for disabling basic linting…

I use pyright and ruff-lsp. Pyrigt is really harder to configure. So I disable overlapping rules for ruff-lsp via ruff.toml. Rules - Ruff. As far as I remember in flake8, you can also fine-tune the rules.

I don’t use Pyright but I use solargraph for which I had to turn of certain rules and I followed these

lsp.configure('solargraph', {
  on_init = function(client)
    client.server_capabilities.documentFormattingProvider = false
    client.server_capabilities.documentFormattingRangeProvider = false
  end,
})

The idea here I believe is to figure out the corresponding server_capabilities and disable them.

I have combined this with null-ls to provide formatting via null-ls.

Hope this gives you some direction to proceed.