Skip to content

Commit f50214b

Browse files
committed
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
1 parent 5bc1a50 commit f50214b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
5353
listApiConfigMeta,
5454
experimentalDiffStrategy,
5555
setExperimentalDiffStrategy,
56+
alwaysAllowModeSwitch,
57+
setAlwaysAllowModeSwitch,
5658
} = useExtensionState()
5759
const [apiErrorMessage, setApiErrorMessage] = useState<string | undefined>(undefined)
5860
const [modelIdErrorMessage, setModelIdErrorMessage] = useState<string | undefined>(undefined)
@@ -93,6 +95,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
9395
apiConfiguration,
9496
})
9597
vscode.postMessage({ type: "experimentalDiffStrategy", bool: experimentalDiffStrategy })
98+
vscode.postMessage({ type: "alwaysAllowModeSwitch", bool: alwaysAllowModeSwitch })
9699
onDone()
97100
}
98101
}
@@ -328,6 +331,17 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
328331
</p>
329332
</div>
330333

334+
<div style={{ marginBottom: 15 }}>
335+
<VSCodeCheckbox
336+
checked={alwaysAllowModeSwitch}
337+
onChange={(e: any) => setAlwaysAllowModeSwitch(e.target.checked)}>
338+
<span style={{ fontWeight: "500" }}>Always approve mode switching</span>
339+
</VSCodeCheckbox>
340+
<p style={{ fontSize: "12px", marginTop: "5px", color: "var(--vscode-descriptionForeground)" }}>
341+
Automatically switch between different AI modes without requiring approval
342+
</p>
343+
</div>
344+
331345
<div style={{ marginBottom: 15 }}>
332346
<VSCodeCheckbox
333347
checked={alwaysAllowExecute}

0 commit comments

Comments
 (0)