diff --git a/packages/cli/src/ui/hooks/useLaunchEditor.ts b/packages/cli/src/ui/hooks/useLaunchEditor.ts index d3aeb1837..f4c79e384 100644 --- a/packages/cli/src/ui/hooks/useLaunchEditor.ts +++ b/packages/cli/src/ui/hooks/useLaunchEditor.ts @@ -7,28 +7,10 @@ import { useCallback } from 'react'; import { useStdin } from 'ink'; import type { EditorType } from '@qwen-code/qwen-code-core'; +import { editorCommands } from '@qwen-code/qwen-code-core'; import { spawnSync, execSync } from 'child_process'; import { useSettings } from '../contexts/SettingsContext.js'; -/** - * Editor command configurations for different platforms. - * Each editor can have multiple possible command names, listed in order of preference. - */ -const editorCommands: Record< - EditorType, - { win32: string[]; default: string[] } -> = { - vscode: { win32: ['code.cmd'], default: ['code'] }, - vscodium: { win32: ['codium.cmd'], default: ['codium'] }, - windsurf: { win32: ['windsurf'], default: ['windsurf'] }, - cursor: { win32: ['cursor'], default: ['cursor'] }, - vim: { win32: ['vim'], default: ['vim'] }, - neovim: { win32: ['nvim'], default: ['nvim'] }, - zed: { win32: ['zed'], default: ['zed', 'zeditor'] }, - emacs: { win32: ['emacs.exe'], default: ['emacs'] }, - trae: { win32: ['trae'], default: ['trae'] }, -}; - /** * Cache for command existence checks to avoid repeated execSync calls. */ diff --git a/packages/core/src/utils/editor.ts b/packages/core/src/utils/editor.ts index b63289250..f64351ee5 100644 --- a/packages/core/src/utils/editor.ts +++ b/packages/core/src/utils/editor.ts @@ -52,7 +52,7 @@ function commandExists(cmd: string): boolean { * Editor command configurations for different platforms. * Each editor can have multiple possible command names, listed in order of preference. */ -const editorCommands: Record< +export const editorCommands: Record< EditorType, { win32: string[]; default: string[] } > = {