дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
fix(debug): rerun a debug session with its configuration as saved now (#7780)
Rerun in the Debug tool window launched the configuration snapshot the session started with, so VM options edited since were ignored. It now launches the configuration saved under that id, or the snapshot when it was deleted. Closes #7750
Цей коміт міститься в:
1 джерело
766e1edc0c
коміт
1757d26e78
4 files changed
+22
-4
No files matched your search
@@ -168,7 +168,7 @@ it("keeps the RunConfig through debug.startConfig and reruns through its debug p
|
||||
expect(useDebugRunSessions.getState().sessions[0]?.configId).toBe(config.id);
|
||||
await rerunSession(42);
|
||||
expect(ipc.debugStop).toHaveBeenCalledWith(42);
|
||||
expect(restart).toHaveBeenCalledWith(config);
|
||||
expect(restart).toHaveBeenCalledWith({ config, saved: true });
|
||||
} finally {
|
||||
dispose();
|
||||
unregister();
|
||||
@@ -182,7 +182,7 @@ it("reruns a debug service in place without showing the Debug tool window", asyn
|
||||
try {
|
||||
await executeAction("debug.startConfig", config);
|
||||
await rerunSession(42, { show: false });
|
||||
expect(restart).toHaveBeenCalledWith({ config, show: false });
|
||||
expect(restart).toHaveBeenCalledWith({ config, saved: true, show: false });
|
||||
} finally {
|
||||
dispose();
|
||||
unregister();
|
||||
|
||||
@@ -1256,7 +1256,11 @@ export async function rerunSession(id: DebugSessionId, options: { show?: boolean
|
||||
// A session debugged in place from Services reruns there too.
|
||||
const show = options.show ?? (root.inPlace ? false : undefined);
|
||||
if (root.runConfig)
|
||||
await executeAction("run.debugConfig", show === false ? { config: root.runConfig, show: false } : root.runConfig);
|
||||
await executeAction("run.debugConfig", {
|
||||
config: root.runConfig,
|
||||
saved: true,
|
||||
...(show === false ? { show: false } : {}),
|
||||
});
|
||||
else await startSession(launch!, { show });
|
||||
} finally {
|
||||
rerunOf = null;
|
||||
|
||||
@@ -434,7 +434,9 @@ function configFromArg(arg: unknown): RunConfig | undefined {
|
||||
if (typeof arg === "string") return useRun.getState().configs.find((c) => c.id === arg);
|
||||
if (!arg || typeof arg !== "object") return undefined;
|
||||
if ("config" in arg) {
|
||||
const { config, temporary } = arg as { config: RunConfig; temporary?: boolean };
|
||||
const { config, temporary, saved } = arg as { config: RunConfig; temporary?: boolean; saved?: boolean };
|
||||
// `saved`: a rerun launches the configuration as saved now, edited since it started.
|
||||
if (saved) return useRun.getState().configs.find((c) => c.id === config.id) ?? config;
|
||||
return temporary ? adoptTemporary(config) : config;
|
||||
}
|
||||
return arg as RunConfig;
|
||||
|
||||
@@ -638,6 +638,18 @@ describe("remote debugging", () => {
|
||||
await executeAction("run.debugConfig", local.id);
|
||||
expect(startConfig).toHaveBeenCalledWith(local);
|
||||
});
|
||||
|
||||
it("reruns the configuration as saved now, edited since the session started (#7750)", async () => {
|
||||
const started = cfg("app", { debugAdapter: "debugpy" });
|
||||
const edited = { ...started, args: ["main.py", "--verbose"] };
|
||||
useRun.setState({ configs: [edited], loaded: true });
|
||||
await executeAction("run.debugConfig", { config: started, saved: true });
|
||||
expect(startConfig).toHaveBeenCalledWith(edited);
|
||||
// One that was deleted since still reruns as it started.
|
||||
useRun.setState({ configs: [], loaded: true });
|
||||
await executeAction("run.debugConfig", { config: started, saved: true });
|
||||
expect(startConfig).toHaveBeenLastCalledWith(started);
|
||||
});
|
||||
});
|
||||
|
||||
describe("coverage and profiling", () => {
|
||||
|
||||
Reference in new issue
Заблокувати користувача