mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Reduce path handling code
This commit is contained in:
parent
1039acb10a
commit
6d59219d26
1 changed files with 6 additions and 4 deletions
|
@ -473,10 +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 () => {
|
||||||
|
let node_modules_path = 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: [vscode.Uri.joinPath(vscode.Uri.parse(ctx.extensionPath), "node_modules")]
|
localResourceRoots: [node_modules_path]
|
||||||
});
|
});
|
||||||
const params = {
|
const params = {
|
||||||
full: full,
|
full: full,
|
||||||
|
@ -486,9 +488,9 @@ function crateGraph(ctx: Ctx, full: boolean): Cmd {
|
||||||
console.log(dot);
|
console.log(dot);
|
||||||
|
|
||||||
let scripts = [
|
let scripts = [
|
||||||
{ file: vscode.Uri.file(path.join(ctx.extensionPath, 'node_modules', 'd3', 'dist', 'd3.min.js')) },
|
{ file: vscode.Uri.joinPath(node_modules_path, 'd3', 'dist', 'd3.min.js') },
|
||||||
{ file: vscode.Uri.file(path.join(ctx.extensionPath, 'node_modules', '@hpcc-js', 'wasm', 'dist', 'index.min.js')), worker: true },
|
{ file: vscode.Uri.joinPath(node_modules_path, '@hpcc-js', 'wasm', 'dist', 'index.min.js'), worker: true },
|
||||||
{ file: vscode.Uri.file(path.join(ctx.extensionPath, 'node_modules', 'd3-graphviz', 'build', 'd3-graphviz.min.js')) },
|
{ file: vscode.Uri.joinPath(node_modules_path, 'd3-graphviz', 'build', 'd3-graphviz.min.js') },
|
||||||
]
|
]
|
||||||
console.log(scripts);
|
console.log(scripts);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue