summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx
diff options
context:
space:
mode:
authorLeo <[email protected]>2025-06-08 18:56:58 +0100
committerGitHub <[email protected]>2025-06-08 10:56:58 -0700
commit9efca40dae2e75477af1a20df4e3e65bf8dfe93d (patch)
tree39e10eef42ddfd4b9c73b7c2410dd5bccb5ed900 /packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx
parent584286cfd9b53eee8f1189a3ad98462c77eb8fb9 (diff)
feat: Add flow to allow modifying edits during edit tool call (#808)
Diffstat (limited to 'packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx')
-rw-r--r--packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx45
1 files changed, 43 insertions, 2 deletions
diff --git a/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx b/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx
index 01372290..c46d36f7 100644
--- a/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx
+++ b/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx
@@ -13,6 +13,8 @@ import {
ToolConfirmationOutcome,
ToolExecuteConfirmationDetails,
ToolMcpConfirmationDetails,
+ checkHasEditor,
+ Config,
} from '@gemini-cli/core';
import {
RadioButtonSelect,
@@ -21,11 +23,12 @@ import {
export interface ToolConfirmationMessageProps {
confirmationDetails: ToolCallConfirmationDetails;
+ config?: Config;
}
export const ToolConfirmationMessage: React.FC<
ToolConfirmationMessageProps
-> = ({ confirmationDetails }) => {
+> = ({ confirmationDetails, config }) => {
const { onConfirm } = confirmationDetails;
useInput((_, key) => {
@@ -44,6 +47,24 @@ export const ToolConfirmationMessage: React.FC<
>();
if (confirmationDetails.type === 'edit') {
+ if (confirmationDetails.isModifying) {
+ return (
+ <Box
+ minWidth="90%"
+ borderStyle="round"
+ borderColor={Colors.Gray}
+ justifyContent="space-around"
+ padding={1}
+ overflow="hidden"
+ >
+ <Text>Modify in progress: </Text>
+ <Text color={Colors.AccentGreen}>
+ Save and close external editor to continue
+ </Text>
+ </Box>
+ );
+ }
+
// Body content is now the DiffRenderer, passing filename to it
// The bordered box is removed from here and handled within DiffRenderer
bodyContent = (
@@ -63,8 +84,28 @@ export const ToolConfirmationMessage: React.FC<
label: 'Yes, allow always',
value: ToolConfirmationOutcome.ProceedAlways,
},
- { label: 'No (esc)', value: ToolConfirmationOutcome.Cancel },
);
+
+ // Conditionally add editor options if editors are installed
+ const notUsingSandbox = !process.env.SANDBOX;
+ const externalEditorsEnabled =
+ config?.getEnableModifyWithExternalEditors() ?? false;
+
+ if (checkHasEditor('vscode') && notUsingSandbox && externalEditorsEnabled) {
+ options.push({
+ label: 'Modify with VS Code',
+ value: ToolConfirmationOutcome.ModifyVSCode,
+ });
+ }
+
+ if (checkHasEditor('vim') && externalEditorsEnabled) {
+ options.push({
+ label: 'Modify with vim',
+ value: ToolConfirmationOutcome.ModifyVim,
+ });
+ }
+
+ options.push({ label: 'No (esc)', value: ToolConfirmationOutcome.Cancel });
} else if (confirmationDetails.type === 'exec') {
const executionProps =
confirmationDetails as ToolExecuteConfirmationDetails;