mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Revert "Ignore workspace settings for untrusted folders" (#6672)
This commit is contained in:
@@ -4,14 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
useRef,
|
||||
useContext,
|
||||
} from 'react';
|
||||
import { useCallback, useEffect, useMemo, useState, useRef } from 'react';
|
||||
import {
|
||||
Box,
|
||||
DOMElement,
|
||||
@@ -48,7 +41,7 @@ import { ShellConfirmationDialog } from './components/ShellConfirmationDialog.js
|
||||
import { RadioButtonSelect } from './components/shared/RadioButtonSelect.js';
|
||||
import { Colors } from './colors.js';
|
||||
import { loadHierarchicalGeminiMemory } from '../config/config.js';
|
||||
import { SettingScope } from '../config/settings.js';
|
||||
import { LoadedSettings, SettingScope } from '../config/settings.js';
|
||||
import { Tips } from './components/Tips.js';
|
||||
import { ConsolePatcher } from './utils/ConsolePatcher.js';
|
||||
import { registerCleanup } from '../utils/cleanup.js';
|
||||
@@ -107,7 +100,6 @@ import { useSettingsCommand } from './hooks/useSettingsCommand.js';
|
||||
import { SettingsDialog } from './components/SettingsDialog.js';
|
||||
import { setUpdateHandler } from '../utils/handleAutoUpdate.js';
|
||||
import { appEvents, AppEvent } from '../utils/events.js';
|
||||
import { SettingsContext } from './contexts/SettingsContext.js';
|
||||
import { isNarrowWidth } from './utils/isNarrowWidth.js';
|
||||
|
||||
const CTRL_EXIT_PROMPT_DURATION_MS = 1000;
|
||||
@@ -116,26 +108,20 @@ const MAX_DISPLAYED_QUEUED_MESSAGES = 3;
|
||||
|
||||
interface AppProps {
|
||||
config: Config;
|
||||
settings: LoadedSettings;
|
||||
startupWarnings?: string[];
|
||||
version: string;
|
||||
}
|
||||
|
||||
export const AppWrapper = (props: AppProps) => {
|
||||
const kittyProtocolStatus = useKittyKeyboardProtocol();
|
||||
const settingsContext = useContext(SettingsContext);
|
||||
if (!settingsContext) {
|
||||
// This should not happen as AppWrapper is always rendered within the provider.
|
||||
throw new Error('SettingsContext is not available');
|
||||
}
|
||||
const { settings } = settingsContext;
|
||||
|
||||
return (
|
||||
<KeypressProvider
|
||||
kittyProtocolEnabled={kittyProtocolStatus.enabled}
|
||||
config={props.config}
|
||||
>
|
||||
<SessionStatsProvider>
|
||||
<VimModeProvider settings={settings}>
|
||||
<VimModeProvider settings={props.settings}>
|
||||
<App {...props} />
|
||||
</VimModeProvider>
|
||||
</SessionStatsProvider>
|
||||
@@ -143,19 +129,13 @@ export const AppWrapper = (props: AppProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
const App = ({ config, startupWarnings = [], version }: AppProps) => {
|
||||
const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
|
||||
const isFocused = useFocus();
|
||||
useBracketedPaste();
|
||||
const [updateInfo, setUpdateInfo] = useState<UpdateObject | null>(null);
|
||||
const { stdout } = useStdout();
|
||||
const nightly = version.includes('nightly');
|
||||
const { history, addItem, clearItems, loadHistory } = useHistory();
|
||||
const settingsContext = useContext(SettingsContext);
|
||||
if (!settingsContext) {
|
||||
// This should not happen as App is always rendered within the provider.
|
||||
throw new Error('SettingsContext is not available');
|
||||
}
|
||||
const { settings } = settingsContext;
|
||||
|
||||
const [idePromptAnswered, setIdePromptAnswered] = useState(false);
|
||||
const currentIDE = config.getIdeClient().getCurrentIde();
|
||||
@@ -282,7 +262,7 @@ const App = ({ config, startupWarnings = [], version }: AppProps) => {
|
||||
openThemeDialog,
|
||||
handleThemeSelect,
|
||||
handleThemeHighlight,
|
||||
} = useThemeCommand(setThemeError, addItem);
|
||||
} = useThemeCommand(settings, setThemeError, addItem);
|
||||
|
||||
const { isSettingsDialogOpen, openSettingsDialog, closeSettingsDialog } =
|
||||
useSettingsCommand();
|
||||
@@ -328,7 +308,7 @@ const App = ({ config, startupWarnings = [], version }: AppProps) => {
|
||||
openEditorDialog,
|
||||
handleEditorSelect,
|
||||
exitEditorDialog,
|
||||
} = useEditorSettings(setEditorError, addItem);
|
||||
} = useEditorSettings(settings, setEditorError, addItem);
|
||||
|
||||
const toggleCorgiMode = useCallback(() => {
|
||||
setCorgiMode((prev) => !prev);
|
||||
|
||||
Reference in New Issue
Block a user