feat(editor): add system editor option from VISUAL/EDITOR#1102

closed3
main
GitHub fork: fix/issue-1068-system-editor-env
openedMar 15, 2026byBbinbandit
View on GitHubTwo-way sync enabledPR last imported 20d ago

Summary

  • add a System Editor picker option backed by VISUAL/EDITOR
  • preserve quoted executable paths and known-editor --goto behavior for env-based launches
  • pass VISUAL and EDITOR through Turbo so the server actually sees them in dev/start flows

Why

Issue #1068 asks for one extra editor option sourced from standard shell editor env vars instead of hardcoding more editors one by one.

The implementation also needs to account for this repo's Turbo setup: without forwarding VISUAL/EDITOR, the feature can pass unit tests while failing in real bun run dev / start flows because the server process never receives those env vars.

Changes

  • add a shared system-editor id so the existing picker and IPC flow can expose one extra editor choice without widening the protocol shape
  • resolve VISUAL first, then EDITOR, parsing quoted commands and flags without breaking executable paths that include spaces
  • reuse known editor launch behavior when the env command resolves to VS Code or Cursor, so --goto still works for line/column targets
  • only surface system-editor when the resolved command is actually available
  • add the picker entry in the web UI
  • forward VISUAL and EDITOR through turbo.json

Validation

  • bun run --cwd apps/server test src/open.test.ts
  • bun fmt
  • bun lint
  • bun typecheck

Closes #1068.

Note

Add 'system-editor' option that resolves the editor from VISUAL/EDITOR environment variables

  • Adds system-editor as a recognized editor id in editor.ts with no fixed command, and surfaces it as a "System Editor" option in the OpenInPicker when available.
  • resolveAvailableEditors in open.ts resolves the system editor command from VISUAL or EDITOR env vars (in that order) and checks availability with isCommandAvailable.
  • On launch, the resolved command is matched against known editors so that --goto line/column behavior is reused when the command maps to a known editor (e.g. code).
  • Quoted executable paths (e.g. Windows paths with spaces) are preserved via a new splitCommandString helper.
  • EDITOR and VISUAL are added to the Turborepo global env passthrough in turbo.json.

Macroscope summarized b2a2804.

Added 1 commit

  • feat(editor): add system editor option from VISUAL/EDITOR00d3085
Synced from GitHub

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c452e4ce-b7b2-4fb9-9580-a35b2bf2afa3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

apps/web/src/components/chat/OpenInPicker.tsxlines 35–39Outdated · 00d3085Open thread
……@@ -32,6 +32,11 @@ const resolveOptions = (platform: string, availableEditors: ReadonlyArray<Editor
36+ label: "System Editor",
37+ Icon: AppWindowIcon,
38+ value: "system-editor",
39+ },
NNoojunoon lines 35–39Mar 15, 2026

Maybe we want this to be conditionally shown, only if it is an editor that we don't already show here? Might be a bit of extra complexity but would be a nice UX touch.

Added 2 commits

  • Merge upstream/main into fix/issue-1068-system-editor-env5c02c95
  • Merge upstream/main into fix/issue-1068-system-editor-envb2a2804

Closing as part of an open-PR triage — duplicate of #1301, and both predate the editor-subsystem rework on main (#2659, #2475, #1974), so neither rebases cleanly anymore. A fresh take against current main would be welcome. Thanks!