revert: restore original editor command fallback logic for zed support

- Revert getExecutableCommand to use original fallback logic
- Revert getDiffCommand to use slice(0, -1) pattern
- Maintain proper support for zed editor with multiple command options ['zed', 'zeditor']
- Keep the caching optimization for commandExists
This commit is contained in:
xwj02155382 2026-01-06 11:09:29 +08:00
parent 94a5d828bd
commit 87dc618a21
2 changed files with 8 additions and 6 deletions

View file

@ -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];
}
/**