mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	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.
This commit is contained in:
		@@ -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")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user