From e7658b0a97cfde702205d422049358082456a483 Mon Sep 17 00:00:00 2001 From: Aleksandr Kirillov <32141102+axkirillov@users.noreply.github.com> Date: Mon, 7 Apr 2025 10:44:20 +0200 Subject: [PATCH 1/3] 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 | 5 ++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d245cca60c7c..d79391eea670 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 827c3cd45576..6f00cde46b19 100644 --- a/src/activate/registerCommands.ts +++ b/src/activate/registerCommands.ts @@ -92,6 +92,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 60c20b6503fb..3aac25ce563e 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 407548573218..fb4a2299ad5f 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -496,6 +496,9 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie } break } + if (message.action === "focusInput") { + textAreaRef.current?.focus() + } break case "selectedImages": const newImages = message.images ?? [] @@ -1298,7 +1301,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie : primaryButtonText === t("chat:proceedAnyways.title") ? t("chat:proceedAnyways.tooltip") : primaryButtonText === - t("chat:proceedWhileRunning.title") + t("chat:proceedWhileRunning.title") ? t("chat:proceedWhileRunning.tooltip") : undefined } From 780918b20bc507dd6270a17b7c00c7e56a96a991 Mon Sep 17 00:00:00 2001 From: Aleksandr Kirillov <32141102+axkirillov@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:23:08 +0200 Subject: [PATCH 2/3] fixup! feat: add command to focus Roo Code input field --- webview-ui/src/components/chat/ChatView.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index fb4a2299ad5f..7c81c6d6ba83 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -495,6 +495,9 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie textAreaRef.current?.focus() } break + case "focusInput": + textAreaRef.current?.focus() + break } if (message.action === "focusInput") { textAreaRef.current?.focus() @@ -1301,7 +1304,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie : primaryButtonText === t("chat:proceedAnyways.title") ? t("chat:proceedAnyways.tooltip") : primaryButtonText === - t("chat:proceedWhileRunning.title") + t("chat:proceedWhileRunning.title") ? t("chat:proceedWhileRunning.tooltip") : undefined } From 4725090388ad85a540f971c9f4afcb98f1fdb530 Mon Sep 17 00:00:00 2001 From: Aleksandr Kirillov <32141102+axkirillov@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:50:13 +0200 Subject: [PATCH 3/3] fixup! feat: add command to focus Roo Code input field --- webview-ui/src/components/chat/ChatView.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 7c81c6d6ba83..9877f12753df 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -499,9 +499,6 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie textAreaRef.current?.focus() break } - if (message.action === "focusInput") { - textAreaRef.current?.focus() - } break case "selectedImages": const newImages = message.images ?? []