@@ -8,6 +8,7 @@ import { Package } from "../shared/package"
88import { getCommand } from "../utils/commands"
99import { ClineProvider } from "../core/webview/ClineProvider"
1010import { ContextProxy } from "../core/config/ContextProxy"
11+ import { focusPanel } from "../utils/focusPanel"
1112
1213import { registerHumanRelayCallback , unregisterHumanRelayCallback , handleHumanRelayResponse } from "./humanRelay"
1314import { handleNewTask } from "./handleTask"
@@ -172,20 +173,23 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
172173 } ,
173174 focusInput : async ( ) => {
174175 try {
175- const panel = getPanel ( )
176-
177- if ( ! panel ) {
178- await vscode . commands . executeCommand ( `workbench.view.extension.${ Package . name } -ActivityBar` )
179- } else if ( panel === tabPanel ) {
180- panel . reveal ( vscode . ViewColumn . Active , false )
181- } else if ( panel === sidebarPanel ) {
182- await vscode . commands . executeCommand ( `${ ClineProvider . sideBarId } .focus` )
176+ await focusPanel ( tabPanel , sidebarPanel )
177+
178+ // Send focus input message only for sidebar panels
179+ if ( sidebarPanel && getPanel ( ) === sidebarPanel ) {
183180 provider . postMessageToWebview ( { type : "action" , action : "focusInput" } )
184181 }
185182 } catch ( error ) {
186183 outputChannel . appendLine ( `Error focusing input: ${ error } ` )
187184 }
188185 } ,
186+ focusPanel : async ( ) => {
187+ try {
188+ await focusPanel ( tabPanel , sidebarPanel )
189+ } catch ( error ) {
190+ outputChannel . appendLine ( `Error focusing panel: ${ error } ` )
191+ }
192+ } ,
189193 acceptInput : ( ) => {
190194 const visibleProvider = getVisibleProviderOrLog ( outputChannel )
191195
0 commit comments