The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.
TypeScript code-editorcross-platformdapdatabase-clientdebuggerdesktop-appdeveloper-toolsgithttp-clientideintellijlsprusttauriterminal
fix(github): make Change Repository or Account… work before a repository is connected (#1492)
l0ng-ai3025b274f5c3
diff --git a/src/features/github/index.ts b/src/features/github/index.tsindex 526c07631..433aa314c 100644--- a/src/features/github/index.ts+++ b/src/features/github/index.ts@@ -144,8 +144,9 @@ function actions(): Action[] {id: "github.changeRepository",title: "Change Repository or Account…",category: "GitHub",- when: CONNECTED,- run: () => changeRepository(),+ when: WHEN,+ // Not connected yet: the tool window offers the repository selector, or explains how to log in.+ run: () => (useGhRepository.getState().connection ? changeRepository() : void showPullRequests()),},{// pull.request.select.actiondiff --git a/src/features/github/toolwindow/toolwindow.test.tsx b/src/features/github/toolwindow/toolwindow.test.tsxindex 269dee84f..fd40645f4 100644--- a/src/features/github/toolwindow/toolwindow.test.tsx+++ b/src/features/github/toolwindow/toolwindow.test.tsx@@ -3,7 +3,7 @@ import { act, render, screen } from "@testing-library/react";import { getAction } from "@/platform/actions";import { getContext } from "@/platform/context";import * as ipc from "@/platform/ipc";-import { useContributions } from "@/workbench/contributions";+import { provideToolWindowService, useContributions, type ToolWindowService } from "@/workbench/contributions";import { activate } from "../index";import { setCurrentRepository } from "../api/client";import type { GHRepository, GHUser } from "../api/types";@@ -114,6 +114,14 @@ describe("tool window", () => {expect(getAction(id), id).toBeDefined();});+ it("opens the tool window for Change Repository or Account while not connected", async () => {+ const show = vi.fn();+ provideToolWindowService({ show } as unknown as ToolWindowService);+ useGhRepository.setState({ availability: { kind: "notInstalled" } });+ await getAction("github.changeRepository")!.run({ arg: undefined, ctx: { projectOpen: true } });+ expect(show).toHaveBeenCalledWith("pullRequests", true);+ });+it("shows gh's state when it is not ready", () => {useGhRepository.setState({ availability: { kind: "notInstalled" } });render(<PullRequestsToolWindow />);