mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
Embed the scripts in the html template
This commit is contained in:
parent
51a6d2204e
commit
7666eb1fb8
1 changed files with 4 additions and 12 deletions
|
@ -485,17 +485,7 @@ function crateGraph(ctx: Ctx, full: boolean): Cmd {
|
|||
};
|
||||
|
||||
const dot = await ctx.client.sendRequest(ra.viewCrateGraph, params);
|
||||
|
||||
const scripts = [
|
||||
{ file: '/d3/dist/d3.min.js' },
|
||||
{ file: '/@hpcc-js/wasm/dist/index.min.js', worker: true },
|
||||
{ file: '/d3-graphviz/build/d3-graphviz.min.js' },
|
||||
];
|
||||
|
||||
const scriptsHtml = scripts.map(({ file, worker }) => {
|
||||
const uri = panel.webview.asWebviewUri(vscode.Uri.joinPath(nodeModulesPath, file));
|
||||
return `<script type="${worker ? "javascript/worker" : "text/javascript"}" src="${uri}"></script>`;
|
||||
}).join("\n");
|
||||
const uri = panel.webview.asWebviewUri(nodeModulesPath);
|
||||
|
||||
const html = `
|
||||
<!DOCTYPE html>
|
||||
|
@ -515,7 +505,9 @@ function crateGraph(ctx: Ctx, full: boolean): Cmd {
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
${scriptsHtml}
|
||||
<script type="text/javascript" src="${uri}/d3/dist/d3.min.js"></script>
|
||||
<script type="javascript/worker" src="${uri}/@hpcc-js/wasm/dist/index.min.js"></script>
|
||||
<script type="text/javascript" src="${uri}/d3-graphviz/build/d3-graphviz.min.js"></script>
|
||||
<div id="graph"></div>
|
||||
<script>
|
||||
let graph = d3.select("#graph")
|
||||
|
|
Loading…
Reference in a new issue