mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 15:31:27 +00:00
feat: External editor settings (#882)
This commit is contained in:
parent
dd53e5c96a
commit
1ef68e0612
23 changed files with 849 additions and 81 deletions
|
|
@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue