From 5f2c9b127bc381c1cea217d8bbf078a229c03f26 Mon Sep 17 00:00:00 2001 From: Kamil Podsiadlo Date: Tue, 21 Jun 2022 07:09:34 +0200 Subject: [PATCH] fix: do not fail when stripping ansi codes --- .../scala/scala/meta/internal/metals/MetalsEnrichments.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metals/src/main/scala/scala/meta/internal/metals/MetalsEnrichments.scala b/metals/src/main/scala/scala/meta/internal/metals/MetalsEnrichments.scala index f5108952782..012a1109021 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/MetalsEnrichments.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/MetalsEnrichments.scala @@ -46,6 +46,7 @@ import scala.meta.io.AbsolutePath import scala.meta.io.RelativePath import ch.epfl.scala.{bsp4j => b} +import fansi.ErrorMode import io.undertow.server.HttpServerExchange import org.eclipse.lsp4j.TextDocumentIdentifier import org.eclipse.{lsp4j => l} @@ -751,7 +752,7 @@ object MetalsEnrichments def toLSP: l.Diagnostic = new l.Diagnostic( diag.getRange.toLSP, - fansi.Str(diag.getMessage).plainText, + fansi.Str(diag.getMessage, ErrorMode.Strip).plainText, diag.getSeverity.toLSP, if (diag.getSource == null) "scalac" else diag.getSource // We omit diag.getCode since Bloop's BSP implementation uses 'code' with different semantics