From c5cbe159935680f201e90eee73619d79b7eb0ad1 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 9 Feb 2026 13:39:13 -0800 Subject: [PATCH] Fix "Open in editor" to respect worktree path Both openInEditor and the Cmd+O shortcut now use the thread's worktreePath when available instead of always using activeProject.cwd. Co-Authored-By: Claude Opus 4.6 --- apps/web/src/components/ChatView.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 0635064eab5b284120f126eb256621580230164e..0df78d8275df08cd3f8e33da53e6b050cab38b95 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -368,17 +368,19 @@ export default function ChatView() { if (e.key === "o" && (e.metaKey || e.ctrlKey) && !e.shiftKey) { if (api && activeProject) { e.preventDefault(); - void api.shell.openInEditor(activeProject.cwd, lastEditor); + const cwd = activeThread?.worktreePath ?? activeProject.cwd; + void api.shell.openInEditor(cwd, lastEditor); } } }; window.addEventListener("keydown", handler); return () => window.removeEventListener("keydown", handler); - }, [api, activeProject, lastEditor]); + }, [api, activeProject, activeThread, lastEditor]); const openInEditor = (editorId: EditorId) => { if (!api || !activeProject) return; - void api.shell.openInEditor(activeProject.cwd, editorId); + const cwd = activeThread?.worktreePath ?? activeProject.cwd; + void api.shell.openInEditor(cwd, editorId); setLastEditor(editorId); localStorage.setItem(LAST_EDITOR_KEY, editorId); setIsEditorMenuOpen(false); -- 2.54.0