fix(run): target the selected configuration's run or debug session from the toolbar (#326)

With several sessions running, the toolbar's Rerun and Stop could act on a different configuration than the selected one: when the selected configuration had no matching run session, the widget fell back to the most recently started session of another configuration; and debug sessions did not record the configuration they were started from, so a configuration being debugged never matched and a running npm session took over the buttons.

The widget, Run (Shift+F10) and Stop (Cmd+F2) now target the selected configuration's session, whether it was started with Run or Debug (the most recent when both exist); Rerun of a debug session reruns it in debug. When the selected configuration is not running, the widget offers Run / Debug for it, and Stop remains available for the other running sessions (with a chooser when several are running). Debug sessions keep their originating run configuration. In a focused Run or Debug tool window, Stop still stops the selected tab's process.

Fixes #318
This commit is contained in:
l0ng-ai authored and GitHub committed 2026-10-30 10:51:37 +08:00
1 parent e85ffa2ae8
commit a7b5758f5a
13 files changed
+385 -87

No files matched your search

+3 -1
View File
@@ -102,7 +102,9 @@ export interface JavaAttachTarget {
port: number;
}
export function isJavaAttachTarget(arg: unknown): arg is JavaAttachTarget & { process?: number | null } {
export function isJavaAttachTarget(
arg: unknown,
): arg is JavaAttachTarget & { process?: number | null; runConfig?: RunConfig } {
return !!arg && typeof arg === "object" && "port" in arg && typeof (arg as { port: unknown }).port === "number";
}