feat: External editor settings (#882)

This commit is contained in:
Leo
2025-06-12 02:21:54 +01:00
committed by GitHub
parent dd53e5c96a
commit 1ef68e0612
23 changed files with 849 additions and 81 deletions

View File

@@ -15,11 +15,12 @@ import {
TrackedExecutingToolCall,
TrackedCancelledToolCall,
} from './useReactToolScheduler.js';
import { Config } from '@gemini-cli/core';
import { Config, EditorType } from '@gemini-cli/core';
import { Part, PartListUnion } from '@google/genai';
import { UseHistoryManagerReturn } from './useHistoryManager.js';
import { HistoryItem } from '../types.js';
import { Dispatch, SetStateAction } from 'react';
import { LoadedSettings } from '../../config/settings.js';
// --- MOCKS ---
const mockSendMessageStream = vi
@@ -309,6 +310,15 @@ describe('useGeminiStream', () => {
.mockReturnValue((async function* () {})());
});
const mockLoadedSettings: LoadedSettings = {
merged: { preferredEditor: 'vscode' },
user: { path: '/user/settings.json', settings: {} },
workspace: { path: '/workspace/.gemini/settings.json', settings: {} },
errors: [],
forScope: vi.fn(),
setValue: vi.fn(),
} as unknown as LoadedSettings;
const renderTestHook = (
initialToolCalls: TrackedToolCall[] = [],
geminiClient?: any,
@@ -337,6 +347,7 @@ describe('useGeminiStream', () => {
| boolean
>;
shellModeActive: boolean;
loadedSettings: LoadedSettings;
}) =>
useGeminiStream(
props.client,
@@ -347,6 +358,7 @@ describe('useGeminiStream', () => {
props.onDebugMessage,
props.handleSlashCommand,
props.shellModeActive,
() => 'vscode' as EditorType,
),
{
initialProps: {
@@ -363,6 +375,7 @@ describe('useGeminiStream', () => {
| boolean
>,
shellModeActive: false,
loadedSettings: mockLoadedSettings,
},
},
);
@@ -486,6 +499,7 @@ describe('useGeminiStream', () => {
handleSlashCommand:
mockHandleSlashCommand as unknown as typeof mockHandleSlashCommand,
shellModeActive: false,
loadedSettings: mockLoadedSettings,
});
});
@@ -541,6 +555,7 @@ describe('useGeminiStream', () => {
handleSlashCommand:
mockHandleSlashCommand as unknown as typeof mockHandleSlashCommand,
shellModeActive: false,
loadedSettings: mockLoadedSettings,
});
});