Repository navigation
fix(file-explorer): open files in default app - #11268
xianjianlf2 wants to merge 14 commits into
Conversation
Greptile SummaryThis PR adds an "Open in Default App" context-menu action and optional
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/right-sidebar/useFileExplorerKeys.ts | Adds openInDefaultApp keyboard handler for Cmd+Down (macOS). The handler only calls e.preventDefault() when the action succeeds; unlike other shortcuts in this file that always prevent default before acting. |
| src/renderer/src/components/right-sidebar/file-explorer-row-action-visibility.ts | Adds shouldShowOpenInDefaultAppAction guard that blocks for directories, SSH connections, runtime download contexts, and the web client. Clean and consistent with existing guard functions. |
| src/renderer/src/components/right-sidebar/file-explorer-row-context-menu.tsx | Adds the "Open in Default App" menu item with shortcut label, gated by shouldShowOpenInDefaultAppAction. Handler has a defensive second-pass isLocalPathOpenBlocked check at click time. |
| src/renderer/src/components/right-sidebar/file-explorer-row-file-transfer.ts | Adds openFileInDefaultApp that calls window.api.shell.openFilePath and shows a toast on failure or exception. Well-structured and consistent with the existing downloadRemoteFile and copyFileToOsClipboard functions. |
| src/renderer/src/components/right-sidebar/use-file-explorer-node-commands.ts | Adds runtimeDownloadContext param and handleOpenInDefaultApp callback, wiring the action through both shouldShowOpenInDefaultAppAction and isLocalPathOpenBlocked guards before invoking the launcher. |
| src/shared/keybindings.ts | Adds fileExplorer.openInDefaultApp keybinding definition with Mod+ArrowDown on macOS and empty bindings on Linux/Win32. Consistent with the rest of the keybinding definitions. |
| src/renderer/src/components/right-sidebar/FileExplorerRow.actions.test.tsx | New tests cover visibility logic across all combinations (local file, directory, SSH, runtime, web client) and both success/failure paths of openFileInDefaultApp. Coverage looks thorough. |
| src/renderer/src/i18n/locales/es.json | Adds proper Spanish translations for both new i18n keys (error message and menu label). |
Sequence Diagram
sequenceDiagram
participant User
participant FileExplorer as File Explorer (UI)
participant VisibilityGuard as shouldShowOpenInDefaultAppAction
participant LocalGuard as isLocalPathOpenBlocked
participant Transfer as openFileInDefaultApp
participant Shell as window.api.shell.openFilePath
User->>FileExplorer: Right-click local file → "Open in Default App"
FileExplorer->>VisibilityGuard: node, connectionId, runtimeDownloadContext
VisibilityGuard-->>FileExplorer: true (local file, no SSH/runtime/web)
FileExplorer->>LocalGuard: "settings, {connectionId: activeRepo.connectionId}"
LocalGuard-->>FileExplorer: false (not blocked)
FileExplorer->>Transfer: openFileInDefaultApp(node)
Transfer->>Shell: shell.openFilePath(node.path)
Shell-->>Transfer: opened: boolean
alt "opened = false"
Transfer-->>FileExplorer: toast.error(failureMessage)
end
User->>FileExplorer: Cmd+Down (macOS keyboard shortcut)
FileExplorer->>FileExplorer: keybindingMatchesAction('fileExplorer.openInDefaultApp')
FileExplorer->>FileExplorer: handleOpenInDefaultApp(node)
FileExplorer->>VisibilityGuard: node, connectionId, runtimeDownloadContext
VisibilityGuard-->>FileExplorer: true / false
alt visible
FileExplorer->>LocalGuard: "settings, {connectionId}"
LocalGuard-->>FileExplorer: false (not blocked)
FileExplorer->>Transfer: openFileInDefaultApp(node)
Transfer->>Shell: shell.openFilePath(node.path)
end
Reviews (3): Last reviewed commit: "Merge upstream/main into fix/file-explor..." | Re-trigger Greptile
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. ℹ️ Recent review info
Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/renderer/src/components/right-sidebar/FileExplorer.test.tsx (1)
714-725: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover rejected launcher calls.
The current failure test covers only a false return; add a rejected-promise case to exercise
openFileInDefaultApp’s exception handler and verify the error toast.src/renderer/src/components/right-sidebar/FileExplorerRow.tsx (1)
547-564: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated "resolve repo + check blocked path" guard.
This callback duplicates the same
activeWorktree/activeRepolookup andisLocalPathOpenBlockedcheck already inlined in the "Reveal in Finder"onSelecthandler further down in this file. Consider extracting a shared helper (e.g.resolveActiveRepoConnectionId()plus a smallguardLocalPathOpen(node, onAllowed)wrapper) so both call sites share one implementation.♻️ Sketch of a shared helper
+function useActiveRepoConnectionId(activeWorktreeId: string | null): string | null | undefined { + return useAppStore((s) => { + const activeWorktree = Object.values(s.worktreesByRepo) + .flat() + .find((worktree) => worktree.id === activeWorktreeId) + return activeWorktree + ? s.repos.find((repo) => repo.id === activeWorktree.repoId)?.connectionId ?? null + : null + }) +}
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f0306612-72b6-417c-a49d-c32d683213aa
📒 Files selected for processing (11)
src/renderer/src/components/right-sidebar/FileExplorer.test.tsxsrc/renderer/src/components/right-sidebar/FileExplorer.tsxsrc/renderer/src/components/right-sidebar/FileExplorerRow.tsxsrc/renderer/src/components/right-sidebar/useFileExplorerKeys.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/keybindings.test.tssrc/shared/keybindings.ts
…n-default-app # Conflicts: # src/renderer/src/i18n/locales/en.json
|
Synced this branch with latest origin/main and resolved the remaining src/renderer/src/i18n/locales/en.json conflict by keeping both the default-app FileExplorer strings and upstream’s clipboard staging unavailable string. Validation:
Note: local validation completed under Node v22.23.1; this repo warns that it wants Node 24. |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Signed-off-by: MarkXian <mark-xian@foxmail.com>
|
Merged current upstream/main and migrated the default-app file open feature onto the split File Explorer row/action modules.\n\nValidation run locally with Node 24.18.0:\n- pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/right-sidebar/FileExplorerRow.actions.test.tsx src/renderer/src/components/right-sidebar/FileExplorerVirtualRows.row-handlers.test.tsx src/shared/keybindings-default-bindings.test.ts src/shared/keybindings-keyboard-layout.test.ts\n- pnpm lint -- src/renderer/src/components/right-sidebar/FileExplorer.tsx src/renderer/src/components/right-sidebar/FileExplorerRow.tsx src/renderer/src/components/right-sidebar/FileExplorerRow.actions.test.tsx src/renderer/src/components/right-sidebar/FileExplorerVirtualRows.tsx src/renderer/src/components/right-sidebar/FileExplorerFilesTreePane.tsx src/renderer/src/components/right-sidebar/file-explorer-row-action-visibility.ts src/renderer/src/components/right-sidebar/file-explorer-row-context-menu.tsx src/renderer/src/components/right-sidebar/file-explorer-row-file-transfer.ts src/renderer/src/components/right-sidebar/use-file-explorer-node-commands.ts src/renderer/src/components/right-sidebar/use-file-explorer-tree-pane-state.ts src/renderer/src/components/right-sidebar/useFileExplorerKeys.ts src/shared/keybindings.ts src/shared/keybindings-default-bindings.test.ts src/shared/keybindings-keyboard-layout.test.ts\n- git diff --check |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/right-sidebar/file-explorer-row-context-menu.tsx (1)
253-253: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse intent-named localization keys with named placeholders for new strings.
The new file-explorer strings use hash-based keys, and the failure message uses the positional
value0placeholder. Replace them with intent-named keys and a named placeholder such as{{fileName}}, then update the corresponding locale entries.Source: Learnings
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d7752c6b-f962-46a4-99f6-4ba5ee1d2fd7
📒 Files selected for processing (14)
src/renderer/src/components/right-sidebar/FileExplorerRow.actions.test.tsxsrc/renderer/src/components/right-sidebar/file-explorer-row-action-visibility.tssrc/renderer/src/components/right-sidebar/file-explorer-row-context-menu.tsxsrc/renderer/src/components/right-sidebar/file-explorer-row-file-transfer.tssrc/renderer/src/components/right-sidebar/use-file-explorer-node-commands.tssrc/renderer/src/components/right-sidebar/use-file-explorer-tree-pane-state.tssrc/renderer/src/components/right-sidebar/useFileExplorerKeys.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/keybindings-default-bindings.test.tssrc/shared/keybindings.ts
🚧 Files skipped from review as they are similar to previous changes (7)
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/components/right-sidebar/useFileExplorerKeys.ts
- src/shared/keybindings.ts
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/ja.json
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
…pen-default-app # Conflicts: # src/shared/keybindings.ts
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Assisted-by: OpenAI Codex (GPT-6 Astra, autonomous) Signed-off-by: MarkXian <mark-xian@foxmail.com>
Validated focused tests, web typecheck and changed-file oxlint/oxfmt before committing. Assisted-by: OpenAI Codex (GPT-6 Astra, autonomous) Signed-off-by: MarkXian <mark-xian@foxmail.com>
|
Synced with main in 7ef8623 and updated the file-explorer owner and file-client imports to the current APIs. All 51 focused tests, full typechecks, changed-code checks, and desktop/Web JavaScript builds pass. Native macOS compilation is blocked locally by the unaccepted Xcode license; no new manual cross-platform UI validation was performed. AI-assisted update; remote paths remain guarded. |
ELI5
Right-click a file and choose Open in Default App to open it in the app your computer normally uses for that file. You no longer need to find it outside Orca first.
Fixes #11252.
Summary
Open in Default Appitem to local file rows in the file explorer context menushell.openFilePathdefault-app launcher with a failure toastCmd+Downon macOS and leaving Windows/Linux unassigned by defaultVisuals
No persistent visual change. This only adds one file context-menu item when right-clicking a local file.
AI review summary
Test plan
pnpm exec oxfmt --check src/renderer/src/components/right-sidebar/FileExplorer.tsx src/renderer/src/components/right-sidebar/FileExplorerRow.tsx src/renderer/src/components/right-sidebar/useFileExplorerKeys.ts src/renderer/src/components/right-sidebar/FileExplorer.test.tsx src/shared/keybindings.ts src/shared/keybindings.test.tspnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/right-sidebar/FileExplorer.test.tsx src/renderer/src/components/right-sidebar/useFileExplorerKeys.test.ts src/shared/keybindings.test.tspnpm typecheckpnpm lintX handle: not provided.
Readiness review — 2026-09-08
Reviewable. 99 focused tests passed, one platform skip; web typecheck passed. Hidden Electron context menu rendered Open in Default App and Cmd+Down. External launcher was not clicked; action behavior covered by unit tests.
Validated head:
f8261111cb4e8e2cff8051fdcff30830c12e2faa. Updated with main2265fce5912487f6a88ee0827dac14953b6a72c8. Combined branch passed node, CLI, web and mobile typechecks plus 90 focused regression tests. Platform/live checks above remain separate from code checks.Visual proof
After-only hidden Electron capture of the real file context menu: Open in Default App and its shortcut are visible. The external launcher was not clicked; this image proves the menu, not the operating-system launch.
Validation update — 2026-09-16
Resolved the English locale conflict while preserving both default-app labels and upstream platform-specific reveal actions. Existing reviewed branch history and visual proof are retained.
41 focused file-explorer and keybinding tests passed; web typecheck and changed-file oxlint/oxfmt passed.
Validated commit:
6257c75a7c01adaa47c9225efea2e2ca720ad371, synced with upstream07c7606feebc850d8b82c8c85a6a7fda71f29f14. Checks ran on macOS with Node 24. This follow-up did not repeat live SSH, Windows/Linux or rendered Electron validation; prior visual evidence describes the earlier tested state. Full repository build/test suites were not rerun for this focused update.This follow-up was performed autonomously by OpenAI Codex (model: GPT-6 Astra /
gpt-6-astra) for @xianjianlf2, including conflict resolution, code/test updates, verification, and this description. It has not received human line-by-line review.October 8 upstream refresh
Merged current upstream main while retaining its platform-specific reveal actions and immediate directory-toggle behavior. Restored the default-app guard imports, updated the directory-toggle test fixture for runtime ownership, and placed the added shortcut in the existing definition partition with room under the file-size limit. All 50 selected tests across 4 suites, renderer type checking, formatting, and focused lint pass; shortcut tests were rerun after moving the definition. Checks used ORCA_BACKGROUND_LAUNCH=1. Earlier visual proof remains historical; this refresh did not repeat rendered Electron or external-app launch validation. This update was AI-assisted.
October 12 update
Merged current main and adapted default-app launching to the explicit file-owner contract. Remote and unresolved owners are rejected before the OS call; local paths carry the local host ID. The context menu and keyboard action resolve the workspace owner rather than the currently focused server. Preserved the new chat search shortcut.
Validation on macOS: 66 tests across five focused suites, renderer typecheck, changed-file formatting and oxlint passed. Includes three added remote/unresolved-owner regressions. No fresh Electron screenshots, Windows/Linux run, or native application launch in this update. AI-assisted through Codex, with code review of local/SSH/runtime ownership and fail-closed behavior.