Clearing Language Server Protocol (LSP) diagnostics in Neovim

Featured image for sharing metadata for article

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())

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #neovim.

πŸ€– Content in this blog post (prose or code snippets) includes code derived from the following LLMs:

  • gpt:4.1

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.