about summary refs log tree commit diff
path: root/editors/code/src/commands.ts
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2021-05-11 16:15:31 +0200
committerJonas Schievink <jonasschievink@gmail.com>2021-05-11 16:15:31 +0200
commita85a2c4d151d9d2e8fb016d76aad99a6ca88bc75 (patch)
tree636c0727298fd9d60a7b2a639c49dca8ba73d813 /editors/code/src/commands.ts
parent9fa9d166d8141bb9ca4fcf0544c49b903fb85e09 (diff)
downloadrust-a85a2c4d151d9d2e8fb016d76aad99a6ca88bc75.tar.gz
rust-a85a2c4d151d9d2e8fb016d76aad99a6ca88bc75.zip
Allow viewing the crate graph in a webview
Diffstat (limited to 'editors/code/src/commands.ts')
-rw-r--r--editors/code/src/commands.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index 4092435dbe7..8ab259af221 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -429,6 +429,14 @@ export function viewHir(ctx: Ctx): Cmd {
     };
 }
 
+export function viewCrateGraph(ctx: Ctx): Cmd {
+    return async () => {
+        const panel = vscode.window.createWebviewPanel("rust-analyzer.crate-graph", "rust-analyzer crate graph", vscode.ViewColumn.Two);
+        const svg = await ctx.client.sendRequest(ra.viewCrateGraph);
+        panel.webview.html = svg;
+    };
+}
+
 // Opens the virtual file that will show the syntax tree
 //
 // The contents of the file come from the `TextDocumentContentProvider`