mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	lsp: do not process diagnostics for unloaded buffers (#12440)
This commit is contained in:
		| @@ -72,6 +72,17 @@ M['textDocument/publishDiagnostics'] = function(_, _, result) | ||||
|     err_message("LSP.publishDiagnostics: Couldn't find buffer for ", uri) | ||||
|     return | ||||
|   end | ||||
|  | ||||
|   -- Unloaded buffers should not handle diagnostics. | ||||
|   --    When the buffer is loaded, we'll call on_attach, which sends textDocument/didOpen. | ||||
|   --    This should trigger another publish of the diagnostics. | ||||
|   -- | ||||
|   -- In particular, this stops a ton of spam when first starting a server for current | ||||
|   -- unloaded buffers. | ||||
|   if not api.nvim_buf_is_loaded(bufnr) then | ||||
|     return | ||||
|   end | ||||
|  | ||||
|   util.buf_clear_diagnostics(bufnr) | ||||
|  | ||||
|   -- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic | ||||
|   | ||||
		Reference in New Issue
	
	Block a user