feat: Improve editor detection with auto-discovery and better error messages#3155
Merged
Merged
Conversation
- Add GetEditor() utility that checks VISUAL, EDITOR env vars and auto-detects common editors - Support modern editors: VSCode (code), Cursor, Zed, and traditional editors (nvim, vim, nano, vi) - Update /editor and /export commands to use new detection - Provide helpful error message with instructions when no editor found - Support platform-specific defaults (notepad, .cmd extensions on Windows)
affaan-m
force-pushed
the
improve-editor-detection
branch
from
October 13, 2025 23:05
62eaf50 to
4d4640d
Compare
Closed
Collaborator
|
/oc adjust GetEditor so there is never an error returned because it never returns an error so it doesnt need (string, error). Also for the commonEditors array lets reorder a bit, start with: vim, nvim, zed, then put everything else as is but flip the order between nano and vi (so nano should be last). |
Contributor
|
Excellent! The changes have been successfully implemented. Here's a summary of what was done: Changes Made
The function now returns a simple string and never returns an error, making it cleaner to use while maintaining the same functionality for editor detection. |
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
Collaborator
|
thanks @affaan-m! |
xywsxp
pushed a commit
to xywsxp/opencode
that referenced
this pull request
Apr 24, 2026
…essages (anomalyco#3155) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
Rwanbt
pushed a commit
to Rwanbt/opencode
that referenced
this pull request
May 5, 2026
…essages (anomalyco#3155) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
…essages (anomalyco#3155) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
…essages (anomalyco#3155) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
avion23
pushed a commit
to avion23/opencode
that referenced
this pull request
Jun 10, 2026
…essages (anomalyco#3155) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Improves the
/editorcommand UX by automatically detecting available editors and providing helpful error messages when none are found.Changes
Add
GetEditor()utility function inpackages/tui/internal/util/util.go:VISUALenvironment variable first (standard for full-screen editors)EDITORenvironment variablecode), Cursor, Zed, Neovim (nvim), Vim, nano, vi.cmdextensions andnotepad.exeon Windows)Update
/editorcommand (EditorOpenCommand) to use new detectionUpdate
/exportcommand (SessionExportCommand) to use new detectionProvide helpful error message: "No editor found. Set EDITOR environment variable (e.g., export EDITOR=vim)"
Testing
Tested scenarios:
Related Issues
Resolves the issue where users get unhelpful "No EDITOR set" message without guidance on how to fix it.