Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Add Zed editor support across open-in flow

Julius Marminge4a08686e749c
diff --git a/apps/server/src/open.test.ts b/apps/server/src/open.test.ts
index 1889c8515..3a55bde85 100644
--- a/apps/server/src/open.test.ts
+++ b/apps/server/src/open.test.ts
@@ -33,6 +33,15 @@ describe("resolveEditorLaunch", () => {
command: "code",
args: ["/tmp/workspace"],
});
+
+ const zedLaunch = yield* resolveEditorLaunch(
+ { cwd: "/tmp/workspace", editor: "zed" },
+ "darwin",
+ );
+ assert.deepEqual(zedLaunch, {
+ command: "zed",
+ args: ["/tmp/workspace"],
+ });
}),
);
@@ -64,6 +73,15 @@ describe("resolveEditorLaunch", () => {
command: "code",
args: ["--goto", "/tmp/workspace/src/open.ts:71:5"],
});
+
+ const zedLineAndColumn = yield* resolveEditorLaunch(
+ { cwd: "/tmp/workspace/src/open.ts:71:5", editor: "zed" },
+ "darwin",
+ );
+ assert.deepEqual(zedLineAndColumn, {
+ command: "zed",
+ args: ["/tmp/workspace/src/open.ts:71:5"],
+ });
}),
);
diff --git a/apps/web/src/components/BranchToolbar.tsx b/apps/web/src/components/BranchToolbar.tsx
index 6d9e92ac6..422ec8038 100644
--- a/apps/web/src/components/BranchToolbar.tsx
+++ b/apps/web/src/components/BranchToolbar.tsx
@@ -1,6 +1,6 @@
import type { GitBranch, ThreadId } from "@t3tools/contracts";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { useOptimistic, useState } from "react";
+import { startTransition, useOptimistic, useState } from "react";
import { newCommandId } from "../lib/utils";
import {
@@ -80,6 +80,11 @@ export default function BranchToolbar({
canonicalActiveBranch,
(_currentBranch: string | null, optimisticBranch: string | null) => optimisticBranch,
);
+ const setOptimisticBranchInTransition = (branch: string | null) => {
+ startTransition(() => {
+ setOptimisticBranch(branch);
+ });
+ };
const branchNames = branches.map((branch) => branch.name);
const branchByName = new Map(branches.map((branch) => [branch.name, branch]));
const trimmedBranchQuery = branchQuery.trim();
@@ -172,7 +177,7 @@ export default function BranchToolbar({
const selectedBranchName = branch.isRemote
? deriveLocalBranchNameFromRemoteRef(branch.name)
: branch.name;
- setOptimisticBranch(selectedBranchName);
+ setOptimisticBranchInTransition(selectedBranchName);
checkoutMutation.mutate(branch.name, {
onSuccess: async () => {
@@ -184,13 +189,13 @@ export default function BranchToolbar({
nextBranchName = status.branch;
}
}
- setOptimisticBranch(nextBranchName);
+ setOptimisticBranchInTransition(nextBranchName);
setThreadBranch(nextBranchName, activeWorktreePath);
setIsBranchMenuOpen(false);
onComposerFocusRequest?.();
},
onError: (error) => {
- setOptimisticBranch(canonicalActiveBranch);
+ setOptimisticBranchInTransition(canonicalActiveBranch);
setThreadError(error instanceof Error ? error.message : "Failed to checkout branch.");
setIsBranchMenuOpen(true);
},
@@ -201,10 +206,10 @@ export default function BranchToolbar({
const name = rawName.trim();
const api = readNativeApi();
if (!api || !activeThreadId || !branchCwd || !name || createBranchMutation.isPending) return;
- setOptimisticBranch(name);
+ setOptimisticBranchInTransition(name);
createBranchMutation.mutate(name, {
onSuccess: () => {
- setOptimisticBranch(name);
+ setOptimisticBranchInTransition(name);
setThreadError(null);
setThreadBranch(name, activeWorktreePath);
setBranchQuery("");
@@ -212,7 +217,7 @@ export default function BranchToolbar({
onComposerFocusRequest?.();
},
onError: (error) => {
- setOptimisticBranch(canonicalActiveBranch);
+ setOptimisticBranchInTransition(canonicalActiveBranch);
setThreadError(error instanceof Error ? error.message : "Failed to create branch.");
},
});
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index a651adf43..f6a6142f5 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -100,7 +100,7 @@ import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "./u
import { Separator } from "./ui/separator";
import { Group, GroupSeparator } from "./ui/group";
import { Menu, MenuItem, MenuPopup, MenuShortcut, MenuTrigger } from "./ui/menu";
-import { CursorIcon, Icon, VisualStudioCode } from "./Icons";
+import { CursorIcon, Icon, VisualStudioCode, Zed } from "./Icons";
import { cn, isMacPlatform, isWindowsPlatform } from "~/lib/utils";
import { Badge } from "./ui/badge";
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
@@ -3693,6 +3693,11 @@ const OpenInPicker = memo(function OpenInPicker({
Icon: VisualStudioCode,
value: "vscode",
},
+ {
+ label: "Zed",
+ Icon: Zed,
+ value: "zed",
+ },
{
label: isMacPlatform(navigator.platform)
? "Finder"
diff --git a/apps/web/src/components/Icons.tsx b/apps/web/src/components/Icons.tsx
index 1bac0fddf..c74d785cd 100644
--- a/apps/web/src/components/Icons.tsx
+++ b/apps/web/src/components/Icons.tsx
@@ -119,3 +119,26 @@ export const VisualStudioCode: Icon = (props) => {
</svg>
);
};
+
+export const Zed: Icon = (props) => {
+ const id = useId();
+ const clipPathId = `${id}-zed-logo-a`;
+
+ return (
+ <svg {...props} fill="none" viewBox="0 0 96 96">
+ <g clipPath={`url(#${clipPathId})`}>
+ <path
+ fill="currentColor"
+ fillRule="evenodd"
+ d="M9 6a3 3 0 0 0-3 3v66H0V9a9 9 0 0 1 9-9h80.379c4.009 0 6.016 4.847 3.182 7.682L43.055 57.187H57V51h6v7.688a4.5 4.5 0 0 1-4.5 4.5H37.055L26.743 73.5H73.5V36h6v37.5a6 6 0 0 1-6 6H20.743L10.243 90H87a3 3 0 0 0 3-3V21h6v66a9 9 0 0 1-9 9H6.621c-4.009 0-6.016-4.847-3.182-7.682L52.757 39H39v6h-6v-7.5a4.5 4.5 0 0 1 4.5-4.5h21.257l10.5-10.5H22.5V60h-6V22.5a6 6 0 0 1 6-6h52.757L85.757 6H9Z"
+ clipRule="evenodd"
+ />
+ </g>
+ <defs>
+ <clipPath id={clipPathId}>
+ <path fill="#fff" d="M0 0h96v96H0z" />
+ </clipPath>
+ </defs>
+ </svg>
+ );
+};
diff --git a/packages/contracts/src/editor.ts b/packages/contracts/src/editor.ts
index 14f61a896..8d7e02923 100644
--- a/packages/contracts/src/editor.ts
+++ b/packages/contracts/src/editor.ts
@@ -4,6 +4,7 @@ import { TrimmedNonEmptyString } from "./baseSchemas";
export const EDITORS = [
{ id: "cursor", label: "Cursor", command: "cursor" },
{ id: "vscode", label: "VS Code", command: "code" },
+ { id: "zed", label: "Zed", command: "zed" },
{ id: "file-manager", label: "File Manager", command: null },
] as const;