about summary refs log tree commit diff
path: root/editors/code/src/diagnostics.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/diagnostics.ts')
-rw-r--r--editors/code/src/diagnostics.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/editors/code/src/diagnostics.ts b/editors/code/src/diagnostics.ts
index 9695d8bf26d..a7e0845a278 100644
--- a/editors/code/src/diagnostics.ts
+++ b/editors/code/src/diagnostics.ts
@@ -2,6 +2,7 @@ import * as anser from "anser";
 import * as vscode from "vscode";
 import { ProviderResult, Range, TextEditorDecorationType, ThemeColor, window } from "vscode";
 import { Ctx } from "./ctx";
+import { unwrapUndefinable } from "./undefinable";
 
 export const URI_SCHEME = "rust-analyzer-diagnostics-view";
 
@@ -195,7 +196,8 @@ export class AnsiDecorationProvider implements vscode.Disposable {
             // anser won't return both the RGB and the color name at the same time,
             // so just fake a single foreground control char with the palette number:
             const spans = anser.ansiToJson(`\x1b[38;5;${paletteColor}m`);
-            const rgb = spans[1].fg;
+            const span = unwrapUndefinable(spans[1]);
+            const rgb = span.fg;
 
             if (rgb) {
                 return `rgb(${rgb})`;