about summary refs log tree commit diff
path: root/editors/code/src/diagnostics.ts
diff options
context:
space:
mode:
authorTetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com>2023-06-28 04:03:53 +0900
committerTetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com>2023-07-06 16:17:02 +0900
commit72a3883a7128b4eae6f38d6479f33aaaaae4790b (patch)
tree60b9d6f755bbefeca335bcbc10d0832abc719c48 /editors/code/src/diagnostics.ts
parentbb35d8fa8ef9de3c8282602b411c40b266dc3a4e (diff)
downloadrust-72a3883a7128b4eae6f38d6479f33aaaaae4790b.tar.gz
rust-72a3883a7128b4eae6f38d6479f33aaaaae4790b.zip
editor/code: Enable `noUncheckedIndexedAccess` ts option
https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess
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})`;