Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit c7d1230

Browse files
committed
feat: add lock API config toggle to Settings providers tab (#12237)
Adds a "Use the same API configuration for all modes" checkbox to the Providers section in Settings, making the existing lockApiConfigAcrossModes feature discoverable without needing to find the small lock icon inside the API Configuration popover. - Adds VSCodeCheckbox to SettingsView providers tab bound to cachedState - Sends lockApiConfigAcrossModes message on save (same handler as popover) - Adds i18n strings for the label and description - Adds test coverage for rendering, toggling, and save behavior
1 parent ad25634 commit c7d1230

3 files changed

Lines changed: 382 additions & 0 deletions

File tree

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ import {
3939
ImageGenerationProvider,
4040
} from "@roo-code/types"
4141

42+
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
43+
4244
import { vscode } from "@src/utils/vscode"
4345
import { cn } from "@src/lib/utils"
4446
import { useAppTranslation } from "@src/i18n/TranslationContext"
@@ -203,6 +205,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
203205
includeCurrentTime,
204206
includeCurrentCost,
205207
maxGitStatusFiles,
208+
lockApiConfigAcrossModes,
206209
} = cachedState
207210

208211
const apiConfiguration = useMemo(() => cachedState.apiConfiguration ?? {}, [cachedState.apiConfiguration])
@@ -430,6 +433,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
430433
vscode.postMessage({ type: "upsertApiConfiguration", text: currentApiConfigName, apiConfiguration })
431434
vscode.postMessage({ type: "telemetrySetting", text: telemetrySetting })
432435
vscode.postMessage({ type: "debugSetting", bool: cachedState.debug })
436+
vscode.postMessage({ type: "lockApiConfigAcrossModes", bool: lockApiConfigAcrossModes ?? false })
433437

434438
setChangeDetected(false)
435439
}
@@ -766,6 +770,21 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
766770
})
767771
}
768772
/>
773+
<div className="mt-2 mb-3">
774+
<VSCodeCheckbox
775+
checked={lockApiConfigAcrossModes ?? false}
776+
onChange={(e: any) =>
777+
setCachedStateField("lockApiConfigAcrossModes", e.target.checked)
778+
}
779+
data-testid="lock-api-config-across-modes-checkbox">
780+
<span className="font-medium">
781+
{t("settings:providers.lockApiConfigAcrossModes")}
782+
</span>
783+
</VSCodeCheckbox>
784+
<div className="text-vscode-descriptionForeground text-sm mt-1 ml-5">
785+
{t("settings:providers.lockApiConfigAcrossModesDescription")}
786+
</div>
787+
</div>
769788
<ApiOptions
770789
uriScheme={uriScheme}
771790
apiConfiguration={apiConfiguration}

0 commit comments

Comments
 (0)