mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
fix(ide companion extension): Don't show the installation confirmation message in Firebase Studio (#8097)
Co-authored-by: Roman Nurik <roman@nurik.net>
This commit is contained in:
@@ -16,7 +16,7 @@ export {
|
||||
DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,
|
||||
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
|
||||
} from './src/config/config.js';
|
||||
export { getIdeInfo } from './src/ide/detect-ide.js';
|
||||
export { detectIdeFromEnv, getIdeInfo } from './src/ide/detect-ide.js';
|
||||
export { logIdeConnection } from './src/telemetry/loggers.js';
|
||||
export {
|
||||
IdeConnectionEvent,
|
||||
|
||||
@@ -7,6 +7,15 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import * as vscode from 'vscode';
|
||||
import { activate } from './extension.js';
|
||||
import { DetectedIde, detectIdeFromEnv } from '@google/gemini-cli-core';
|
||||
|
||||
vi.mock('@google/gemini-cli-core', async () => {
|
||||
const actual = await vi.importActual('@google/gemini-cli-core');
|
||||
return {
|
||||
...actual,
|
||||
detectIdeFromEnv: vi.fn(() => DetectedIde.VSCode),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('vscode', () => ({
|
||||
window: {
|
||||
@@ -187,6 +196,23 @@ describe('activate', () => {
|
||||
expect(showInformationMessageMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
ide: DetectedIde.CloudShell,
|
||||
},
|
||||
{ ide: DetectedIde.FirebaseStudio },
|
||||
])('does not show the notification for $ide', async ({ ide }) => {
|
||||
vi.mocked(detectIdeFromEnv).mockReturnValue(ide);
|
||||
vi.mocked(context.globalState.get).mockReturnValue(undefined);
|
||||
const showInformationMessageMock = vi.mocked(
|
||||
vscode.window.showInformationMessage,
|
||||
);
|
||||
|
||||
await activate(context);
|
||||
|
||||
expect(showInformationMessageMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not show an update notification if the version is older', async () => {
|
||||
vi.spyOn(global, 'fetch').mockResolvedValue({
|
||||
ok: true,
|
||||
|
||||
@@ -9,11 +9,22 @@ import { IDEServer } from './ide-server.js';
|
||||
import semver from 'semver';
|
||||
import { DiffContentProvider, DiffManager } from './diff-manager.js';
|
||||
import { createLogger } from './utils/logger.js';
|
||||
import { detectIdeFromEnv, DetectedIde } from '@google/gemini-cli-core';
|
||||
|
||||
const CLI_IDE_COMPANION_IDENTIFIER = 'Google.gemini-cli-vscode-ide-companion';
|
||||
const INFO_MESSAGE_SHOWN_KEY = 'geminiCliInfoMessageShown';
|
||||
export const DIFF_SCHEME = 'gemini-diff';
|
||||
|
||||
/**
|
||||
* IDE environments where the installation greeting is hidden. In these
|
||||
* environments we either are pre-installed and the installation message is
|
||||
* confusing or we just want to be quiet.
|
||||
*/
|
||||
const HIDE_INSTALLATION_GREETING_IDES: ReadonlySet<DetectedIde> = new Set([
|
||||
DetectedIde.FirebaseStudio,
|
||||
DetectedIde.CloudShell,
|
||||
]);
|
||||
|
||||
let ideServer: IDEServer;
|
||||
let logger: vscode.OutputChannel;
|
||||
|
||||
@@ -133,7 +144,10 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
log(`Failed to start IDE server: ${message}`);
|
||||
}
|
||||
|
||||
if (!context.globalState.get(INFO_MESSAGE_SHOWN_KEY)) {
|
||||
const infoMessageEnabled =
|
||||
!HIDE_INSTALLATION_GREETING_IDES.has(detectIdeFromEnv());
|
||||
|
||||
if (!context.globalState.get(INFO_MESSAGE_SHOWN_KEY) && infoMessageEnabled) {
|
||||
void vscode.window.showInformationMessage(
|
||||
'Gemini CLI Companion extension successfully installed.',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user