about summary refs log tree commit diff
path: root/editors/code/src/run.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/run.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/run.ts')
-rw-r--r--editors/code/src/run.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts
index bdd85243133..c20a5487b77 100644
--- a/editors/code/src/run.ts
+++ b/editors/code/src/run.ts
@@ -6,6 +6,7 @@ import * as tasks from "./tasks";
 import { CtxInit } from "./ctx";
 import { makeDebugConfig } from "./debug";
 import { Config, RunnableEnvCfg } from "./config";
+import { unwrapUndefinable } from "./undefinable";
 
 const quickPickButtons = [
     { iconPath: new vscode.ThemeIcon("save"), tooltip: "Save as a launch.json configuration." },
@@ -68,12 +69,14 @@ export async function selectRunnable(
             quickPick.onDidHide(() => close()),
             quickPick.onDidAccept(() => close(quickPick.selectedItems[0])),
             quickPick.onDidTriggerButton(async (_button) => {
-                await makeDebugConfig(ctx, quickPick.activeItems[0].runnable);
+                const runnable = unwrapUndefinable(quickPick.activeItems[0]).runnable;
+                await makeDebugConfig(ctx, runnable);
                 close();
             }),
-            quickPick.onDidChangeActive((active) => {
-                if (showButtons && active.length > 0) {
-                    if (active[0].label.startsWith("cargo")) {
+            quickPick.onDidChangeActive((activeList) => {
+                if (showButtons && activeList.length > 0) {
+                    const active = unwrapUndefinable(activeList[0]);
+                    if (active.label.startsWith("cargo")) {
                         // save button makes no sense for `cargo test` or `cargo check`
                         quickPick.buttons = [];
                     } else if (quickPick.buttons.length === 0) {