Skip to content

Commit e7658b0

Browse files
committed
feat: add command to focus Roo Code input field
1 parent 60e122f commit e7658b0

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@
174174
"command": "roo-cline.setCustomStoragePath",
175175
"title": "Set Custom Storage Path",
176176
"category": "Roo Code"
177+
},
178+
{
179+
"command": "roo-cline.focusInput",
180+
"title": "Focus Input Field",
181+
"category": "Roo Code"
177182
}
178183
],
179184
"menus": {

src/activate/registerCommands.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
9292
const { promptForCustomStoragePath } = await import("../shared/storagePathManager")
9393
await promptForCustomStoragePath()
9494
},
95+
"roo-cline.focusInput": () => {
96+
provider.postMessageToWebview({ type: "action", action: "focusInput" })
97+
},
9598
}
9699
}
97100

src/shared/ExtensionMessage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export interface ExtensionMessage {
7777
| "historyButtonClicked"
7878
| "promptsButtonClicked"
7979
| "didBecomeVisible"
80+
| "focusInput"
8081
invoke?: "newChat" | "sendMessage" | "primaryButtonClick" | "secondaryButtonClick" | "setChatBoxMessage"
8182
state?: ExtensionState
8283
images?: string[]

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
496496
}
497497
break
498498
}
499+
if (message.action === "focusInput") {
500+
textAreaRef.current?.focus()
501+
}
499502
break
500503
case "selectedImages":
501504
const newImages = message.images ?? []
@@ -1298,7 +1301,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
12981301
: primaryButtonText === t("chat:proceedAnyways.title")
12991302
? t("chat:proceedAnyways.tooltip")
13001303
: primaryButtonText ===
1301-
t("chat:proceedWhileRunning.title")
1304+
t("chat:proceedWhileRunning.title")
13021305
? t("chat:proceedWhileRunning.tooltip")
13031306
: undefined
13041307
}

0 commit comments

Comments
 (0)