From 534353ada7e26ba3987609d326c291c5247b6b38 Mon Sep 17 00:00:00 2001 From: Ryan-the-zilla Date: Wed, 18 Mar 2026 20:52:28 +0000 Subject: [PATCH] fix(debugger): update Working Directory and Environment Variables when switching templates When switching debug configuration templates in LaunchConfigModal, the Working Directory and Environment Variables fields now properly update to reflect the newly selected template's defaults instead of retaining their previous values. Fixes #33199 Wallet: AqE264DnKyJci9kV4t3eYhDtFB3H88HQusWtH5odSqHM --- src/components/debugger/LaunchConfigModal.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/debugger/LaunchConfigModal.tsx b/src/components/debugger/LaunchConfigModal.tsx index 9aaa80f7..22157b5a 100644 --- a/src/components/debugger/LaunchConfigModal.tsx +++ b/src/components/debugger/LaunchConfigModal.tsx @@ -1,4 +1,4 @@ -import { createSignal, For, Show } from "solid-js"; +import { createSignal, createEffect, For, Show } from "solid-js"; import { DebugSessionConfig } from "@/context/DebugContext"; import { useTasks } from "@/context/TasksContext"; import { Icon } from "../ui/Icon"; @@ -66,6 +66,20 @@ export function LaunchConfigModal(props: LaunchConfigModalProps) { const [preLaunchTask, setPreLaunchTask] = createSignal(""); const [postDebugTask, setPostDebugTask] = createSignal(""); + // Update form fields when template changes to reflect template defaults + createEffect(() => { + const template = selectedTemplate(); + if (template) { + // Reset working directory and environment variables to template defaults + setCwd(template.defaults.cwd || ""); + setEnv(template.defaults.env + ? Object.entries(template.defaults.env).map(([k, v]) => `${k}=${v}`).join("\n") + : "" + ); + setStopOnEntry(template.defaults.stopOnEntry ?? false); + } + }); + const handleLaunch = () => { const template = selectedTemplate(); if (!template) return;