MCPcopy Create free account
hub / github.com/backnotprop/plannotator / open

Method open

apps/vscode-extension/src/panel-manager.ts:19–51  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

17 }
18
19 async open(url: string): Promise<vscode.WebviewPanel> {
20 const resolved = await vscode.env.asExternalUri(vscode.Uri.parse(url));
21 const resolvedUrl = resolved.toString();
22
23 const panel = vscode.window.createWebviewPanel(
24 "plannotator",
25 "Plannotator",
26 vscode.ViewColumn.One,
27 { enableScripts: true, retainContextWhenHidden: true },
28 );
29 panel.iconPath = vscode.Uri.file(
30 path.join(this.extensionPath, "images", "icon.png"),
31 );
32 const origin = `${resolved.scheme}://${resolved.authority}`;
33 panel.webview.html = getHtml(resolvedUrl, origin);
34
35 const messageSub = panel.webview.onDidReceiveMessage(async (raw: unknown) => {
36 const msg = raw as WebviewMessage;
37 if (msg.type === "plannotator-clipboard-write") {
38 await vscode.env.clipboard.writeText(msg.text ?? "");
39 } else if (msg.type === "plannotator-clipboard-read") {
40 const text = await vscode.env.clipboard.readText();
41 panel.webview.postMessage({ type: "plannotator-clipboard-data", id: msg.id, text });
42 }
43 });
44
45 this.panels.add(panel);
46 panel.onDidDispose(() => {
47 messageSub.dispose();
48 this.panels.delete(panel);
49 });
50 return panel;
51 }
52
53 closeAll(): void {
54 for (const panel of this.panels) {

Callers 8

AppFunction · 0.80
useLinkedDocFunction · 0.80
useArchiveFunction · 0.80
ReviewAppFunction · 0.80
handleKeyDownFunction · 0.80
openInPanelFunction · 0.80
scan_projectsFunction · 0.80

Calls 10

getHtmlFunction · 0.85
parseMethod · 0.80
toStringMethod · 0.80
fileMethod · 0.80
onDidReceiveMessageMethod · 0.80
postMessageMethod · 0.80
addMethod · 0.80
onDidDisposeMethod · 0.80
deleteMethod · 0.80
disposeMethod · 0.65

Tested by

no test coverage detected