mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com> Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
27 lines
992 B
TypeScript
27 lines
992 B
TypeScript
import * as vscode from "vscode"
|
|
import { Package } from "../shared/package"
|
|
import { ClineProvider } from "../core/webview/ClineProvider"
|
|
|
|
/**
|
|
* Focus the active panel (either tab or sidebar)
|
|
* @param tabPanel - The tab panel reference
|
|
* @param sidebarPanel - The sidebar panel reference
|
|
* @returns Promise that resolves when focus is complete
|
|
*/
|
|
export async function focusPanel(
|
|
tabPanel: vscode.WebviewPanel | undefined,
|
|
sidebarPanel: vscode.WebviewView | undefined,
|
|
): Promise<void> {
|
|
const panel = tabPanel || sidebarPanel
|
|
|
|
if (!panel) {
|
|
// If no panel is open, open the sidebar
|
|
await vscode.commands.executeCommand(`workbench.view.extension.${Package.name}-ActivityBar`)
|
|
} else if (panel === tabPanel && !panel.active) {
|
|
// For tab panels, use reveal to focus
|
|
panel.reveal(vscode.ViewColumn.Active, false)
|
|
} else if (panel === sidebarPanel) {
|
|
// For sidebar panels, focus the sidebar
|
|
await vscode.commands.executeCommand(`${ClineProvider.sideBarId}.focus`)
|
|
}
|
|
}
|