mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 16:41:11 -07:00
Enable switching preview features on/off without restart (#13515)
This commit is contained in:
@@ -101,7 +101,6 @@ their corresponding top-level category object in your `settings.json` file.
|
|||||||
- **`general.previewFeatures`** (boolean):
|
- **`general.previewFeatures`** (boolean):
|
||||||
- **Description:** Enable preview features (e.g., preview models).
|
- **Description:** Enable preview features (e.g., preview models).
|
||||||
- **Default:** `false`
|
- **Default:** `false`
|
||||||
- **Requires restart:** Yes
|
|
||||||
|
|
||||||
- **`general.preferredEditor`** (string):
|
- **`general.preferredEditor`** (string):
|
||||||
- **Description:** The preferred editor to open files in.
|
- **Description:** The preferred editor to open files in.
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ describe('SettingsSchema', () => {
|
|||||||
).toBe(false);
|
).toBe(false);
|
||||||
expect(
|
expect(
|
||||||
getSettingsSchema().general.properties.previewFeatures.requiresRestart,
|
getSettingsSchema().general.properties.previewFeatures.requiresRestart,
|
||||||
).toBe(true);
|
).toBe(false);
|
||||||
expect(
|
expect(
|
||||||
getSettingsSchema().general.properties.previewFeatures.showInDialog,
|
getSettingsSchema().general.properties.previewFeatures.showInDialog,
|
||||||
).toBe(true);
|
).toBe(true);
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ const SETTINGS_SCHEMA = {
|
|||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
label: 'Preview Features (e.g., models)',
|
label: 'Preview Features (e.g., models)',
|
||||||
category: 'General',
|
category: 'General',
|
||||||
requiresRestart: true,
|
requiresRestart: false,
|
||||||
default: false,
|
default: false,
|
||||||
description: 'Enable preview features (e.g., preview models).',
|
description: 'Enable preview features (e.g., preview models).',
|
||||||
showInDialog: true,
|
showInDialog: true,
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ export const DialogManager = ({
|
|||||||
onSelect={() => uiActions.closeSettingsDialog()}
|
onSelect={() => uiActions.closeSettingsDialog()}
|
||||||
onRestartRequest={() => process.exit(0)}
|
onRestartRequest={() => process.exit(0)}
|
||||||
availableTerminalHeight={terminalHeight - staticExtraHeight}
|
availableTerminalHeight={terminalHeight - staticExtraHeight}
|
||||||
|
config={config}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,12 +43,14 @@ import {
|
|||||||
} from '../../config/settingsSchema.js';
|
} from '../../config/settingsSchema.js';
|
||||||
import { debugLogger } from '@google/gemini-cli-core';
|
import { debugLogger } from '@google/gemini-cli-core';
|
||||||
import { keyMatchers, Command } from '../keyMatchers.js';
|
import { keyMatchers, Command } from '../keyMatchers.js';
|
||||||
|
import type { Config } from '@google/gemini-cli-core';
|
||||||
|
|
||||||
interface SettingsDialogProps {
|
interface SettingsDialogProps {
|
||||||
settings: LoadedSettings;
|
settings: LoadedSettings;
|
||||||
onSelect: (settingName: string | undefined, scope: SettingScope) => void;
|
onSelect: (settingName: string | undefined, scope: SettingScope) => void;
|
||||||
onRestartRequest?: () => void;
|
onRestartRequest?: () => void;
|
||||||
availableTerminalHeight?: number;
|
availableTerminalHeight?: number;
|
||||||
|
config?: Config;
|
||||||
}
|
}
|
||||||
|
|
||||||
const maxItemsToShow = 8;
|
const maxItemsToShow = 8;
|
||||||
@@ -58,6 +60,7 @@ export function SettingsDialog({
|
|||||||
onSelect,
|
onSelect,
|
||||||
onRestartRequest,
|
onRestartRequest,
|
||||||
availableTerminalHeight,
|
availableTerminalHeight,
|
||||||
|
config,
|
||||||
}: SettingsDialogProps): React.JSX.Element {
|
}: SettingsDialogProps): React.JSX.Element {
|
||||||
// Get vim mode context to sync vim mode changes
|
// Get vim mode context to sync vim mode changes
|
||||||
const { vimEnabled, toggleVimEnabled } = useVimMode();
|
const { vimEnabled, toggleVimEnabled } = useVimMode();
|
||||||
@@ -208,6 +211,10 @@ export function SettingsDialog({
|
|||||||
next.delete(key);
|
next.delete(key);
|
||||||
return next;
|
return next;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (key === 'general.previewFeatures') {
|
||||||
|
config?.setPreviewFeatures(newValue as boolean);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// For restart-required settings, track as modified
|
// For restart-required settings, track as modified
|
||||||
setModifiedSettings((prev) => {
|
setModifiedSettings((prev) => {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"previewFeatures": {
|
"previewFeatures": {
|
||||||
"title": "Preview Features (e.g., models)",
|
"title": "Preview Features (e.g., models)",
|
||||||
"description": "Enable preview features (e.g., preview models).",
|
"description": "Enable preview features (e.g., preview models).",
|
||||||
"markdownDescription": "Enable preview features (e.g., preview models).\n\n- Category: `General`\n- Requires restart: `yes`\n- Default: `false`",
|
"markdownDescription": "Enable preview features (e.g., preview models).\n\n- Category: `General`\n- Requires restart: `no`\n- Default: `false`",
|
||||||
"default": false,
|
"default": false,
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user