From 8cfc0fa4f4c43d9ee62ce0e09f5bd917bd959e79 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 18 Jan 2025 15:45:17 +0800 Subject: [PATCH] basic changes with debugging logs --- src/core/webview/ClineProvider.ts | 18 ++++++++++---- src/shared/WebviewMessage.ts | 1 + webview-ui/src/components/mcp/McpView.tsx | 2 +- .../src/components/settings/SettingsView.tsx | 24 ++++++++++++++++--- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 54e47055f2..06a17e99f3 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -550,10 +550,11 @@ export class ClineProvider implements vscode.WebviewViewProvider { this.cancelTask() break case "openMcpSettings": { - const mcpSettingsFilePath = await this.mcpHub?.getMcpSettingsFilePath() - if (mcpSettingsFilePath) { - openFile(mcpSettingsFilePath) - } + await vscode.commands.executeCommand("workbench.action.openSettings") + // const mcpSettingsFilePath = await this.mcpHub?.getMcpSettingsFilePath() + // if (mcpSettingsFilePath) { + // openFile(mcpSettingsFilePath) + // } break } case "restartMcpServer": { @@ -564,6 +565,15 @@ export class ClineProvider implements vscode.WebviewViewProvider { } break } + case "openExtensionSettings": { + const mcpSettingsFilePath = await this.mcpHub?.getMcpSettingsFilePath() + if (mcpSettingsFilePath) { + openFile(mcpSettingsFilePath) + } + break + // await vscode.commands.executeCommand("workbench.action.openSettings") + // break + } // Add more switch case statements here as more webview message commands // are created within the webview context (i.e. inside media/main.js) } diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index 4fa90b3e36..1344b652f9 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -31,6 +31,7 @@ export interface WebviewMessage { | "checkpointDiff" | "checkpointRestore" | "taskCompletionViewChanges" + | "openExtensionSettings" // | "relaunchChromeDebugMode" text?: string askResponse?: ClineAskResponse diff --git a/webview-ui/src/components/mcp/McpView.tsx b/webview-ui/src/components/mcp/McpView.tsx index 7fce15a96d..54c8098984 100644 --- a/webview-ui/src/components/mcp/McpView.tsx +++ b/webview-ui/src/components/mcp/McpView.tsx @@ -141,7 +141,7 @@ const McpView = ({ onDone }: McpViewProps) => { vscode.postMessage({ type: "openMcpSettings" }) }}> - Edit MCP Settings + Edit MCP Settingssss diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index 0e328ecb42..4b2b79f338 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -5,7 +5,8 @@ import { validateApiConfiguration, validateModelId } from "../../utils/validate" import { vscode } from "../../utils/vscode" import ApiOptions from "./ApiOptions" -const IS_DEV = false // FIXME: use flags when packaging +// In development, process.env.NODE_ENV is 'development' +const IS_DEV = process.env.NODE_ENV === 'development' type SettingsViewProps = { onDone: () => void @@ -128,14 +129,31 @@ const SettingsView = ({ onDone }: SettingsViewProps) => { )} +
+ vscode.postMessage({ type: "openExtensionSettings" })} + style={{ + margin: "0 0 16px 0", + minWidth: "fit-content", + whiteSpace: "nowrap", + }}> + Advanced Settings + +