mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(diagnostic): assert that diagnostics have line number and column (#16687)
Line number and column are required and much of the diagnostic API assumes that these are both present. When one of the two is missing, cryptic errors pop up in other parts of the diagnostic subsystem. Instead, assert that diagnostics are well formed when they are entered into the cache, which provides a clearer error.
This commit is contained in:
		![41898282+github-actions[bot]@users.noreply.github.com](/assets/img/avatar_default.png) github-actions[bot]
					github-actions[bot]
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							8c6a4fab66
						
					
				
				
					commit
					9dae939b1f
				
			| @@ -272,6 +272,8 @@ end | ||||
| ---@private | ||||
| local function set_diagnostic_cache(namespace, bufnr, diagnostics) | ||||
|   for _, diagnostic in ipairs(diagnostics) do | ||||
|     assert(diagnostic.lnum, "Diagnostic line number is required") | ||||
|     assert(diagnostic.col, "Diagnostic column is required") | ||||
|     diagnostic.severity = diagnostic.severity and to_severity(diagnostic.severity) or M.severity.ERROR | ||||
|     diagnostic.end_lnum = diagnostic.end_lnum or diagnostic.lnum | ||||
|     diagnostic.end_col = diagnostic.end_col or diagnostic.col | ||||
|   | ||||
		Reference in New Issue
	
	Block a user