Skip to content

Commit 4de3415

Browse files
LyalinDotComspencer426
authored andcommitted
feat(cli): replace loading phrases boolean with enum setting (#19347)
1 parent ff7ef5e commit 4de3415

15 files changed

Lines changed: 258 additions & 70 deletions

File tree

docs/cli/settings.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,36 +41,36 @@ they appear in the UI.
4141

4242
### UI
4343

44-
| UI Label | Setting | Description | Default |
45-
| ------------------------------------ | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
46-
| Auto Theme Switching | `ui.autoThemeSwitching` | Automatically switch between default light and dark themes based on terminal background color. | `true` |
47-
| Terminal Background Polling Interval | `ui.terminalBackgroundPollingInterval` | Interval in seconds to poll the terminal background color. | `60` |
48-
| Hide Window Title | `ui.hideWindowTitle` | Hide the window title bar | `false` |
49-
| Inline Thinking | `ui.inlineThinkingMode` | Display model thinking inline: off or full. | `"off"` |
50-
| Show Thoughts in Title | `ui.showStatusInTitle` | Show Gemini CLI model thoughts in the terminal window title during the working phase | `false` |
51-
| Dynamic Window Title | `ui.dynamicWindowTitle` | Update the terminal window title with current status icons (Ready: ◇, Action Required: ✋, Working: ✦) | `true` |
52-
| Show Home Directory Warning | `ui.showHomeDirectoryWarning` | Show a warning when running Gemini CLI in the home directory. | `true` |
53-
| Show Compatibility Warnings | `ui.showCompatibilityWarnings` | Show warnings about terminal or OS compatibility issues. | `true` |
54-
| Hide Tips | `ui.hideTips` | Hide helpful tips in the UI | `false` |
55-
| Show Shortcuts Hint | `ui.showShortcutsHint` | Show the "? for shortcuts" hint above the input. | `true` |
56-
| Hide Banner | `ui.hideBanner` | Hide the application banner | `false` |
57-
| Hide Context Summary | `ui.hideContextSummary` | Hide the context summary (GEMINI.md, MCP servers) above the input. | `false` |
58-
| Hide CWD | `ui.footer.hideCWD` | Hide the current working directory path in the footer. | `false` |
59-
| Hide Sandbox Status | `ui.footer.hideSandboxStatus` | Hide the sandbox status indicator in the footer. | `false` |
60-
| Hide Model Info | `ui.footer.hideModelInfo` | Hide the model name and context usage in the footer. | `false` |
61-
| Hide Context Window Percentage | `ui.footer.hideContextPercentage` | Hides the context window remaining percentage. | `true` |
62-
| Hide Footer | `ui.hideFooter` | Hide the footer from the UI | `false` |
63-
| Show Memory Usage | `ui.showMemoryUsage` | Display memory usage information in the UI | `false` |
64-
| Show Line Numbers | `ui.showLineNumbers` | Show line numbers in the chat. | `true` |
65-
| Show Citations | `ui.showCitations` | Show citations for generated text in the chat. | `false` |
66-
| Show Model Info In Chat | `ui.showModelInfoInChat` | Show the model name in the chat for each model turn. | `false` |
67-
| Show User Identity | `ui.showUserIdentity` | Show the logged-in user's identity (e.g. email) in the UI. | `true` |
68-
| Use Alternate Screen Buffer | `ui.useAlternateBuffer` | Use an alternate screen buffer for the UI, preserving shell history. | `false` |
69-
| Use Background Color | `ui.useBackgroundColor` | Whether to use background colors in the UI. | `true` |
70-
| Incremental Rendering | `ui.incrementalRendering` | Enable incremental rendering for the UI. This option will reduce flickering but may cause rendering artifacts. Only supported when useAlternateBuffer is enabled. | `true` |
71-
| Show Spinner | `ui.showSpinner` | Show the spinner during operations. | `true` |
72-
| Enable Loading Phrases | `ui.accessibility.enableLoadingPhrases` | Enable loading phrases during operations. | `true` |
73-
| Screen Reader Mode | `ui.accessibility.screenReader` | Render output in plain-text to be more screen reader accessible | `false` |
44+
| UI Label | Setting | Description | Default |
45+
| ------------------------------------ | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
46+
| Auto Theme Switching | `ui.autoThemeSwitching` | Automatically switch between default light and dark themes based on terminal background color. | `true` |
47+
| Terminal Background Polling Interval | `ui.terminalBackgroundPollingInterval` | Interval in seconds to poll the terminal background color. | `60` |
48+
| Hide Window Title | `ui.hideWindowTitle` | Hide the window title bar | `false` |
49+
| Inline Thinking | `ui.inlineThinkingMode` | Display model thinking inline: off or full. | `"off"` |
50+
| Show Thoughts in Title | `ui.showStatusInTitle` | Show Gemini CLI model thoughts in the terminal window title during the working phase | `false` |
51+
| Dynamic Window Title | `ui.dynamicWindowTitle` | Update the terminal window title with current status icons (Ready: ◇, Action Required: ✋, Working: ✦) | `true` |
52+
| Show Home Directory Warning | `ui.showHomeDirectoryWarning` | Show a warning when running Gemini CLI in the home directory. | `true` |
53+
| Show Compatibility Warnings | `ui.showCompatibilityWarnings` | Show warnings about terminal or OS compatibility issues. | `true` |
54+
| Hide Tips | `ui.hideTips` | Hide helpful tips in the UI | `false` |
55+
| Show Shortcuts Hint | `ui.showShortcutsHint` | Show the "? for shortcuts" hint above the input. | `true` |
56+
| Hide Banner | `ui.hideBanner` | Hide the application banner | `false` |
57+
| Hide Context Summary | `ui.hideContextSummary` | Hide the context summary (GEMINI.md, MCP servers) above the input. | `false` |
58+
| Hide CWD | `ui.footer.hideCWD` | Hide the current working directory path in the footer. | `false` |
59+
| Hide Sandbox Status | `ui.footer.hideSandboxStatus` | Hide the sandbox status indicator in the footer. | `false` |
60+
| Hide Model Info | `ui.footer.hideModelInfo` | Hide the model name and context usage in the footer. | `false` |
61+
| Hide Context Window Percentage | `ui.footer.hideContextPercentage` | Hides the context window remaining percentage. | `true` |
62+
| Hide Footer | `ui.hideFooter` | Hide the footer from the UI | `false` |
63+
| Show Memory Usage | `ui.showMemoryUsage` | Display memory usage information in the UI | `false` |
64+
| Show Line Numbers | `ui.showLineNumbers` | Show line numbers in the chat. | `true` |
65+
| Show Citations | `ui.showCitations` | Show citations for generated text in the chat. | `false` |
66+
| Show Model Info In Chat | `ui.showModelInfoInChat` | Show the model name in the chat for each model turn. | `false` |
67+
| Show User Identity | `ui.showUserIdentity` | Show the logged-in user's identity (e.g. email) in the UI. | `true` |
68+
| Use Alternate Screen Buffer | `ui.useAlternateBuffer` | Use an alternate screen buffer for the UI, preserving shell history. | `false` |
69+
| Use Background Color | `ui.useBackgroundColor` | Whether to use background colors in the UI. | `true` |
70+
| Incremental Rendering | `ui.incrementalRendering` | Enable incremental rendering for the UI. This option will reduce flickering but may cause rendering artifacts. Only supported when useAlternateBuffer is enabled. | `true` |
71+
| Show Spinner | `ui.showSpinner` | Show the spinner during operations. | `true` |
72+
| Loading Phrases | `ui.loadingPhrases` | What to show while the model is working: tips, witty comments, both, or nothing. | `"tips"` |
73+
| Screen Reader Mode | `ui.accessibility.screenReader` | Render output in plain-text to be more screen reader accessible | `false` |
7474

7575
### IDE
7676

docs/get-started/configuration.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,20 @@ their corresponding top-level category object in your `settings.json` file.
305305
- **Description:** Show the spinner during operations.
306306
- **Default:** `true`
307307

308+
- **`ui.loadingPhrases`** (enum):
309+
- **Description:** What to show while the model is working: tips, witty
310+
comments, both, or nothing.
311+
- **Default:** `"tips"`
312+
- **Values:** `"tips"`, `"witty"`, `"all"`, `"off"`
313+
308314
- **`ui.customWittyPhrases`** (array):
309315
- **Description:** Custom witty phrases to display during loading. When
310316
provided, the CLI cycles through these instead of the defaults.
311317
- **Default:** `[]`
312318

313319
- **`ui.accessibility.enableLoadingPhrases`** (boolean):
314-
- **Description:** Enable loading phrases during operations.
320+
- **Description:** @deprecated Use ui.loadingPhrases instead. Enable loading
321+
phrases during operations.
315322
- **Default:** `true`
316323
- **Requires restart:** Yes
317324

packages/cli/src/config/settings.test.ts

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,85 @@ describe('Settings Loading and Merging', () => {
20322032
}),
20332033
}),
20342034
);
2035+
2036+
// Check that enableLoadingPhrases: false was further migrated to loadingPhrases: 'off'
2037+
expect(setValueSpy).toHaveBeenCalledWith(
2038+
SettingScope.User,
2039+
'ui',
2040+
expect.objectContaining({
2041+
loadingPhrases: 'off',
2042+
}),
2043+
);
2044+
});
2045+
2046+
it('should migrate enableLoadingPhrases: false to loadingPhrases: off', () => {
2047+
const userSettingsContent = {
2048+
ui: {
2049+
accessibility: {
2050+
enableLoadingPhrases: false,
2051+
},
2052+
},
2053+
};
2054+
2055+
const loadedSettings = createMockSettings(userSettingsContent);
2056+
const setValueSpy = vi.spyOn(loadedSettings, 'setValue');
2057+
2058+
migrateDeprecatedSettings(loadedSettings);
2059+
2060+
expect(setValueSpy).toHaveBeenCalledWith(
2061+
SettingScope.User,
2062+
'ui',
2063+
expect.objectContaining({
2064+
loadingPhrases: 'off',
2065+
}),
2066+
);
2067+
});
2068+
2069+
it('should not migrate enableLoadingPhrases: true to loadingPhrases', () => {
2070+
const userSettingsContent = {
2071+
ui: {
2072+
accessibility: {
2073+
enableLoadingPhrases: true,
2074+
},
2075+
},
2076+
};
2077+
2078+
const loadedSettings = createMockSettings(userSettingsContent);
2079+
const setValueSpy = vi.spyOn(loadedSettings, 'setValue');
2080+
2081+
migrateDeprecatedSettings(loadedSettings);
2082+
2083+
// Should not set loadingPhrases when enableLoadingPhrases is true
2084+
const uiCalls = setValueSpy.mock.calls.filter((call) => call[1] === 'ui');
2085+
for (const call of uiCalls) {
2086+
const uiValue = call[2] as Record<string, unknown>;
2087+
expect(uiValue).not.toHaveProperty('loadingPhrases');
2088+
}
2089+
});
2090+
2091+
it('should not overwrite existing loadingPhrases during migration', () => {
2092+
const userSettingsContent = {
2093+
ui: {
2094+
loadingPhrases: 'witty',
2095+
accessibility: {
2096+
enableLoadingPhrases: false,
2097+
},
2098+
},
2099+
};
2100+
2101+
const loadedSettings = createMockSettings(userSettingsContent);
2102+
const setValueSpy = vi.spyOn(loadedSettings, 'setValue');
2103+
2104+
migrateDeprecatedSettings(loadedSettings);
2105+
2106+
// Should not overwrite existing loadingPhrases
2107+
const uiCalls = setValueSpy.mock.calls.filter((call) => call[1] === 'ui');
2108+
for (const call of uiCalls) {
2109+
const uiValue = call[2] as Record<string, unknown>;
2110+
if (uiValue['loadingPhrases'] !== undefined) {
2111+
expect(uiValue['loadingPhrases']).toBe('witty');
2112+
}
2113+
}
20352114
});
20362115

