Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai 115a436d80 fix(debugger): replace a finished Debug tab when a prepared start begins
A start that builds first (Maven/Gradle compile, classpath resolution) added its
tab right away but dropped finished sessions only once the adapter started, so
the previous run's terminated tab stayed next to the new one during the build.
2026-11-15 11:15:01 +08:00
2 змінених файлів з 21 додано та 0 видалено

No files matched your search

+19
Переглянути файл
@@ -218,3 +218,22 @@ it("releases a failed shared drain so a later start can retry", async () => {
expect(await startSession(config("launch"))).toBe(42);
expect(ipc.debugStart).toHaveBeenCalledOnce();
});
it("replaces finished tabs as soon as a prepared start begins", async () => {
await startSession(config("launch"));
handleDebugEvent(42, { kind: "terminated" });
expect(useDebug.getState().sessions[42]?.status).toBe("terminated");
let finishBuild!: () => void;
const build = new Promise<void>((resolve) => (finishBuild = resolve));
ipc.debugStart.mockResolvedValueOnce({ status: "ok", data: 43 });
const started = startPreparedSession({ id: "java", name: "Java" } as never, async () => {
await build;
return config("launch");
});
const preparing = Object.values(useDebug.getState().sessions);
expect(preparing).toHaveLength(1);
expect(preparing[0]).toMatchObject({ name: "Java", status: "starting" });
finishBuild();
await expect(started).resolves.toBe(43);
expect(Object.keys(useDebug.getState().sessions)).toEqual(["43"]);
});
+2
Переглянути файл
@@ -670,6 +670,8 @@ export async function startPreparedSession(
const id = --preparationSeq as DebugSessionId;
const controller = new AbortController();
preparations.set(id, controller);
// The new tab takes the place of finished ones while its build runs, not once the adapter starts.
dropFinished();
useDebug.setState((s) => ({
sessions: {
...s.sessions,