summaryrefslogtreecommitdiff
path: root/packages/cli/src
diff options
context:
space:
mode:
authorShreya Keshive <[email protected]>2025-07-15 10:19:59 -0400
committerGitHub <[email protected]>2025-07-15 14:19:59 +0000
commitb09bc6656080d4d12e1d06734aae2ec33af5c1ed (patch)
tree5140eabe1f10fb6084d9ded3d4d59282cfbc0bc7 /packages/cli/src
parent97cc1e641805beefe3abe3bd7bd57b630b22ecd2 (diff)
Adds the user's active file in the IDE to the footer (#4154)
Diffstat (limited to 'packages/cli/src')
-rw-r--r--packages/cli/src/config/config.test.ts2
-rw-r--r--packages/cli/src/config/config.ts3
-rw-r--r--packages/cli/src/ui/components/Footer.tsx41
3 files changed, 42 insertions, 4 deletions
diff --git a/packages/cli/src/config/config.test.ts b/packages/cli/src/config/config.test.ts
index ad8b1d44..5043fd59 100644
--- a/packages/cli/src/config/config.test.ts
+++ b/packages/cli/src/config/config.test.ts
@@ -868,7 +868,7 @@ describe('loadCliConfig ideMode', () => {
expect(config.getIdeMode()).toBe(false);
});
- it('should add __ide_server when ideMode is true', async () => {
+ it('should add _ide_server when ideMode is true', async () => {
process.argv = ['node', 'script.js', '--ide-mode'];
const argv = await parseArguments();
process.env.TERM_PROGRAM = 'vscode';
diff --git a/packages/cli/src/config/config.ts b/packages/cli/src/config/config.ts
index 626f23e1..a5eb327d 100644
--- a/packages/cli/src/config/config.ts
+++ b/packages/cli/src/config/config.ts
@@ -18,6 +18,7 @@ import {
FileDiscoveryService,
TelemetryTarget,
MCPServerConfig,
+ IDE_SERVER_NAME,
} from '@google/gemini-cli-core';
import { Settings } from './settings.js';
@@ -285,7 +286,7 @@ export async function loadCliConfig(
}
if (ideMode) {
- mcpServers['_ide_server'] = new MCPServerConfig(
+ mcpServers[IDE_SERVER_NAME] = new MCPServerConfig(
undefined, // command
undefined, // args
undefined, // env
diff --git a/packages/cli/src/ui/components/Footer.tsx b/packages/cli/src/ui/components/Footer.tsx
index 95904cd9..5524114b 100644
--- a/packages/cli/src/ui/components/Footer.tsx
+++ b/packages/cli/src/ui/components/Footer.tsx
@@ -4,10 +4,16 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import React from 'react';
+import React, { useEffect, useState } from 'react';
import { Box, Text } from 'ink';
import { Colors } from '../colors.js';
-import { shortenPath, tildeifyPath, tokenLimit } from '@google/gemini-cli-core';
+import {
+ shortenPath,
+ tildeifyPath,
+ tokenLimit,
+ ideContext,
+ ActiveFile,
+} from '@google/gemini-cli-core';
import { ConsoleSummaryDisplay } from './ConsoleSummaryDisplay.js';
import process from 'node:process';
import Gradient from 'ink-gradient';
@@ -43,6 +49,24 @@ export const Footer: React.FC<FooterProps> = ({
const limit = tokenLimit(model);
const percentage = promptTokenCount / limit;
+ const [activeFile, setActiveFile] = useState<ActiveFile | undefined>(
+ undefined,
+ );
+
+ useEffect(() => {
+ const updateActiveFile = () => {
+ const currentActiveFile = ideContext.getActiveFileContext();
+ setActiveFile(currentActiveFile);
+ };
+
+ updateActiveFile();
+
+ const unsubscribe = ideContext.subscribeToActiveFile(setActiveFile);
+ return () => {
+ unsubscribe();
+ };
+ }, []);
+
return (
<Box marginTop={1} justifyContent="space-between" width="100%">
<Box>
@@ -59,6 +83,19 @@ export const Footer: React.FC<FooterProps> = ({
{branchName && <Text color={Colors.Gray}> ({branchName}*)</Text>}
</Text>
)}
+ {activeFile && activeFile.filePath && (
+ <Text>
+ <Text color={Colors.Gray}> | </Text>
+ <Text color={Colors.LightBlue}>
+ {shortenPath(tildeifyPath(activeFile.filePath), 70)}
+ </Text>
+ {activeFile.cursor && (
+ <Text color={Colors.Gray}>
+ :{activeFile.cursor.line}:{activeFile.cursor.character}
+ </Text>
+ )}
+ </Text>
+ )}
{debugMode && (
<Text color={Colors.AccentRed}>
{' ' + (debugMessage || '--debug')}