Add platform to extension state so it's available in the webview

This commit is contained in:
Matt Rubens 2025-02-10 11:20:29 -05:00
parent c78fbed319
commit 07cff2fbd7
4 changed files with 5 additions and 1 deletions

View file

@ -2382,6 +2382,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
customModes: await this.customModesManager.getCustomModes(),
experiments: experiments ?? experimentDefault,
mcpServers: this.mcpHub?.getAllServers() ?? [],
platform: process.platform,
}
}

View file

@ -351,6 +351,7 @@ describe("ClineProvider", () => {
mode: defaultModeSlug,
customModes: [],
experiments: experimentDefault,
platform: "win32",
}
const message: ExtensionMessage = {

View file

@ -127,6 +127,7 @@ export interface ExtensionState {
autoApprovalEnabled?: boolean
customModes: ModeConfig[]
toolRequirements?: Record<string, boolean> // Map of tool names to their requirements (e.g. {"apply_diff": true} if diffEnabled)
platform: string // Operating system platform (e.g., 'win32', 'darwin', 'linux')
}
export interface ClineMessage {

View file

@ -63,6 +63,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
setExperimentEnabled,
alwaysAllowModeSwitch,
setAlwaysAllowModeSwitch,
platform,
} = useExtensionState()
const [apiErrorMessage, setApiErrorMessage] = useState<string | undefined>(undefined)
const [modelIdErrorMessage, setModelIdErrorMessage] = useState<string | undefined>(undefined)
@ -701,7 +702,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
</div>
)}
{process.platform !== "win32" && (
{platform !== "win32" && (
<div style={{ marginBottom: 15 }}>
<div style={{ display: "flex", alignItems: "center", gap: "5px" }}>
<span style={{ color: "var(--vscode-errorForeground)" }}></span>