Updates schema, UX and prompt for IDE context (#5046)

This commit is contained in:
Shreya Keshive
2025-07-28 11:03:22 -04:00
committed by GitHub
parent 16322ed0b2
commit 165b29c3b1
10 changed files with 680 additions and 259 deletions

View File

@@ -60,7 +60,7 @@ import {
FlashFallbackEvent,
logFlashFallback,
AuthType,
type OpenFiles,
type IdeContext,
ideContext,
} from '@google/gemini-cli-core';
import { validateAuthMethod } from '../config/auth.js';
@@ -169,13 +169,15 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] =
useState<boolean>(false);
const [userTier, setUserTier] = useState<UserTierId | undefined>(undefined);
const [openFiles, setOpenFiles] = useState<OpenFiles | undefined>();
const [ideContextState, setIdeContextState] = useState<
IdeContext | undefined
>();
const [isProcessing, setIsProcessing] = useState<boolean>(false);
useEffect(() => {
const unsubscribe = ideContext.subscribeToOpenFiles(setOpenFiles);
const unsubscribe = ideContext.subscribeToIdeContext(setIdeContextState);
// Set the initial value
setOpenFiles(ideContext.getOpenFilesContext());
setIdeContextState(ideContext.getIdeContext());
return unsubscribe;
}, []);
@@ -568,7 +570,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
if (Object.keys(mcpServers || {}).length > 0) {
handleSlashCommand(newValue ? '/mcp desc' : '/mcp nodesc');
}
} else if (key.ctrl && input === 'e' && ideContext) {
} else if (key.ctrl && input === 'e' && ideContextState) {
setShowIDEContextDetail((prev) => !prev);
} else if (key.ctrl && (input === 'c' || input === 'C')) {
handleExit(ctrlCPressedOnce, setCtrlCPressedOnce, ctrlCTimerRef);
@@ -943,7 +945,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
</Text>
) : (
<ContextSummaryDisplay
openFiles={openFiles}
ideContext={ideContextState}
geminiMdFileCount={geminiMdFileCount}
contextFileNames={contextFileNames}
mcpServers={config.getMcpServers()}
@@ -963,7 +965,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
</Box>
</Box>
{showIDEContextDetail && (
<IDEContextDetailDisplay openFiles={openFiles} />
<IDEContextDetailDisplay ideContext={ideContextState} />
)}
{showErrorDetails && (
<OverflowProvider>