mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 11:04:42 -07:00
Use IdeClient directly instead of config.ideClient (#7627)
This commit is contained in:
committed by
GitHub
parent
45d494a8d8
commit
cb43bb9ca4
@@ -59,7 +59,12 @@ import { ContextSummaryDisplay } from './components/ContextSummaryDisplay.js';
|
||||
import { useHistory } from './hooks/useHistoryManager.js';
|
||||
import { useInputHistoryStore } from './hooks/useInputHistoryStore.js';
|
||||
import process from 'node:process';
|
||||
import type { EditorType, Config, IdeContext } from '@google/gemini-cli-core';
|
||||
import type {
|
||||
EditorType,
|
||||
Config,
|
||||
IdeContext,
|
||||
DetectedIde,
|
||||
} from '@google/gemini-cli-core';
|
||||
import {
|
||||
ApprovalMode,
|
||||
getAllGeminiMdFilenames,
|
||||
@@ -73,6 +78,7 @@ import {
|
||||
isGenericQuotaExceededError,
|
||||
UserTierId,
|
||||
DEFAULT_GEMINI_FLASH_MODEL,
|
||||
IdeClient,
|
||||
} from '@google/gemini-cli-core';
|
||||
import type { IdeIntegrationNudgeResult } from './IdeIntegrationNudge.js';
|
||||
import { IdeIntegrationNudge } from './IdeIntegrationNudge.js';
|
||||
@@ -161,10 +167,19 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
|
||||
const { history, addItem, clearItems, loadHistory } = useHistory();
|
||||
|
||||
const [idePromptAnswered, setIdePromptAnswered] = useState(false);
|
||||
const currentIDE = config.getIdeClient().getCurrentIde();
|
||||
const [currentIDE, setCurrentIDE] = useState<DetectedIde | undefined>();
|
||||
|
||||
useEffect(() => {
|
||||
registerCleanup(() => config.getIdeClient().disconnect());
|
||||
(async () => {
|
||||
const ideClient = await IdeClient.getInstance();
|
||||
setCurrentIDE(ideClient.getCurrentIde());
|
||||
})();
|
||||
registerCleanup(async () => {
|
||||
const ideClient = await IdeClient.getInstance();
|
||||
ideClient.disconnect();
|
||||
});
|
||||
}, [config]);
|
||||
|
||||
const shouldShowIdePrompt =
|
||||
currentIDE &&
|
||||
!config.getIdeMode() &&
|
||||
@@ -306,7 +321,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
|
||||
const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } =
|
||||
useFolderTrust(settings, setIsTrustedFolder);
|
||||
|
||||
const { needsRestart: ideNeedsRestart } = useIdeTrustListener(config);
|
||||
const { needsRestart: ideNeedsRestart } = useIdeTrustListener();
|
||||
useEffect(() => {
|
||||
if (ideNeedsRestart) {
|
||||
// IDE trust changed, force a restart.
|
||||
|
||||
Reference in New Issue
Block a user