Skip to content

Commit 77751a0

Browse files
fix(patch): cherry-pick 13d8d94 to release/v0.15.0-preview.4-pr-12981 to patch version v0.15.0-preview.4 and create version 0.15.0-preview.5 (#13011)
Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
1 parent 4ae2d4b commit 77751a0

4 files changed

Lines changed: 26 additions & 6 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
export const SettingPaths = {
8+
General: {
9+
PreferredEditor: 'general.preferredEditor',
10+
},
11+
} as const;

packages/cli/src/config/settings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { resolveEnvVarsInObject } from '../utils/envVarResolver.js';
3333
import { customDeepMerge, type MergeableObject } from '../utils/deepMerge.js';
3434
import { updateSettingsFilePreservingFormat } from '../utils/commentJson.js';
3535
import type { ExtensionManager } from './extension-manager.js';
36+
import { SettingPaths } from './settingPaths.js';
3637

3738
function getMergeStrategyForPath(path: string[]): MergeStrategy | undefined {
3839
let current: SettingDefinition | undefined = undefined;
@@ -108,7 +109,7 @@ const MIGRATION_MAP: Record<string, string> = {
108109
memoryImportFormat: 'context.importFormat',
109110
memoryDiscoveryMaxDirs: 'context.discoveryMaxDirs',
110111
model: 'model.name',
111-
preferredEditor: 'general.preferredEditor',
112+
preferredEditor: SettingPaths.General.PreferredEditor,
112113
retryFetchErrors: 'general.retryFetchErrors',
113114
sandbox: 'tools.sandbox',
114115
selectedAuthType: 'security.auth.selectedType',

packages/cli/src/ui/hooks/useEditorSettings.test.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import {
2828
allowEditorTypeInSandbox,
2929
} from '@google/gemini-cli-core';
3030

31+
import { SettingPaths } from '../../config/settingPaths.js';
32+
3133
vi.mock('@google/gemini-cli-core', async () => {
3234
const actual = await vi.importActual('@google/gemini-cli-core');
3335
return {
@@ -114,7 +116,7 @@ describe('useEditorSettings', () => {
114116

115117
expect(mockLoadedSettings.setValue).toHaveBeenCalledWith(
116118
scope,
117-
'preferredEditor',
119+
SettingPaths.General.PreferredEditor,
118120
editorType,
119121
);
120122

@@ -142,7 +144,7 @@ describe('useEditorSettings', () => {
142144

143145
expect(mockLoadedSettings.setValue).toHaveBeenCalledWith(
144146
scope,
145-
'preferredEditor',
147+
SettingPaths.General.PreferredEditor,
146148
undefined,
147149
);
148150

@@ -171,7 +173,7 @@ describe('useEditorSettings', () => {
171173

172174
expect(mockLoadedSettings.setValue).toHaveBeenCalledWith(
173175
scope,
174-
'preferredEditor',
176+
SettingPaths.General.PreferredEditor,
175177
editorType,
176178
);
177179

@@ -201,7 +203,7 @@ describe('useEditorSettings', () => {
201203

202204
expect(mockLoadedSettings.setValue).toHaveBeenCalledWith(
203205
scope,
204-
'preferredEditor',
206+
SettingPaths.General.PreferredEditor,
205207
editorType,
206208
);
207209

packages/cli/src/ui/hooks/useEditorSettings.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import {
1616
checkHasEditorType,
1717
} from '@google/gemini-cli-core';
1818

19+
import { SettingPaths } from '../../config/settingPaths.js';
20+
1921
interface UseEditorSettingsReturn {
2022
isEditorDialogOpen: boolean;
2123
openEditorDialog: () => void;
@@ -48,7 +50,11 @@ export const useEditorSettings = (
4850
}
4951

5052
try {
51-
loadedSettings.setValue(scope, 'preferredEditor', editorType);
53+
loadedSettings.setValue(
54+
scope,
55+
SettingPaths.General.PreferredEditor,
56+
editorType,
57+
);
5258
addItem(
5359
{
5460
type: MessageType.INFO,

0 commit comments

Comments
 (0)