(ideType: IdeType)
| 1015 | } |
| 1016 | } |
| 1017 | async function getVSCodeIDECommand(ideType: IdeType): Promise<string | null> { |
| 1018 | const parentExecutable = getVSCodeIDECommandByParentProcess() |
| 1019 | if (parentExecutable) { |
| 1020 | // Verify the parent executable actually exists |
| 1021 | try { |
| 1022 | await getFsImplementation().stat(parentExecutable) |
| 1023 | return parentExecutable |
| 1024 | } catch { |
| 1025 | // Parent executable doesn't exist |
| 1026 | } |
| 1027 | } |
| 1028 | |
| 1029 | // On Windows, explicitly request the .cmd wrapper. VS Code 1.110.0 began |
| 1030 | // prepending the install root (containing Code.exe, the Electron GUI binary) |
| 1031 | // to the integrated terminal's PATH ahead of bin\ (containing code.cmd, the |
| 1032 | // CLI wrapper) when launched via Start-Menu/Taskbar shortcuts. A bare 'code' |
| 1033 | // then resolves to Code.exe via PATHEXT which opens a new editor window |
| 1034 | // instead of running the CLI. Asking for 'code.cmd' forces cross-spawn/which |
| 1035 | // to skip Code.exe. See microsoft/vscode#299416 (fixed in Insiders) and |
| 1036 | // anthropics/claude-code#30975. |
| 1037 | const ext = getPlatform() === 'windows' ? '.cmd' : '' |
| 1038 | switch (ideType) { |
| 1039 | case 'vscode': |
| 1040 | return 'code' + ext |
| 1041 | case 'cursor': |
| 1042 | return 'cursor' + ext |
| 1043 | case 'windsurf': |
| 1044 | return 'windsurf' + ext |
| 1045 | default: |
| 1046 | break |
| 1047 | } |
| 1048 | return null |
| 1049 | } |
| 1050 | |
| 1051 | export async function isCursorInstalled(): Promise<boolean> { |
| 1052 | const result = await execFileNoThrow('cursor', ['--version']) |
no test coverage detected