-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
In guess.js, the detection logic assumes that if an editor app is running, its CLI is available:
// Find editor by exact match.
if (processList.includes(processName)) {
return [COMMON_EDITORS_MACOS[processName]] // ← Returns 'cursor' without verification
}In the case of many VSCode forks, such as Cursor IDE or Windsurf, the consumer may not have their CLI installed, instead using the VSCode command that they are used to.
Steps to Reproduce
- Install Cursor IDE app (but don't install the CLI command)
- Have Cursor app running
- Use
launch-editor(e.g., through Vite dev server's/__open-in-editorendpoint) guessEditordetects Cursor process and returns['cursor']childProcess.spawn('cursor', ...)fails withENOENT: spawn cursor ENOENT- Error shown to user with no fallback to VS Code or other available editors
Could not open index.tsx in the editor.
The editor process exited with an error: spawn cursor ENOENT ('cursor' command does not exist in 'PATH').Proposed Solution
Add CLI verification and fall back to common editors when detected ones fail:
// Try detected running editors first
if (processList.includes(processName)) {
const editorBin = COMMON_EDITORS_MACOS[processName]
// check if CLI is installed, alternatively, check if it's a fork somehow?
}
// use fallback if CLI is not installedQuestions
- Would you accept a PR for this fix? I'd be happy to look into it.
- Are there existing test conventions I should follow?
Workaround
Users can set LAUNCH_EDITOR=code to bypass the detection and use VS Code directly.
Environment
- OS: macOS
- Node.js: v22.14
- launch-editor: uses the package from a middleware in vite
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels