(theme: ThemeName)
| 77 | return platform() === 'darwin' && env.terminal === 'Apple_Terminal' || env.terminal === 'vscode' || env.terminal === 'cursor' || env.terminal === 'windsurf' || env.terminal === 'alacritty' || env.terminal === 'zed'; |
| 78 | } |
| 79 | export async function setupTerminal(theme: ThemeName): Promise<string> { |
| 80 | let result = ''; |
| 81 | switch (env.terminal) { |
| 82 | case 'Apple_Terminal': |
| 83 | result = await enableOptionAsMetaForTerminal(theme); |
| 84 | break; |
| 85 | case 'vscode': |
| 86 | result = await installBindingsForVSCodeTerminal('VSCode', theme); |
| 87 | break; |
| 88 | case 'cursor': |
| 89 | result = await installBindingsForVSCodeTerminal('Cursor', theme); |
| 90 | break; |
| 91 | case 'windsurf': |
| 92 | result = await installBindingsForVSCodeTerminal('Windsurf', theme); |
| 93 | break; |
| 94 | case 'alacritty': |
| 95 | result = await installBindingsForAlacritty(theme); |
| 96 | break; |
| 97 | case 'zed': |
| 98 | result = await installBindingsForZed(theme); |
| 99 | break; |
| 100 | case null: |
| 101 | break; |
| 102 | } |
| 103 | saveGlobalConfig(current => { |
| 104 | if (['vscode', 'cursor', 'windsurf', 'alacritty', 'zed'].includes(env.terminal ?? '')) { |
| 105 | if (current.shiftEnterKeyBindingInstalled === true) return current; |
| 106 | return { |
| 107 | ...current, |
| 108 | shiftEnterKeyBindingInstalled: true |
| 109 | }; |
| 110 | } else if (env.terminal === 'Apple_Terminal') { |
| 111 | if (current.optionAsMetaKeyInstalled === true) return current; |
| 112 | return { |
| 113 | ...current, |
| 114 | optionAsMetaKeyInstalled: true |
| 115 | }; |
| 116 | } |
| 117 | return current; |
| 118 | }); |
| 119 | maybeMarkProjectOnboardingComplete(); |
| 120 | |
| 121 | // Install shell completions (ant-only, since the completion command is ant-only) |
| 122 | if ("external" === 'ant') { |
| 123 | result += await setupShellCompletion(theme); |
| 124 | } |
| 125 | return result; |
| 126 | } |
| 127 | export function isShiftEnterKeyBindingInstalled(): boolean { |
| 128 | return getGlobalConfig().shiftEnterKeyBindingInstalled === true; |
| 129 | } |
no test coverage detected