fix(vcs): open the GitHub sign-in terminal from the Get from Version Control window

The window never provided the embedded terminal, so Add account… failed with
"The terminal is not available in this window." It now loads the terminal on
first use, as the Settings window does.
Цей коміт міститься в:
l0ng-ai committed 2026-12-04 15:08:34 +08:00
1 джерело b16d485f35
коміт 678b2555b8
2 files changed
+29 -1

No files matched your search

+17
Переглянути файл
@@ -0,0 +1,17 @@
import { describe, expect, it, vi } from "vitest";
import { bootCloneWindow } from "./cloneWindowBoot";
import { embeddedTerminal } from "./workbench/contributions";
vi.mock("./features/app/locale", () => ({ installLocaleSync: () => () => {} }));
vi.mock("./features/settings/runtime", () => ({ trackRuntimeSettings: () => () => {} }));
vi.mock("./workbench/dialogWindow", () => ({ activateDialogWindow: () => () => {} }));
vi.mock("./features/github/clone/source", () => ({ githubCloneSource: { id: "github" } }));
vi.mock("./features/vcs/cloneWindow", () => ({ activateCloneLaunches: () => () => {}, CloneWindow: () => null }));
describe("bootCloneWindow", () => {
it("provides the embedded terminal the GitHub Sign In dialog needs", () => {
expect(embeddedTerminal()).toBeUndefined();
bootCloneWindow("main");
expect(embeddedTerminal()).toBeTypeOf("function");
});
});
+12 -1
Переглянути файл
@@ -3,15 +3,26 @@ import { installLocaleSync } from "./features/app/locale";
import { githubCloneSource } from "./features/github/clone/source";
import { trackRuntimeSettings } from "./features/settings/runtime";
import { activateCloneLaunches, CloneWindow } from "./features/vcs/cloneWindow";
import { registerCloneSource } from "./workbench/contributions";
import { provideEmbeddedTerminal, registerCloneSource } from "./workbench/contributions";
import { activateDialogWindow } from "./workbench/dialogWindow";
import { activateList } from "./windowBoot";
/** The embedded terminal of the GitHub Sign In dialog, loaded on first use. */
function embeddedTerminal(): () => void {
provideEmbeddedTerminal(async (host, options) =>
(await import("./features/terminal/loader"))
.loadTerminalRuntime()
.then((rt) => rt.createEmbeddedTerminal(host, options)),
);
return () => provideEmbeddedTerminal(undefined);
}
/** Get from VCS window of project window `parent`: the clone dialog and its sources, no workbench. */
export function bootCloneWindow(parent: string): ComponentType {
activateList("clone window", [
["locale", installLocaleSync],
["settings", trackRuntimeSettings],
["terminal", embeddedTerminal],
["github", () => registerCloneSource(githubCloneSource)],
["dialog", () => activateDialogWindow(parent)],
["launch", activateCloneLaunches],