The handler isn’t the part that generates the diagnostics, but instead it is the function which is called if a language server sends diagnostics to the client.
You’d have to call the existing diagnostic handler with a fake lsp- client
┌───────────────────────┐ ┌──────────┐
│ lsp.handlers │◄──────────────────────────│lsp server│
│ on_publishDiagnostics│ (diagnostics result) └──────────┘
└───────────────────────┘ commnication via
nvim lsp client / rpc
There are already some options you can check out that allow you to use Vale via the vim.lsp.diagnostic interface
- GitHub - jose-elias-alvarez/null-ls.nvim: Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
- GitHub - mattn/efm-langserver: General purpose Language Server
- GitHub - iamcco/diagnostic-languageserver: diagnostic language server integrate with linters
- GitHub - mfussenegger/nvim-lint: An asynchronous linter plugin for Neovim (>= 0.5) complementary to the built-in Language Server Protocol support.