Formatting issues

This commit is contained in:
André Oliveira 2021-08-09 17:45:42 +00:00
parent 5e571a375b
commit 11bbaecca0
2 changed files with 12 additions and 12 deletions

View file

@ -3,7 +3,7 @@
//! `ide` crate. //! `ide` crate.
use std::{ use std::{
io::{Write as _}, io::Write as _,
process::{self, Stdio}, process::{self, Stdio},
}; };

View file

@ -473,12 +473,12 @@ export function viewItemTree(ctx: Ctx): Cmd {
function crateGraph(ctx: Ctx, full: boolean): Cmd { function crateGraph(ctx: Ctx, full: boolean): Cmd {
return async () => { return async () => {
const node_modules_path = vscode.Uri.file(path.join(ctx.extensionPath, "node_modules")); const nodeModulesPath = vscode.Uri.file(path.join(ctx.extensionPath, "node_modules"));
const panel = vscode.window.createWebviewPanel("rust-analyzer.crate-graph", "rust-analyzer crate graph", vscode.ViewColumn.Two, { const panel = vscode.window.createWebviewPanel("rust-analyzer.crate-graph", "rust-analyzer crate graph", vscode.ViewColumn.Two, {
enableScripts: true, enableScripts: true,
retainContextWhenHidden: true, retainContextWhenHidden: true,
localResourceRoots: [node_modules_path] localResourceRoots: [nodeModulesPath]
}); });
const params = { const params = {
full: full, full: full,
@ -487,15 +487,15 @@ function crateGraph(ctx: Ctx, full: boolean): Cmd {
const dot = await ctx.client.sendRequest(ra.viewCrateGraph, params); const dot = await ctx.client.sendRequest(ra.viewCrateGraph, params);
const scripts = [ const scripts = [
{ file: vscode.Uri.joinPath(node_modules_path, 'd3', 'dist', 'd3.min.js') }, { file: vscode.Uri.joinPath(nodeModulesPath, 'd3', 'dist', 'd3.min.js') },
{ file: vscode.Uri.joinPath(node_modules_path, '@hpcc-js', 'wasm', 'dist', 'index.min.js'), worker: true }, { file: vscode.Uri.joinPath(nodeModulesPath, '@hpcc-js', 'wasm', 'dist', 'index.min.js'), worker: true },
{ file: vscode.Uri.joinPath(node_modules_path, 'd3-graphviz', 'build', 'd3-graphviz.min.js') }, { file: vscode.Uri.joinPath(nodeModulesPath, 'd3-graphviz', 'build', 'd3-graphviz.min.js') },
] ];
const scripts_html = scripts.map(({ file, worker }) => { const scriptsHtml = scripts.map(({ file, worker }) => {
let uri = panel.webview.asWebviewUri(file); const uri = panel.webview.asWebviewUri(file);
return `<script type="${worker ? "javascript/worker" : "text/javascript"}" src="${uri}"></script>` return `<script type="${worker ? "javascript/worker" : "text/javascript"}" src="${uri}"></script>`;
}).join("\n") }).join("\n");
const html = ` const html = `
<!DOCTYPE html> <!DOCTYPE html>
@ -515,7 +515,7 @@ function crateGraph(ctx: Ctx, full: boolean): Cmd {
</style> </style>
</head> </head>
<body> <body>
${scripts_html} ${scriptsHtml}
<div id="graph"></div> <div id="graph"></div>
<script> <script>
let graph = d3.select("#graph") let graph = d3.select("#graph")