Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 1x 4x 4x 4x 4x 2x 1x 1x 2x 2x 2x 2x 1x 1x | import * as vscode from 'vscode';
import { container } from 'tsyringe';
import { ServiceToken } from '@src/services/tokens';
import { WebviewControllerRegistry } from '@src/views/webviews';
export const showWebview = {
id: 'mentor.webview.show',
handler: async (arg?: { id?: string } | string) => {
const registry = container.resolve<WebviewControllerRegistry>(ServiceToken.WebviewControllerRegistry);
const targets = registry.collectTargets();
const id = typeof arg === 'string' ? arg : arg?.id;
let selectedView: Target | undefined = id
? targets.find(t => t.id === id)
: await vscode.window.showQuickPick(
targets.map(t => ({ label: t.label, description: t.id, t })),
{ title: 'Select webview to show' }
).then(r => r?.t);
if (!selectedView) {
return;
}
const controller = registry.findById(selectedView.id);
Iif (!controller) {
vscode.window.showErrorMessage(`Webview not found for id: ${selectedView.id}`);
return;
}
if (selectedView.kind === 'panel') {
controller.show(vscode.ViewColumn.Active);
} else {
await vscode.commands.executeCommand(`${selectedView.id}.focus`);
}
}
};
type Target = { kind: 'panel' | 'view'; id: string; label: string }; |