From 798c4d1311dc9e415caf422f5eb6a7d7e65f0a7a Mon Sep 17 00:00:00 2001 From: Shreya Keshive Date: Thu, 14 Aug 2025 17:50:20 +0000 Subject: [PATCH] Update IDE integration context toggle shortcut to ctrl+G (#6245) --- docs/keyboard-shortcuts.md | 6 ++++++ packages/cli/src/config/keyBindings.ts | 4 ++-- packages/cli/src/ui/App.test.tsx | 6 +++--- .../cli/src/ui/components/ContextSummaryDisplay.test.tsx | 6 +++--- packages/cli/src/ui/components/ContextSummaryDisplay.tsx | 2 +- .../__snapshots__/IDEContextDetailDisplay.test.tsx.snap | 4 ++-- packages/cli/src/ui/keyMatchers.test.ts | 6 +++--- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/docs/keyboard-shortcuts.md b/docs/keyboard-shortcuts.md index 37e47045..f9720982 100644 --- a/docs/keyboard-shortcuts.md +++ b/docs/keyboard-shortcuts.md @@ -60,3 +60,9 @@ This document lists the available keyboard shortcuts in the Gemini CLI. | `Up Arrow` / `k` | Move selection up. | | `1-9` | Select an item by its number. | | (multi-digit) | For items with numbers greater than 9, press the digits in quick succession to select the corresponding item. | + +## IDE Integration + +| Shortcut | Description | +| -------- | --------------------------------- | +| `Ctrl+G` | See context CLI received from IDE | diff --git a/packages/cli/src/config/keyBindings.ts b/packages/cli/src/config/keyBindings.ts index 640bf9de..8060cbba 100644 --- a/packages/cli/src/config/keyBindings.ts +++ b/packages/cli/src/config/keyBindings.ts @@ -163,8 +163,8 @@ export const defaultKeyBindings: KeyBindingConfig = { [Command.SHOW_ERROR_DETAILS]: [{ key: 'o', ctrl: true }], // Original: key.ctrl && key.name === 't' [Command.TOGGLE_TOOL_DESCRIPTIONS]: [{ key: 't', ctrl: true }], - // Original: key.ctrl && key.name === 'e' - [Command.TOGGLE_IDE_CONTEXT_DETAIL]: [{ key: 'e', ctrl: true }], + // Original: key.ctrl && key.name === 'g' + [Command.TOGGLE_IDE_CONTEXT_DETAIL]: [{ key: 'g', ctrl: true }], // Original: key.ctrl && (key.name === 'c' || key.name === 'C') [Command.QUIT]: [{ key: 'c', ctrl: true }], // Original: key.ctrl && (key.name === 'd' || key.name === 'D') diff --git a/packages/cli/src/ui/App.test.tsx b/packages/cli/src/ui/App.test.tsx index 3636823b..c797b778 100644 --- a/packages/cli/src/ui/App.test.tsx +++ b/packages/cli/src/ui/App.test.tsx @@ -528,7 +528,7 @@ describe('App UI', () => { ); currentUnmount = unmount; await Promise.resolve(); - expect(lastFrame()).toContain('1 open file (ctrl+e to view)'); + expect(lastFrame()).toContain('1 open file (ctrl+g to view)'); }); it('should not display any files when not available', async () => { @@ -583,7 +583,7 @@ describe('App UI', () => { ); currentUnmount = unmount; await Promise.resolve(); - expect(lastFrame()).toContain('3 open files (ctrl+e to view)'); + expect(lastFrame()).toContain('3 open files (ctrl+g to view)'); }); it('should display active file and other context', async () => { @@ -612,7 +612,7 @@ describe('App UI', () => { currentUnmount = unmount; await Promise.resolve(); expect(lastFrame()).toContain( - 'Using: 1 open file (ctrl+e to view) | 1 GEMINI.md file', + 'Using: 1 open file (ctrl+g to view) | 1 GEMINI.md file', ); }); diff --git a/packages/cli/src/ui/components/ContextSummaryDisplay.test.tsx b/packages/cli/src/ui/components/ContextSummaryDisplay.test.tsx index d70bb4ca..b356e796 100644 --- a/packages/cli/src/ui/components/ContextSummaryDisplay.test.tsx +++ b/packages/cli/src/ui/components/ContextSummaryDisplay.test.tsx @@ -41,7 +41,7 @@ describe('', () => { const { lastFrame } = renderWithWidth(120, baseProps); const output = lastFrame(); expect(output).toContain( - 'Using: 1 open file (ctrl+e to view) | 1 GEMINI.md file | 1 MCP server (ctrl+t to view)', + 'Using: 1 open file (ctrl+g to view) | 1 GEMINI.md file | 1 MCP server (ctrl+t to view)', ); // Check for absence of newlines expect(output.includes('\n')).toBe(false); @@ -52,7 +52,7 @@ describe('', () => { const output = lastFrame(); const expectedLines = [ 'Using:', - ' - 1 open file (ctrl+e to view)', + ' - 1 open file (ctrl+g to view)', ' - 1 GEMINI.md file', ' - 1 MCP server (ctrl+t to view)', ]; @@ -78,7 +78,7 @@ describe('', () => { mcpServers: {}, }; const { lastFrame } = renderWithWidth(60, props); - const expectedLines = ['Using:', ' - 1 open file (ctrl+e to view)']; + const expectedLines = ['Using:', ' - 1 open file (ctrl+g to view)']; const actualLines = lastFrame().split('\n'); expect(actualLines).toEqual(expectedLines); }); diff --git a/packages/cli/src/ui/components/ContextSummaryDisplay.tsx b/packages/cli/src/ui/components/ContextSummaryDisplay.tsx index 99406bd6..0c946385 100644 --- a/packages/cli/src/ui/components/ContextSummaryDisplay.tsx +++ b/packages/cli/src/ui/components/ContextSummaryDisplay.tsx @@ -49,7 +49,7 @@ export const ContextSummaryDisplay: React.FC = ({ } return `${openFileCount} open file${ openFileCount > 1 ? 's' : '' - } (ctrl+e to view)`; + } (ctrl+g to view)`; })(); const geminiMdText = (() => { diff --git a/packages/cli/src/ui/components/__snapshots__/IDEContextDetailDisplay.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/IDEContextDetailDisplay.test.tsx.snap index 8b84e1f3..dd659db0 100644 --- a/packages/cli/src/ui/components/__snapshots__/IDEContextDetailDisplay.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/IDEContextDetailDisplay.test.tsx.snap @@ -3,7 +3,7 @@ exports[`IDEContextDetailDisplay > handles duplicate basenames by showing path hints 1`] = ` " ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ -│ VS Code Context (ctrl+e to toggle) │ +│ VS Code Context (ctrl+g to toggle) │ │ │ │ Open files: │ │ - bar.txt (/foo) (active) │ @@ -15,7 +15,7 @@ exports[`IDEContextDetailDisplay > handles duplicate basenames by showing path h exports[`IDEContextDetailDisplay > renders a list of open files with active status 1`] = ` " ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ -│ VS Code Context (ctrl+e to toggle) │ +│ VS Code Context (ctrl+g to toggle) │ │ │ │ Open files: │ │ - bar.txt (active) │ diff --git a/packages/cli/src/ui/keyMatchers.test.ts b/packages/cli/src/ui/keyMatchers.test.ts index 9c72f2dd..9e2963b9 100644 --- a/packages/cli/src/ui/keyMatchers.test.ts +++ b/packages/cli/src/ui/keyMatchers.test.ts @@ -51,7 +51,7 @@ describe('keyMatchers', () => { [Command.TOGGLE_TOOL_DESCRIPTIONS]: (key: Key) => key.ctrl && key.name === 't', [Command.TOGGLE_IDE_CONTEXT_DETAIL]: (key: Key) => - key.ctrl && key.name === 'e', + key.ctrl && key.name === 'g', [Command.QUIT]: (key: Key) => key.ctrl && key.name === 'c', [Command.EXIT]: (key: Key) => key.ctrl && key.name === 'd', [Command.SHOW_MORE_LINES]: (key: Key) => key.ctrl && key.name === 's', @@ -207,8 +207,8 @@ describe('keyMatchers', () => { }, { command: Command.TOGGLE_IDE_CONTEXT_DETAIL, - positive: [createKey('e', { ctrl: true })], - negative: [createKey('e'), createKey('t', { ctrl: true })], + positive: [createKey('g', { ctrl: true })], + negative: [createKey('g'), createKey('t', { ctrl: true })], }, { command: Command.QUIT,