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/contexts/SettingsContext.ts | |
| parent | 179f1414daf9058a05d38a170c0d36ca9f2b8547 (diff) | |
Ignore workspace settings for untrusted folders (#6606)
Diffstat (limited to 'packages/cli/src/ui/contexts/SettingsContext.ts')
| -rw-r--r-- | packages/cli/src/ui/contexts/SettingsContext.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/cli/src/ui/contexts/SettingsContext.ts b/packages/cli/src/ui/contexts/SettingsContext.ts new file mode 100644 index 00000000..610a778d --- /dev/null +++ b/packages/cli/src/ui/contexts/SettingsContext.ts @@ -0,0 +1,24 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { createContext, useContext } from 'react'; +import { LoadedSettings } from '../../config/settings.js'; + +export interface SettingsContextType { + settings: LoadedSettings; + recomputeSettings: () => void; +} + +// This context is initialized in gemini.tsx with the loaded settings. +export const SettingsContext = createContext<SettingsContextType | null>(null); + +export function useSettings(): LoadedSettings { + const context = useContext(SettingsContext); + if (!context) { + throw new Error('useSettings must be used within a SettingsProvider'); + } + return context.settings; +} |
