@@ -314,6 +314,8 @@ export let parseCompilerLogOutput = (
314
314
tag : undefined ,
315
315
content : [ ] ,
316
316
} ) ;
317
+ } else if ( line . startsWith ( "#Start(" ) ) {
318
+ // do nothing for now
317
319
} else if ( line . startsWith ( "#Done(" ) ) {
318
320
done = true ;
319
321
} else if ( / ^ + ( [ 0 - 9 ] + | + | \. ) ( │ | ┆ ) / . test ( line ) ) {
@@ -326,6 +328,17 @@ export let parseCompilerLogOutput = (
326
328
// │
327
329
// 10 ┆
328
330
} else if ( line . startsWith ( " " ) ) {
331
+ // part of the actual diagnostics message
332
+ parsedDiagnostics [ parsedDiagnostics . length - 1 ] . content . push (
333
+ line . slice ( 2 )
334
+ ) ;
335
+ } else if ( line . trim ( ) != "" ) {
336
+ // We'll assume that everything else is also part of the diagnostics too.
337
+ // Most of these should have been indented 2 spaces; sadly, some of them
338
+ // aren't (e.g. outcome printer printing badly, and certain old ocaml type
339
+ // messages not printing with indent). We used to get bug reports and fix
340
+ // the messages, but that strategy turned out too slow. One day we should
341
+ // revert to not having this branch...
329
342
parsedDiagnostics [ parsedDiagnostics . length - 1 ] . content . push ( line ) ;
330
343
}
331
344
}
@@ -338,22 +351,14 @@ export let parseCompilerLogOutput = (
338
351
if ( result [ file ] == null ) {
339
352
result [ file ] = [ ] ;
340
353
}
341
- let cleanedUpDiagnostic =
342
- diagnosticMessage
343
- . map ( ( line ) => {
344
- // remove the spaces in front
345
- return line . slice ( 2 ) ;
346
- } )
347
- . join ( "\n" )
348
- // remove start and end whitespaces/newlines
349
- . trim ( ) + "\n" ;
350
354
result [ file ] . push ( {
351
355
severity : parsedDiagnostic . severity ,
352
356
tags : parsedDiagnostic . tag === undefined ? [ ] : [ parsedDiagnostic . tag ] ,
353
357
code : parsedDiagnostic . code ,
354
358
range,
355
359
source : "ReScript" ,
356
- message : cleanedUpDiagnostic ,
360
+ // remove start and end whitespaces/newlines
361
+ message : diagnosticMessage . join ( "\n" ) . trim ( ) + "\n" ,
357
362
} ) ;
358
363
} ) ;
359
364
0 commit comments