diff --git a/packages/cli/src/ui/hooks/useLaunchEditor.ts b/packages/cli/src/ui/hooks/useLaunchEditor.ts index 40e869420..da2ff6d9c 100644 --- a/packages/cli/src/ui/hooks/useLaunchEditor.ts +++ b/packages/cli/src/ui/hooks/useLaunchEditor.ts @@ -34,9 +34,11 @@ function getExecutableCommand(editorType: EditorType): string { const commands = process.platform === 'win32' ? commandConfig.win32 : commandConfig.default; - // For editors with multiple commands (like zed), try to find the first available one - // Otherwise, just return the first (and only) command - return commands.find((cmd) => commandExists(cmd)) || commands[0]; + // Try to find the first available command + const availableCommand = commands.find((cmd) => commandExists(cmd)); + + // Return the first available command, or fall back to the last one in the list + return availableCommand || commands[commands.length - 1]; } /** diff --git a/packages/core/src/utils/editor.ts b/packages/core/src/utils/editor.ts index e3f2a90a5..78d8b37fb 100644 --- a/packages/core/src/utils/editor.ts +++ b/packages/core/src/utils/editor.ts @@ -110,9 +110,9 @@ export function getDiffCommand( const commandConfig = editorCommands[editor]; const commands = process.platform === 'win32' ? commandConfig.win32 : commandConfig.default; - // For editors with multiple commands (like zed), try to find the first available one - // Otherwise, just use the first (and only) command - const command = commands.find((cmd) => commandExists(cmd)) || commands[0]; + const command = + commands.slice(0, -1).find((cmd) => commandExists(cmd)) || + commands[commands.length - 1]; switch (editor) { case 'vscode':