WIP: allow using nff as a diagnostics source #1
					 2 changed files with 18 additions and 9 deletions
				
			
		diagnostic: handle mixed indentation diagnostics with severity levels
				commit
				
					
					
						fc8e42c096
					
				
			
		|  | @ -766,16 +766,25 @@ impl StyleAnalyzer { | |||
| 
 | ||||
|         // Check for mixed indentation across the file
 | ||||
|         if has_tabs && has_spaces { | ||||
|             if let Some(preferred) = &config.preferred_indent { | ||||
|                 let range = Range::single_position(Position::new(0, 0)); | ||||
|                 let diagnostic = Diagnostic::new( | ||||
|                     range, | ||||
|             let range = Range::single_position(Position::new(0, 0)); | ||||
|             let (severity, message) = if let Some(preferred) = &config.preferred_indent { | ||||
|                 ( | ||||
|                     DiagnosticSeverity::Information, | ||||
|                     DiagnosticCode::InconsistentIndentation, | ||||
|                     format!("File uses mixed indentation; prefer {}", preferred), | ||||
|                 ); | ||||
|                 diagnostics.push(diagnostic); | ||||
|             } | ||||
|                 ) | ||||
|             } else { | ||||
|                 ( | ||||
|                     DiagnosticSeverity::Warning, | ||||
|                     "File uses mixed indentation (tabs and spaces)".to_string(), | ||||
|                 ) | ||||
|             }; | ||||
|             let diagnostic = Diagnostic::new( | ||||
|                 range, | ||||
|                 severity, | ||||
|                 DiagnosticCode::InconsistentIndentation, | ||||
|                 message, | ||||
|             ); | ||||
|             diagnostics.push(diagnostic); | ||||
|         } | ||||
| 
 | ||||
|         diagnostics | ||||
|  |  | |||
|  | @ -352,7 +352,7 @@ fn process_lint_command( | |||
| 
 | ||||
|     let is_multiple_files = files.len() > 1; | ||||
|     let mut has_errors = false; | ||||
|     
 | ||||
| 
 | ||||
|     for file_path in files { | ||||
|         if let Err(e) = process_single_file_lint( | ||||
|             &file_path, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue