From 94da9f6669d29d681386dabecf760e49ae16656e Mon Sep 17 00:00:00 2001 From: Sarah Fortune Date: Sat, 27 Sep 2025 02:37:58 +0000 Subject: [PATCH] Only show the info banner messages about the right sidebar in VSCode (#6492) Add a `type` field to the PlatConfig with type of the IDE: VSCode, standalone, etc. Make the info banner conditional on the type. Quiet the gRPC logs on startup. --- src/hosts/vscode/hostbridge-grpc-service.ts | 1 - .../src/components/common/InfoBanner.tsx | 56 +++++++++---------- webview-ui/src/config/platform.config.ts | 21 +++++++ 3 files changed, 49 insertions(+), 29 deletions(-) diff --git a/src/hosts/vscode/hostbridge-grpc-service.ts b/src/hosts/vscode/hostbridge-grpc-service.ts index 19ccd1ed..243f2435 100644 --- a/src/hosts/vscode/hostbridge-grpc-service.ts +++ b/src/hosts/vscode/hostbridge-grpc-service.ts @@ -50,7 +50,6 @@ export class ServiceRegistry { } this.methodMetadata[methodName] = { isStreaming, ...metadata } - console.log(`Registered ${this.serviceName} method: ${methodName}${isStreaming ? " (streaming)" : ""}`) } /** diff --git a/webview-ui/src/components/common/InfoBanner.tsx b/webview-ui/src/components/common/InfoBanner.tsx index 70911002..00f13ecb 100644 --- a/webview-ui/src/components/common/InfoBanner.tsx +++ b/webview-ui/src/components/common/InfoBanner.tsx @@ -1,41 +1,41 @@ -import { Int64Request } from "@shared/proto/cline/common" import { VSCodeButton } from "@vscode/webview-ui-toolkit/react" import { useCallback } from "react" +import { PlatformType } from "@/config/platform.config" +import { usePlatform } from "@/context/PlatformContext" import { StateServiceClient } from "@/services/grpc-client" export const CURRENT_INFO_BANNER_VERSION = 1 export const InfoBanner: React.FC = () => { const handleClose = useCallback((e: React.MouseEvent) => { e.preventDefault() e.stopPropagation() - const request = Int64Request.create({ - value: CURRENT_INFO_BANNER_VERSION, - }) - StateServiceClient.updateInfoBannerVersion(request).catch(console.error) + StateServiceClient.updateInfoBannerVersion({ value: CURRENT_INFO_BANNER_VERSION }).catch(console.error) }, []) + if (usePlatform().type === PlatformType.VSCODE) { + return ( + +

💡 Cline in the Right Sidebar

+

+ Keep your files visible when chatting with Cline. Drag the Cline icon to the right sidebar panel for a better + experience. See how → +

- return ( -
-

💡 Cline in the Right Sidebar

-

- Keep your files visible when chatting with Cline. Drag the Cline icon to the right sidebar panel for a better - experience. See how → -

- - {/* Close button */} - - - -
- ) + {/* Close button */} + + + + + ) + } + return null } export default InfoBanner diff --git a/webview-ui/src/config/platform.config.ts b/webview-ui/src/config/platform.config.ts index 935ac937..5a7d742d 100644 --- a/webview-ui/src/config/platform.config.ts +++ b/webview-ui/src/config/platform.config.ts @@ -1,6 +1,7 @@ import platformConfigs from "./platform-configs.json" export interface PlatformConfig { + type: PlatformType messageEncoding: MessageEncoding showNavbar: boolean postMessage: PostMessageFunction @@ -10,6 +11,24 @@ export interface PlatformConfig { supportsTerminalMentions: boolean } +export enum PlatformType { + VSCODE = 0, + STANDALONE = 1, +} + +function stringToPlatformType(name: string): PlatformType { + const mapping: Record = { + vscode: PlatformType.VSCODE, + standalone: PlatformType.STANDALONE, + } + if (name in mapping) { + return mapping[name] + } + console.error("Unknown platform:", name) + // Default to VSCode for unknown types + return PlatformType.VSCODE +} + // Internal type for JSON structure (not exported) type PlatformConfigJson = { messageEncoding: "none" | "json" @@ -76,7 +95,9 @@ const selectedConfig = configs[__PLATFORM__] console.log("[PLATFORM_CONFIG] Build platform:", __PLATFORM__) // Build the platform config with injected functions +// Callers should use this in the situations where the react component is not available. export const PLATFORM_CONFIG: PlatformConfig = { + type: stringToPlatformType(__PLATFORM__), messageEncoding: selectedConfig.messageEncoding, showNavbar: selectedConfig.showNavbar, postMessage: postMessageStrategies[selectedConfig.postMessageHandler],