From 23739c90c7a40acdaeef5210e4fc374e4f013c09 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Wed, 18 Nov 2026 16:39:53 +0800 Subject: [PATCH] fix(run): Run starts another instance of a configuration that allows multiple instances (#4187) run.run reran the selected configuration's running session even with Allow multiple instances, stopping the process. As in IDEA (Rerun/Stop only for configurations that don't run in parallel), such a configuration keeps Run/Debug in the toolbar and Run starts another instance; a tab's Rerun still restarts its session. Fixes #4148 --- src/features/run/RunWidget.test.tsx | 10 ++++++++++ src/features/run/RunWidget.tsx | 2 +- src/features/run/index.ts | 6 +++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/features/run/RunWidget.test.tsx b/src/features/run/RunWidget.test.tsx index 985352e64..411dc4aca 100644 --- a/src/features/run/RunWidget.test.tsx +++ b/src/features/run/RunWidget.test.tsx @@ -116,6 +116,16 @@ it("reruns and stops the selected configuration among several running sessions", expect(useRun.getState().sessions.map((s) => !!s.stopped)).toEqual([true, false]); }); +it("offers Run for another instance of a running configuration that allows multiple instances", () => { + const parallel = { ...app, allowParallel: true }; + useRun.setState({ configs: [parallel, npm], sessions: [run(parallel)] }); + render(); + expect(screen.getByRole("button", { name: `Run '${app.name}'` })).toBeTruthy(); + expect(screen.getByRole("button", { name: `Debug '${app.name}'` })).toBeTruthy(); + expect(screen.queryByRole("button", { name: /Rerun/ })).toBeNull(); + expect(screen.getByRole("button", { name: `Stop '${app.name}'` })).toBeTruthy(); +}); + it("offers Run/Debug for an idle selection and Stop for the other process", () => { useRun.setState({ sessions: [run(npm)] }); render(); diff --git a/src/features/run/RunWidget.tsx b/src/features/run/RunWidget.tsx index c87b18e00..770dd915e 100644 --- a/src/features/run/RunWidget.tsx +++ b/src/features/run/RunWidget.tsx @@ -110,7 +110,7 @@ export function RunWidget() { /> )} - ) : active ? ( + ) : active && !selected?.allowParallel ? ( <> {target?.paused && (