Skip to content

Commit

Permalink
Attach explanation message to diagnostic message
Browse files Browse the repository at this point in the history
  • Loading branch information
lwronski committed Jan 30, 2023
1 parent a51b590 commit 18a8a09
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sbt-bridge/src/dotty/tools/xsbt/DelegatingReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ public void doReport(Diagnostic dia, Context ctx) {
StringBuilder rendered = new StringBuilder();
rendered.append(messageAndPos(dia, ctx));
Message message = dia.msg();
StringBuilder messageBuilder = new StringBuilder();
messageBuilder.append(message.message());
String diagnosticCode = String.valueOf(message.errorId().errorNumber());
boolean shouldExplain = Diagnostic.shouldExplain(dia, ctx);
if (shouldExplain && !message.explanation().isEmpty()) {
rendered.append(explanation(message, ctx));
messageBuilder.append(System.lineSeparator()).append(explanation(message, ctx));
}

delegate.log(new Problem(position, message.message(), severity, rendered.toString(), diagnosticCode));
delegate.log(new Problem(position, messageBuilder.toString(), severity, rendered.toString(), diagnosticCode));
}

private static Severity severityOf(int level) {
Expand Down

0 comments on commit 18a8a09

Please sign in to comment.