diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2021-10-18 10:01:41 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 10:01:41 -0600 |
commit | bcc9ba51faa54f0fd6b1cb0a3f69332971a112a2 (patch) | |
tree | c3bf03916fe4a23d0e748b9bcf865ef24e584a70 /runtime/lua/vim/lsp/diagnostic.lua | |
parent | 389a898586c1ed2c6cd50f3099ff50fe0645f86f (diff) | |
download | rneovim-bcc9ba51faa54f0fd6b1cb0a3f69332971a112a2.tar.gz rneovim-bcc9ba51faa54f0fd6b1cb0a3f69332971a112a2.tar.bz2 rneovim-bcc9ba51faa54f0fd6b1cb0a3f69332971a112a2.zip |
fix(lsp): persist diagnostic config for clients
Persist configuration settings set with `vim.lsp.with` and
`vim.lsp.diagnostic.on_publish_diagnostics` by setting the config for
the namespace associated with the client.
Diffstat (limited to 'runtime/lua/vim/lsp/diagnostic.lua')
-rw-r--r-- | runtime/lua/vim/lsp/diagnostic.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index c6c08a15d3..0e63c0dd29 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -211,9 +211,14 @@ function M.on_publish_diagnostics(_, result, ctx, config) end end end + + -- Persist configuration to ensure buffer reloads use the same + -- configuration. To make lsp.with configuration work (See :help + -- lsp-handler-configuration) + vim.diagnostic.config(config, namespace) end - vim.diagnostic.set(namespace, bufnr, diagnostic_lsp_to_vim(diagnostics, bufnr, client_id), config) + vim.diagnostic.set(namespace, bufnr, diagnostic_lsp_to_vim(diagnostics, bufnr, client_id)) -- Keep old autocmd for back compat. This should eventually be removed. vim.api.nvim_command("doautocmd <nomodeline> User LspDiagnosticsChanged") |