({
ide,
onComplete,
}: IdeIntegrationNudgeProps)
| 24 | } |
| 25 | |
| 26 | export function IdeIntegrationNudge({ |
| 27 | ide, |
| 28 | onComplete, |
| 29 | }: IdeIntegrationNudgeProps) { |
| 30 | useKeypress( |
| 31 | (key) => { |
| 32 | if (key.name === 'escape') { |
| 33 | onComplete({ |
| 34 | userSelection: 'no', |
| 35 | isExtensionPreInstalled: false, |
| 36 | }); |
| 37 | } |
| 38 | }, |
| 39 | { isActive: true }, |
| 40 | ); |
| 41 | |
| 42 | const { displayName: ideName } = getIdeInfo(ide); |
| 43 | // Assume extension is already installed if the env variables are set. |
| 44 | const isExtensionPreInstalled = |
| 45 | !!process.env['ANUS_CLI_IDE_SERVER_PORT'] && |
| 46 | !!process.env['ANUS_CLI_IDE_WORKSPACE_PATH']; |
| 47 | |
| 48 | const OPTIONS: Array<RadioSelectItem<IdeIntegrationNudgeResult>> = [ |
| 49 | { |
| 50 | label: 'Yes', |
| 51 | value: { |
| 52 | userSelection: 'yes', |
| 53 | isExtensionPreInstalled, |
| 54 | }, |
| 55 | }, |
| 56 | { |
| 57 | label: 'No (esc)', |
| 58 | value: { |
| 59 | userSelection: 'no', |
| 60 | isExtensionPreInstalled, |
| 61 | }, |
| 62 | }, |
| 63 | { |
| 64 | label: "No, don't ask again", |
| 65 | value: { |
| 66 | userSelection: 'dismiss', |
| 67 | isExtensionPreInstalled, |
| 68 | }, |
| 69 | }, |
| 70 | ]; |
| 71 | |
| 72 | const installText = isExtensionPreInstalled |
| 73 | ? `If you select Yes, the CLI will have access to your open files and display diffs directly in ${ |
| 74 | ideName ?? 'your editor' |
| 75 | }.` |
| 76 | : `If you select Yes, we'll install an extension that allows the CLI to access your open files and display diffs directly in ${ |
| 77 | ideName ?? 'your editor' |
| 78 | }.`; |
| 79 | |
| 80 | return ( |
| 81 | <Box |
| 82 | flexDirection="column" |
| 83 | borderStyle="round" |
nothing calls this directly
no test coverage detected