From f50214b01736ddea82619ee82076be06b9373e20 Mon Sep 17 00:00:00 2001 From: MFPires Date: Tue, 28 Jan 2025 01:48:47 -0300 Subject: [PATCH] feat(settings): Add auto-approve mode switching option to Settings UI Add the ability to configure automatic mode switching approval in the Settings UI. Implementation: - Added alwaysAllowModeSwitch checkbox in the Auto-Approve Settings section - Added state management integration with useExtensionState - Added vscode.postMessage handler for state updates - Placed the setting logically between MCP tools and execute operations settings The new setting allows users to: - Enable/disable automatic approval of mode switching operations - Configure mode switching approval independently of other auto-approve settings - Maintain consistent UX with other auto-approve settings This completes the mode switching auto-approval feature, working in conjunction with: - Previously added state management in ExtensionStateContext - Core logic changes in ClineProvider - WebviewMessage type updates - Existing test coverage in ChatView.auto-approve.test.tsx --- .../src/components/settings/SettingsView.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index 81a929c..12b97f7 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -53,6 +53,8 @@ const SettingsView = ({ onDone }: SettingsViewProps) => { listApiConfigMeta, experimentalDiffStrategy, setExperimentalDiffStrategy, + alwaysAllowModeSwitch, + setAlwaysAllowModeSwitch, } = useExtensionState() const [apiErrorMessage, setApiErrorMessage] = useState(undefined) const [modelIdErrorMessage, setModelIdErrorMessage] = useState(undefined) @@ -93,6 +95,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => { apiConfiguration, }) vscode.postMessage({ type: "experimentalDiffStrategy", bool: experimentalDiffStrategy }) + vscode.postMessage({ type: "alwaysAllowModeSwitch", bool: alwaysAllowModeSwitch }) onDone() } } @@ -328,6 +331,17 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {

+
+ setAlwaysAllowModeSwitch(e.target.checked)}> + Always approve mode switching + +

+ Automatically switch between different AI modes without requiring approval +

+
+