From 88cac3c9d8ec23f324842e8efc8fe3a9caca9d94 Mon Sep 17 00:00:00 2001 From: Aleksandr Kirillov <32141102+axkirillov@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:54:49 +0200 Subject: [PATCH] feat: add command to focus Roo Code input field (#2369) * feat: add command to focus Roo Code input field * fixup! feat: add command to focus Roo Code input field * fixup! feat: add command to focus Roo Code input field --- package.json | 5 +++++ src/activate/registerCommands.ts | 3 +++ src/shared/ExtensionMessage.ts | 1 + webview-ui/src/components/chat/ChatView.tsx | 3 +++ 4 files changed, 12 insertions(+) diff --git a/package.json b/package.json index aa42751327..71770527eb 100644 --- a/package.json +++ b/package.json @@ -174,6 +174,11 @@ "command": "roo-cline.setCustomStoragePath", "title": "Set Custom Storage Path", "category": "Roo Code" + }, + { + "command": "roo-cline.focusInput", + "title": "Focus Input Field", + "category": "Roo Code" } ], "menus": { diff --git a/src/activate/registerCommands.ts b/src/activate/registerCommands.ts index 4af6b81c54..c0b50113c9 100644 --- a/src/activate/registerCommands.ts +++ b/src/activate/registerCommands.ts @@ -114,6 +114,9 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt const { promptForCustomStoragePath } = await import("../shared/storagePathManager") await promptForCustomStoragePath() }, + "roo-cline.focusInput": () => { + provider.postMessageToWebview({ type: "action", action: "focusInput" }) + }, } } diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 095279ffde..6a56585e54 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -77,6 +77,7 @@ export interface ExtensionMessage { | "historyButtonClicked" | "promptsButtonClicked" | "didBecomeVisible" + | "focusInput" invoke?: "newChat" | "sendMessage" | "primaryButtonClick" | "secondaryButtonClick" | "setChatBoxMessage" state?: ExtensionState images?: string[] diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index cb63d9d9b8..e38ad28c93 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -497,6 +497,9 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie textAreaRef.current?.focus() } break + case "focusInput": + textAreaRef.current?.focus() + break } break case "selectedImages":