Fix openFileInIDE to respect user's preferred editor#2730
Conversation
The IPC handler was hardcoded to only check for VS Code and PhpStorm, ignoring the user's preferred editor preference. Now reads the preferred editor from user settings and falls back to the first installed editor from the supported editors list.
Tests cover: preferred editor usage, fallback to first installed editor, no editor available, site not found, file not found, priority order, and site-folder-first opening sequence.
📊 Performance Test ResultsComparing 2157bdd vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
Use path.join() for file path assertions and mock winFindEditorPath so exec is called on Windows instead of falling back to shell.openExternal.
epeicher
left a comment
There was a problem hiding this comment.
Thanks @sejas, for solving this! I have tested it, and it works perfectly on Mac. I have tested with VSCode, Cursor, Zed, and PhpStorm, and it opens fine on all of them. On my version of PhpStorm it does not open the folder, but I don't think that's an issue.
On Windows also works fine, but I have identified that VSCode and Cursor open the folder, and when closing them, they open again with only the file. I have recorded a video with that:
CleanShot.2026-03-10.at.09.29.24.mp4
I like the behaviour of opening the file in the proper folder, which works on Mac, but on Windows, it is confusing. Maybe we can add a condition and open the folder only for Mac? What do you think?
katinthehatsite
left a comment
There was a problem hiding this comment.
On macOS, the changes worked as expected for me and I did not see any further regressions. I think we should address Roberto's comments before moving forward 👀
nightnei
left a comment
There was a problem hiding this comment.
LGTM and works as expected 👍
Left only oen comment about adjusting getFirstInstalledEditor
Related issues
Proposed Changes
The
openFileInIDEIPC handler was hardcoded to only check for VS Code and PhpStorm, ignoring the user's preferred editor setting configured in Settings > Preferences.This PR updates the handler to:
getUserEditor()All 8 supported editors (Antigravity, Cursor, VS Code, PhpStorm, Windsurf, WebStorm, Sublime Text, Zed) now work with the "open file in IDE" feature.
Testing Instructions
Apply this diff to test it:
npm startTest on Mac
open-file-editor-mac.mov
Test on Windows
open-file-IDE.mp4
Pre-merge Checklist