@@ -314,6 +314,8 @@ export let parseCompilerLogOutput = (
314314 tag : undefined ,
315315 content : [ ] ,
316316 } ) ;
317+ } else if ( line . startsWith ( "#Start(" ) ) {
318+ // do nothing for now
317319 } else if ( line . startsWith ( "#Done(" ) ) {
318320 done = true ;
319321 } else if ( / ^ + ( [ 0 - 9 ] + | + | \. ) ( │ | ┆ ) / . test ( line ) ) {
@@ -326,6 +328,17 @@ export let parseCompilerLogOutput = (
326328 // │
327329 // 10 ┆
328330 } 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...
329342 parsedDiagnostics [ parsedDiagnostics . length - 1 ] . content . push ( line ) ;
330343 }
331344 }
@@ -338,22 +351,14 @@ export let parseCompilerLogOutput = (
338351 if ( result [ file ] == null ) {
339352 result [ file ] = [ ] ;
340353 }
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" ;
350354 result [ file ] . push ( {
351355 severity : parsedDiagnostic . severity ,
352356 tags : parsedDiagnostic . tag === undefined ? [ ] : [ parsedDiagnostic . tag ] ,
353357 code : parsedDiagnostic . code ,
354358 range,
355359 source : "ReScript" ,
356- message : cleanedUpDiagnostic ,
360+ // remove start and end whitespaces/newlines
361+ message : diagnosticMessage . join ( "\n" ) . trim ( ) + "\n" ,
357362 } ) ;
358363 } ) ;
359364
0 commit comments