on
CC-BY-NC-SA-4.0 Apache-2.0
1 mins
π€ This post includes some LLM-derived content π€
Clearing Language Server Protocol (LSP) diagnostics in Neovim

I've recently started to use vale for providing some editing improvements on my writing - I'll write up about that at a later point.
As part of using Vale, I've had a few cases where Vale has been very angry with some of the pre-written content I'm amending, or on new content.
In some of these cases, I'll disable Vale's language server i.e.
:LspStop vale_ls
Although Vale won't raise new issues, I'll still see all the diagnostic messages that were previously reported.
It turns out that it's possible to also clear the current buffer's diagnostic messages with:
:lua vim.diagnostic.reset(nil, vim.api.nvim_get_current_buf())