Skip to content

feat(desktop): add "Open in Editor" action for worktrees#2999

Merged
saddlepaddle merged 1 commit into
mainfrom
saddlepaddle/ribbon-industry
Mar 30, 2026
Merged

feat(desktop): add "Open in Editor" action for worktrees#2999
saddlepaddle merged 1 commit into
mainfrom
saddlepaddle/ribbon-industry

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Mar 30, 2026

Summary

  • Adds an "Open in Editor" context menu item to worktrees in both the sidebar (WorkspaceContextMenu) and the all-workspaces list view (WorkspaceRow)
  • Uses the existing openFileInEditor tRPC mutation which resolves the user's configured default editor (project-level first, then global fallback)
  • Positioned between "Open in Finder" and "Copy Path" in the sidebar context menu

Test plan

  • Right-click a worktree in the sidebar → verify "Open in Editor" appears between "Open in Finder" and "Copy Path"
  • Click "Open in Editor" → verify it opens the worktree directory in the configured default editor
  • Right-click a worktree in the all-workspaces list view → verify "Open in Editor" appears
  • Test with no default editor configured → verify it falls back to shell.openPath

Summary by cubic

Adds an "Open in Editor" action to worktree context menus so you can jump into your editor from the sidebar and All Workspaces view. Uses the configured default editor (project-level first, then global).

  • New Features
    • Added "Open in Editor" to WorkspaceContextMenu and WorkspaceRow context menus; sits between "Open in Finder" and "Copy Path" in the sidebar.
    • Calls electronTrpc.external.openFileInEditor to open the worktree path; shows a toast on errors.

Written for commit 547c928. Summary will update on new commits.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added "Open in Editor" context menu option for workspaces, enabling quick access to open workspaces directly in your editor.
    • Integrated error notifications to alert users if the action fails.

Add an "Open in Editor" context menu item to worktrees in both the
sidebar and the all-workspaces list view. Uses the existing
openFileInEditor tRPC mutation which resolves the user's configured
default editor (project-level, then global fallback).
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

These changes add an "Open in Editor" feature to workspace context menus in the desktop renderer. New context menu items with external link icons are introduced, connected to handlers that invoke an Electron RPC mutation to open workspace files in an editor, with error toast notifications.

Changes

Cohort / File(s) Summary
Context Menu Component Enhancement
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceContextMenu.tsx
Added onOpenInEditor callback prop to interface and component signature. Introduced new context menu item labeled "Open in Editor" with LuExternalLink icon that triggers the callback.
Workspace Features Implementation
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx, apps/desktop/src/renderer/screens/main/components/WorkspacesListView/WorkspaceRow/WorkspaceRow.tsx
Added openFileInEditor RPC mutation hooks with error handling that displays toast notifications. Implemented handleOpenInEditor handlers that conditionally invoke the mutation using workspace path and project ID, wired to WorkspaceContextMenu component.

Sequence Diagram

sequenceDiagram
    participant User
    participant ContextMenu as Context Menu UI
    participant Handler as Handler<br/>(handleOpenInEditor)
    participant RPC as RPC Mutation<br/>(openFileInEditor)
    participant Editor as Editor/System

    User->>ContextMenu: Click "Open in Editor"
    ContextMenu->>Handler: onOpenInEditor()
    Handler->>RPC: mutate({ path, projectId })
    alt Success
        RPC->>Editor: Open file in editor
        Editor-->>User: Editor window opens
    else Error
        RPC-->>Handler: Error returned
        Handler-->>User: Toast notification with error
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 With paws on the menu, a click rings true,
"Open in Editor"—a feature so new!
Through RPC tunnels the workspace takes flight,
Into editor windows, gleaming and bright! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding an "Open in Editor" action for worktrees across the desktop application.
Description check ✅ Passed The description includes a summary of changes, implementation details, and a comprehensive test plan, covering the main sections required by the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch saddlepaddle/ribbon-industry

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspacesListView/WorkspaceRow/WorkspaceRow.tsx (1)

44-56: Consider disabling the menu item when worktreePath is unavailable.

The handler silently no-ops when workspace.worktreePath is falsy, but the menu item remains enabled. For better UX, consider disabling the menu item when the path is unavailable, consistent with how canDelete disables the delete action.

💡 Suggested improvement
 <ContextMenuItem
   onSelect={handleOpenInEditor}
+  disabled={!workspace.worktreePath}
 >
   <LuExternalLink
     className="size-4 mr-2"
     strokeWidth={STROKE_WIDTH}
   />
   Open in Editor
 </ContextMenuItem>

Also applies to: 211-217

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/screens/main/components/WorkspacesListView/WorkspaceRow/WorkspaceRow.tsx`
around lines 44 - 56, The "Open in editor" menu item should be disabled when
workspace.worktreePath is falsy: update the menu rendering that currently calls
handleOpenInEditor (which uses openFileInEditor.mutate) to add a disabled prop
tied to !workspace.worktreePath (similar to how canDelete is used for delete).
Locate the code around WorkspaceRow where handleOpenInEditor and
openFileInEditor are defined and mirror that change for the other occurrence
later in the file (the second "Open in editor" menu item), ensuring the UI
disables the action when workspace.worktreePath is unavailable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspacesListView/WorkspaceRow/WorkspaceRow.tsx`:
- Around line 44-56: The "Open in editor" menu item should be disabled when
workspace.worktreePath is falsy: update the menu rendering that currently calls
handleOpenInEditor (which uses openFileInEditor.mutate) to add a disabled prop
tied to !workspace.worktreePath (similar to how canDelete is used for delete).
Locate the code around WorkspaceRow where handleOpenInEditor and
openFileInEditor are defined and mirror that change for the other occurrence
later in the file (the second "Open in editor" menu item), ensuring the UI
disables the action when workspace.worktreePath is unavailable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4526ead9-f9f8-469e-8fd6-e481c560e6dc

📥 Commits

Reviewing files that changed from the base of the PR and between d360a3d and 547c928.

📒 Files selected for processing (3)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceContextMenu.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspacesListView/WorkspaceRow/WorkspaceRow.tsx

@saddlepaddle saddlepaddle merged commit 28d58d6 into main Mar 30, 2026
6 of 7 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant