Parcourir la source

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
Aleksandr Kirillov il y a 8 mois
Parent
commit
88cac3c9d8

+ 5 - 0
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": {

+ 3 - 0
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" })
+		},
 	}
 }
 

+ 1 - 0
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[]

+ 3 - 0
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":