mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
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
This commit is contained in:
@@ -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(<RunWidget />);
|
||||
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(<RunWidget />);
|
||||
|
||||
@@ -110,7 +110,7 @@ export function RunWidget() {
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
) : active ? (
|
||||
) : active && !selected?.allowParallel ? (
|
||||
<>
|
||||
{target?.paused && (
|
||||
<IconButton
|
||||
|
||||
@@ -157,7 +157,11 @@ async function runSelected() {
|
||||
useRun.setState({ chooserOpen: true, chooserMode: "run" });
|
||||
return;
|
||||
}
|
||||
const target = selectedTarget(config.id, useRun.getState().sessions, useDebugRunSessions.getState().sessions);
|
||||
// As in IDEA, Run starts another instance of a configuration that allows multiple instances;
|
||||
// otherwise it restarts the running one.
|
||||
const target = config.allowParallel
|
||||
? null
|
||||
: selectedTarget(config.id, useRun.getState().sessions, useDebugRunSessions.getState().sessions);
|
||||
if (target) {
|
||||
target.rerun?.();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user