diff options
| author | shrutip90 <[email protected]> | 2025-08-19 21:20:41 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-20 04:20:41 +0000 |
| commit | d250293c2e0a4a50f5ef6b4b6cd3257730338d13 (patch) | |
| tree | da91b3cc7af02e40bc80df6857a2b2abcc12d4e3 /packages/cli/src/ui/hooks/useEditorSettings.ts | |
| parent | 179f1414daf9058a05d38a170c0d36ca9f2b8547 (diff) | |
Ignore workspace settings for untrusted folders (#6606)
Diffstat (limited to 'packages/cli/src/ui/hooks/useEditorSettings.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useEditorSettings.ts | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/packages/cli/src/ui/hooks/useEditorSettings.ts b/packages/cli/src/ui/hooks/useEditorSettings.ts index 60c16798..bd6f72bb 100644 --- a/packages/cli/src/ui/hooks/useEditorSettings.ts +++ b/packages/cli/src/ui/hooks/useEditorSettings.ts @@ -4,14 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { useState, useCallback } from 'react'; -import { LoadedSettings, SettingScope } from '../../config/settings.js'; +import { useState, useCallback, useContext } from 'react'; +import { SettingScope } from '../../config/settings.js'; import { type HistoryItem, MessageType } from '../types.js'; import { allowEditorTypeInSandbox, checkHasEditorType, EditorType, } from '@google/gemini-cli-core'; +import { SettingsContext } from '../contexts/SettingsContext.js'; interface UseEditorSettingsReturn { isEditorDialogOpen: boolean; @@ -24,11 +25,11 @@ interface UseEditorSettingsReturn { } export const useEditorSettings = ( - loadedSettings: LoadedSettings, setEditorError: (error: string | null) => void, addItem: (item: Omit<HistoryItem, 'id'>, timestamp: number) => void, ): UseEditorSettingsReturn => { const [isEditorDialogOpen, setIsEditorDialogOpen] = useState(false); + const settingsContext = useContext(SettingsContext); const openEditorDialog = useCallback(() => { setIsEditorDialogOpen(true); @@ -45,7 +46,11 @@ export const useEditorSettings = ( } try { - loadedSettings.setValue(scope, 'preferredEditor', editorType); + settingsContext?.settings.setValue( + scope, + 'preferredEditor', + editorType, + ); addItem( { type: MessageType.INFO, @@ -59,7 +64,7 @@ export const useEditorSettings = ( setEditorError(`Failed to set editor preference: ${error}`); } }, - [loadedSettings, setEditorError, addItem], + [settingsContext, setEditorError, addItem], ); const exitEditorDialog = useCallback(() => { |
