diff --git a/packages/types/src/vscode.ts b/packages/types/src/vscode.ts index 00f6bbbcba9..cddac614306 100644 --- a/packages/types/src/vscode.ts +++ b/packages/types/src/vscode.ts @@ -53,6 +53,7 @@ export const commandIds = [ "focusInput", "acceptInput", "focusPanel", + "enhancePrompt", ] as const export type CommandId = (typeof commandIds)[number] diff --git a/src/activate/registerCommands.ts b/src/activate/registerCommands.ts index bd925b0e900..fbd4db3e904 100644 --- a/src/activate/registerCommands.ts +++ b/src/activate/registerCommands.ts @@ -218,6 +218,15 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt visibleProvider.postMessageToWebview({ type: "acceptInput" }) }, + enhancePrompt: () => { + const visibleProvider = getVisibleProviderOrLog(outputChannel) + + if (!visibleProvider) { + return + } + + visibleProvider.postMessageToWebview({ type: "action", action: "triggerEnhancePrompt" as any }) + }, }) export const openClineInNewTab = async ({ context, outputChannel }: Omit) => { diff --git a/src/package.json b/src/package.json index 5e3cd3bc530..8474e6b2f74 100644 --- a/src/package.json +++ b/src/package.json @@ -174,6 +174,11 @@ "command": "roo-cline.acceptInput", "title": "%command.acceptInput.title%", "category": "%configuration.title%" + }, + { + "command": "roo-cline.enhancePrompt", + "title": "%command.enhancePrompt.title%", + "category": "%configuration.title%" } ], "menus": { @@ -388,7 +393,15 @@ "description": "%settings.autoImportSettingsPath.description%" } } - } + }, + "keybindings": [ + { + "command": "roo-cline.enhancePrompt", + "key": "ctrl+shift+e", + "mac": "cmd+shift+e", + "when": "view == roo-cline.SidebarProvider || activeWebviewPanelId == roo-cline.TabPanelProvider" + } + ] }, "scripts": { "lint": "eslint . --ext=ts --max-warnings=0", diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 4f2aa2da159..ea641f87045 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -120,6 +120,7 @@ export interface ExtensionMessage { | "didBecomeVisible" | "focusInput" | "switchTab" + | "triggerEnhancePrompt" invoke?: "newChat" | "sendMessage" | "primaryButtonClick" | "secondaryButtonClick" | "setChatBoxMessage" state?: ExtensionState images?: string[] diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index 1f56829f7b3..d35a1b58ddd 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -110,6 +110,7 @@ export interface WebviewMessage { | "diagnosticsEnabled" | "enhancePrompt" | "enhancedPrompt" + | "triggerEnhancePrompt" | "draggedImages" | "deleteMessage" | "deleteMessageConfirm" diff --git a/webview-ui/src/App.tsx b/webview-ui/src/App.tsx index 3c4c14f5dfe..abe3cfa6a00 100644 --- a/webview-ui/src/App.tsx +++ b/webview-ui/src/App.tsx @@ -169,6 +169,10 @@ const App = () => { if (message.type === "acceptInput") { chatViewRef.current?.acceptInput() } + + if (message.type === "action" && message.action === "triggerEnhancePrompt") { + chatViewRef.current?.triggerEnhancePrompt() + } }, [switchTab], ) diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index 6c541353eb2..afb394f2995 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -31,6 +31,8 @@ import { cn } from "@/lib/utils" import { usePromptHistory } from "./hooks/usePromptHistory" import { EditModeControls } from "./EditModeControls" +const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0 + interface ChatTextAreaProps { inputValue: string setInputValue: (value: string) => void @@ -1110,7 +1112,7 @@ const ChatTextArea = forwardRef( />
- +