mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
Revert "Ignore workspace settings for untrusted folders" (#6672)
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { LoadedSettings, SettingScope } from '../../config/settings.js';
|
||||
import { SettingsContext } from './SettingsContext.js';
|
||||
|
||||
export type VimMode = 'NORMAL' | 'INSERT';
|
||||
|
||||
@@ -27,13 +26,11 @@ const VimModeContext = createContext<VimModeContextType | undefined>(undefined);
|
||||
|
||||
export const VimModeProvider = ({
|
||||
children,
|
||||
settings: initialSettings,
|
||||
settings,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
settings: LoadedSettings;
|
||||
}) => {
|
||||
const settingsContext = useContext(SettingsContext);
|
||||
const settings = settingsContext?.settings || initialSettings;
|
||||
const initialVimEnabled = settings.merged.vimMode ?? false;
|
||||
const [vimEnabled, setVimEnabled] = useState(initialVimEnabled);
|
||||
const [vimMode, setVimMode] = useState<VimMode>(
|
||||
|
||||
Reference in New Issue
Block a user