20372116
it('should prioritize new settings over deprecated ones and respect removeDeprecated flag', () => {

packages/cli/src/config/settings.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ export interface SummarizeToolOutputSettings {
165165
tokenBudget?: number;
166166
}
167167

168+
export type LoadingPhrasesMode = 'tips' | 'witty' | 'all' | 'off';
169+
168170
export interface AccessibilitySettings {
171+
/** @deprecated Use ui.loadingPhrases instead. */
169172
enableLoadingPhrases?: boolean;
170173
screenReader?: boolean;
171174
}
@@ -928,6 +931,22 @@ export function migrateDeprecatedSettings(
928931
anyModified = true;
929932
}
930933
}
934+
935+
// Migrate enableLoadingPhrases: false → loadingPhrases: 'off'
936+
const enableLP = newAccessibility['enableLoadingPhrases'];
937+
if (
938+
typeof enableLP === 'boolean' &&
939+
newUi['loadingPhrases'] === undefined
940+
) {
941+
if (!enableLP) {
942+
newUi['loadingPhrases'] = 'off';
943+
loadedSettings.setValue(scope, 'ui', newUi);
944+
if (!settingsFile.readOnly) {
945+
anyModified = true;
946+
}
947+
}
948+
foundDeprecated.push('ui.accessibility.enableLoadingPhrases');
949+
}
931950
}
932951
}
933952

0 commit comments

Comments
 (0)