Browse Source

Fix: focusInput open roo code panel (#2626) (#2817)

* Fix: focusInput open roo code panel (#2626)

* Fix: `roo-cline.focusInput` open roo code panel

* fixup! Fix: focusInput open roo code panel (#2626)
hongzio 8 months ago
parent
commit
33ee5d6c34
1 changed files with 14 additions and 2 deletions
  1. 14 2
      src/activate/registerCommands.ts

+ 14 - 2
src/activate/registerCommands.ts

@@ -114,8 +114,20 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
 			const { promptForCustomStoragePath } = await import("../shared/storagePathManager")
 			await promptForCustomStoragePath()
 		},
-		"roo-cline.focusInput": () => {
-			provider.postMessageToWebview({ type: "action", action: "focusInput" })
+		"roo-cline.focusInput": async () => {
+			try {
+				const panel = getPanel()
+				if (!panel) {
+					await vscode.commands.executeCommand("workbench.view.extension.roo-cline-ActivityBar")
+				} else if (panel === tabPanel) {
+					panel.reveal(vscode.ViewColumn.Active, false)
+				} else if (panel === sidebarPanel) {
+					await vscode.commands.executeCommand(`${ClineProvider.sideBarId}.focus`)
+					provider.postMessageToWebview({ type: "action", action: "focusInput" })
+				}
+			} catch (error) {
+				outputChannel.appendLine(`Error focusing input: ${error}`)
+			}
 		},
 		"roo.acceptInput": () => {
 			const visibleProvider = getVisibleProviderOrLog(outputChannel)