MCPcopy Index your code
hub / github.com/microsoft/SandDance / getWebviewContent

Function getWebviewContent

extensions/common-backend/src/html.ts:6–35  ·  view source on GitHub ↗
(webView: vscode.Webview, extensionPath: string, fileUriFsPath: string)

Source from the content-addressed store, hash-verified

4import * as vscode from 'vscode';
5
6export function getWebviewContent(webView: vscode.Webview, extensionPath: string, fileUriFsPath: string) {
7
8 function resourceUrl(resource: string) {
9 // Get path to resource on disk
10 const onDiskPath = vscode.Uri.file(path.join(extensionPath, 'resources', resource));
11
12 // And get the special URI to use with the webview
13 return webView.asWebviewUri(onDiskPath);
14 }
15
16 return `<!DOCTYPE html>
17<html lang="en">
18<head>
19 <meta charset="UTF-8">
20 <meta name="viewport" content="width=device-width, initial-scale=1.0">
21 <title>SandDance</title>
22 ${link(resourceUrl('app.css'))}
23</head>
24<body>
25 <div id="app"></div>
26 ${script(resourceUrl('dist.min.js'))}
27 ${script(resourceUrl('vega.js'))}
28 ${script(resourceUrl('react.production.min.js'))}
29 ${script(resourceUrl('react-dom.production.min.js'))}
30 ${script(resourceUrl('fluentui-react.js'))}
31 ${script(resourceUrl('sanddance-explorer.js'))}
32 ${script(resourceUrl('app.js'))}
33</body>
34</html>`;
35}
36
37function link(href: vscode.Uri) {
38 return `<link rel="stylesheet" type="text/css" href="${href}" />`;

Callers 1

newPanelFunction · 0.90

Calls 3

resourceUrlFunction · 0.85
scriptFunction · 0.85
linkFunction · 0.70

Tested by

no test coverage detected