@@ -25,18 +25,33 @@ pub async fn output_result(
2525
2626 let mut has_error = false ;
2727 let mut count = 0 ;
28+ let mut error_count = 0 ;
29+ let mut warning_count = 0 ;
30+ let mut info_count = 0 ;
31+ let mut hint_count = 0 ;
32+
2833 while let Some ( ( file_id, diagnostics) ) = receiver. recv ( ) . await {
2934 count += 1 ;
3035 if let Some ( diagnostics) = diagnostics {
3136 for diagnostic in & diagnostics {
32- if diagnostic. severity == Some ( lsp_types:: DiagnosticSeverity :: ERROR ) {
33- has_error = true ;
34- break ;
35- } else if warnings_as_errors
36- && diagnostic. severity == Some ( lsp_types:: DiagnosticSeverity :: WARNING )
37- {
38- has_error = true ;
39- break ;
37+ match diagnostic. severity {
38+ Some ( lsp_types:: DiagnosticSeverity :: ERROR ) => {
39+ has_error = true ;
40+ error_count += 1 ;
41+ }
42+ Some ( lsp_types:: DiagnosticSeverity :: WARNING ) => {
43+ if warnings_as_errors {
44+ has_error = true ;
45+ }
46+ warning_count += 1 ;
47+ }
48+ Some ( lsp_types:: DiagnosticSeverity :: INFORMATION ) => {
49+ info_count += 1 ;
50+ }
51+ Some ( lsp_types:: DiagnosticSeverity :: HINT ) => {
52+ hint_count += 1 ;
53+ }
54+ _ => { }
4055 }
4156 }
4257 writer. write ( db, file_id, diagnostics) ;
@@ -49,6 +64,21 @@ pub async fn output_result(
4964
5065 writer. finish ( ) ;
5166
67+ if output_format == OutputFormat :: Text {
68+ if error_count > 0 {
69+ println ! ( "Errors: {}" , error_count) ;
70+ }
71+ if warning_count > 0 {
72+ println ! ( "Warnings: {}" , warning_count) ;
73+ }
74+ if info_count > 0 {
75+ println ! ( "Information: {}" , info_count) ;
76+ }
77+ if hint_count > 0 {
78+ println ! ( "Hints: {}" , hint_count) ;
79+ }
80+ }
81+
5282 if has_error {
5383 1
5484 } else {
0 commit comments