( tabPanel: vscode.WebviewPanel | undefined, sidebarPanel: vscode.WebviewView | undefined, )
| 9 | * @returns Promise that resolves when focus is complete |
| 10 | */ |
| 11 | export async function focusPanel( |
| 12 | tabPanel: vscode.WebviewPanel | undefined, |
| 13 | sidebarPanel: vscode.WebviewView | undefined, |
| 14 | ): Promise<void> { |
| 15 | const panel = tabPanel || sidebarPanel |
| 16 | |
| 17 | if (!panel) { |
| 18 | // If no panel is open, open the sidebar |
| 19 | await vscode.commands.executeCommand(`workbench.view.extension.${Package.name}-ActivityBar`) |
| 20 | } else if (panel === tabPanel && !panel.active) { |
| 21 | // For tab panels, use reveal to focus |
| 22 | panel.reveal(vscode.ViewColumn.Active, false) |
| 23 | } else if (panel === sidebarPanel) { |
| 24 | // For sidebar panels, focus the sidebar |
| 25 | await vscode.commands.executeCommand(`${ClineProvider.sideBarId}.focus`) |
| 26 | } |
| 27 | } |
no test coverage detected