Switch from useInput to useKeypress. (#6056)

This commit is contained in:
Jacob Richman
2025-08-12 14:05:49 -07:00
committed by GitHub
parent 74fd0841d0
commit d219f90132
19 changed files with 350 additions and 259 deletions

View File

@@ -5,11 +5,12 @@
*/
import { DetectedIde, getIdeInfo } from '@google/gemini-cli-core';
import { Box, Text, useInput } from 'ink';
import { Box, Text } from 'ink';
import {
RadioButtonSelect,
RadioSelectItem,
} from './components/shared/RadioButtonSelect.js';
import { useKeypress } from './hooks/useKeypress.js';
export type IdeIntegrationNudgeResult = {
userSelection: 'yes' | 'no' | 'dismiss';
@@ -25,14 +26,17 @@ export function IdeIntegrationNudge({
ide,
onComplete,
}: IdeIntegrationNudgeProps) {
useInput((_input, key) => {
if (key.escape) {
onComplete({
userSelection: 'no',
isExtensionPreInstalled: false,
});
}
});
useKeypress(
(key) => {
if (key.name === 'escape') {
onComplete({
userSelection: 'no',
isExtensionPreInstalled: false,
});
}
},
{ isActive: true },
);
const { displayName: ideName } = getIdeInfo(ide);
// Assume extension is already installed if the env variables are set.