@@ -21,7 +21,7 @@ type FormattingOptions struct {
2121}
2222
2323const (
24- foregroundColorEscapeGrey = "\u001b [90m"
24+ ForegroundColorEscapeGrey = "\u001b [90m"
2525 foregroundColorEscapeRed = "\u001b [91m"
2626 foregroundColorEscapeYellow = "\u001b [93m"
2727 foregroundColorEscapeBlue = "\u001b [94m"
@@ -39,7 +39,6 @@ func FormatDiagnosticsWithColorAndContext(output io.Writer, diags []*ast.Diagnos
3939 if len (diags ) == 0 {
4040 return
4141 }
42-
4342 for i , diagnostic := range diags {
4443 if i > 0 {
4544 fmt .Fprint (output , formatOpts .NewLine )
@@ -57,7 +56,7 @@ func FormatDiagnosticWithColorAndContext(output io.Writer, diagnostic *ast.Diagn
5756 }
5857
5958 writeWithStyleAndReset (output , diagnostic .Category ().Name (), getCategoryFormat (diagnostic .Category ()))
60- fmt .Fprintf (output , "%s TS%d: %s" , foregroundColorEscapeGrey , diagnostic .Code (), resetEscapeSequence )
59+ fmt .Fprintf (output , "%s TS%d: %s" , ForegroundColorEscapeGrey , diagnostic .Code (), resetEscapeSequence )
6160 WriteFlattenedDiagnosticMessage (output , diagnostic , formatOpts .NewLine )
6261
6362 if diagnostic .File () != nil && diagnostic .Code () != diagnostics .File_appears_to_be_binary .Code () {
@@ -199,7 +198,7 @@ func getCategoryFormat(category diagnostics.Category) string {
199198 case diagnostics .CategoryWarning :
200199 return foregroundColorEscapeYellow
201200 case diagnostics .CategorySuggestion :
202- return foregroundColorEscapeGrey
201+ return ForegroundColorEscapeGrey
203202 case diagnostics .CategoryMessage :
204203 return foregroundColorEscapeBlue
205204 }
@@ -362,7 +361,7 @@ func prettyPathForFileError(file *ast.SourceFile, fileErrors []*ast.Diagnostic,
362361 }
363362 return fmt .Sprintf ("%s%s:%d%s" ,
364363 fileName ,
365- foregroundColorEscapeGrey ,
364+ ForegroundColorEscapeGrey ,
366365 line + 1 ,
367366 resetEscapeSequence ,
368367 )
@@ -386,3 +385,15 @@ func WriteFormatDiagnostic(output io.Writer, diagnostic *ast.Diagnostic, formatO
386385 WriteFlattenedDiagnosticMessage (output , diagnostic , formatOpts .NewLine )
387386 fmt .Fprint (output , formatOpts .NewLine )
388387}
388+
389+ func FormatDiagnosticsStatusWithColorAndTime (output io.Writer , time string , diag * ast.Diagnostic , formatOpts * FormattingOptions ) {
390+ fmt .Fprint (output , "[" )
391+ writeWithStyleAndReset (output , time , ForegroundColorEscapeGrey )
392+ fmt .Fprint (output , "] " )
393+ WriteFlattenedDiagnosticMessage (output , diag , formatOpts .NewLine )
394+ }
395+
396+ func FormatDiagnosticsStatusAndTime (output io.Writer , time string , diag * ast.Diagnostic , formatOpts * FormattingOptions ) {
397+ fmt .Fprint (output , time , " - " )
398+ WriteFlattenedDiagnosticMessage (output , diag , formatOpts .NewLine )
399+ }
0 commit comments