From 678b2555b8aa9bcd3f0ba54e17cda561760c28ee Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Fri, 4 Dec 2026 15:08:34 +0800 Subject: [PATCH] fix(vcs): open the GitHub sign-in terminal from the Get from Version Control window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/cloneWindowBoot.test.ts | 17 +++++++++++++++++ src/cloneWindowBoot.ts | 13 ++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/cloneWindowBoot.test.ts diff --git a/src/cloneWindowBoot.test.ts b/src/cloneWindowBoot.test.ts new file mode 100644 index 0000000000..d5b5cdb60d --- /dev/null +++ b/src/cloneWindowBoot.test.ts @@ -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"); + }); +}); diff --git a/src/cloneWindowBoot.ts b/src/cloneWindowBoot.ts index 7e1bd3cd20..a615ba7aa2 100644 --- a/src/cloneWindowBoot.ts +++ b/src/cloneWindowBoot.ts @@ -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],