Skip to content

Commit

Permalink
fix(jsii): missing context on "Message" diagnostics (#1298)
Browse files Browse the repository at this point in the history
The context (source file with wiggly lines) was not shown for
diagnostics using the `Message` category. This removes the special
case so that context is always rendered, which ensures a better
experience overall.
  • Loading branch information
RomainMuller committed Feb 28, 2020
1 parent e23d0fb commit c44f5f3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/jsii/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ export function logDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {
getNewLine: () => ts.sys.newLine,
};

const message = diagnostic.category === ts.DiagnosticCategory.Message && typeof diagnostic.messageText === 'string'
? diagnostic.messageText
: diagnostic.file
? ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost)
: ts.formatDiagnostics([diagnostic], formatDiagnosticsHost);
const message = diagnostic.file != null
? ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost)
: ts.formatDiagnostics([diagnostic], formatDiagnosticsHost);

const logFunc = diagnosticsLogger(log4js.getLogger(DIAGNOSTICS), diagnostic);
if (!logFunc) { return; }
Expand Down

0 comments on commit c44f5f3

Please sign in to comment.