Skip to content

Commit 738ce83

Browse files
Strip colors before matching preview diagnostics
1 parent c3e4bc3 commit 738ce83

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

editors/code/src/client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as anser from "anser";
12
import * as lc from "vscode-languageclient/node";
23
import * as vscode from "vscode";
34
import * as ra from "../src/lsp_ext";
@@ -139,9 +140,10 @@ export async function createClient(
139140
?.rendered;
140141
if (rendered) {
141142
if (preview) {
143+
const decolorized = anser.ansiToText(rendered);
142144
const index =
143-
rendered.match(/^(note|help):/m)?.index || rendered.length;
144-
diag.message = rendered
145+
decolorized.match(/^(note|help):/m)?.index || rendered.length;
146+
diag.message = decolorized
145147
.substring(0, index)
146148
.replace(/^ -->[^\n]+\n/m, "");
147149
}

0 commit comments

Comments
 (0)