Skip to content

Commit

Permalink
Avoid NPE when no severity is supplied in PublishDiagnosticsParams.Di…
Browse files Browse the repository at this point in the history
…agnostic

Per spec https://build-server-protocol.github.io/docs/specification#diagnostic:
```
  /** The diagnostic's severity. Can be omitted. If omitted it is up to the
   * client to interpret diagnostics as error, warning, info or hint. */
  severity?: DiagnosticSeverity;
```
  • Loading branch information
anupc-db committed Sep 26, 2024
1 parent 260e9b9 commit 348f1bf
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ object MetalsEnrichments
val ld = new l.Diagnostic(
diag.getRange.toLsp,
fansi.Str(diag.getMessage, ErrorMode.Strip).plainText,
diag.getSeverity.toLsp,
if (diag.getSeverity == null) l.DiagnosticSeverity.Warning else diag.getSeverity.toLsp,
if (diag.getSource == null) "scalac" else diag.getSource,
)
Option(diag.getCode()).foreach { code =>
Expand Down

0 comments on commit 348f1bf

Please sign in to comment.