@@ -473,12 +473,12 @@ export function viewItemTree(ctx: Ctx): Cmd {
473
473
474
474
function crateGraph ( ctx : Ctx , full : boolean ) : Cmd {
475
475
return async ( ) => {
476
- const node_modules_path = vscode . Uri . file ( path . join ( ctx . extensionPath , "node_modules" ) ) ;
476
+ const nodeModulesPath = vscode . Uri . file ( path . join ( ctx . extensionPath , "node_modules" ) ) ;
477
477
478
478
const panel = vscode . window . createWebviewPanel ( "rust-analyzer.crate-graph" , "rust-analyzer crate graph" , vscode . ViewColumn . Two , {
479
479
enableScripts : true ,
480
480
retainContextWhenHidden : true ,
481
- localResourceRoots : [ node_modules_path ]
481
+ localResourceRoots : [ nodeModulesPath ]
482
482
} ) ;
483
483
const params = {
484
484
full : full ,
@@ -487,15 +487,15 @@ function crateGraph(ctx: Ctx, full: boolean): Cmd {
487
487
const dot = await ctx . client . sendRequest ( ra . viewCrateGraph , params ) ;
488
488
489
489
const scripts = [
490
- { file : vscode . Uri . joinPath ( node_modules_path , 'd3' , 'dist' , 'd3.min.js' ) } ,
491
- { file : vscode . Uri . joinPath ( node_modules_path , '@hpcc-js' , 'wasm' , 'dist' , 'index.min.js' ) , worker : true } ,
492
- { file : vscode . Uri . joinPath ( node_modules_path , 'd3-graphviz' , 'build' , 'd3-graphviz.min.js' ) } ,
493
- ]
490
+ { file : vscode . Uri . joinPath ( nodeModulesPath , 'd3' , 'dist' , 'd3.min.js' ) } ,
491
+ { file : vscode . Uri . joinPath ( nodeModulesPath , '@hpcc-js' , 'wasm' , 'dist' , 'index.min.js' ) , worker : true } ,
492
+ { file : vscode . Uri . joinPath ( nodeModulesPath , 'd3-graphviz' , 'build' , 'd3-graphviz.min.js' ) } ,
493
+ ] ;
494
494
495
- const scripts_html = scripts . map ( ( { file, worker } ) => {
496
- let uri = panel . webview . asWebviewUri ( file ) ;
497
- return `<script type="${ worker ? "javascript/worker" : "text/javascript" } " src="${ uri } "></script>`
498
- } ) . join ( "\n" )
495
+ const scriptsHtml = scripts . map ( ( { file, worker } ) => {
496
+ const uri = panel . webview . asWebviewUri ( file ) ;
497
+ return `<script type="${ worker ? "javascript/worker" : "text/javascript" } " src="${ uri } "></script>` ;
498
+ } ) . join ( "\n" ) ;
499
499
500
500
const html = `
501
501
<!DOCTYPE html>
@@ -515,7 +515,7 @@ function crateGraph(ctx: Ctx, full: boolean): Cmd {
515
515
</style>
516
516
</head>
517
517
<body>
518
- ${ scripts_html }
518
+ ${ scriptsHtml }
519
519
<div id="graph"></div>
520
520
<script>
521
521
let graph = d3.select("#graph")
0 commit comments