mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 04:48:13 +00:00
Add "View Crate Graph (Full)"
This commit is contained in:
parent
76d8f55952
commit
5f13fb9db9
9 changed files with 58 additions and 15 deletions
|
|
@ -479,14 +479,25 @@ export function viewItemTree(ctx: Ctx): Cmd {
|
|||
};
|
||||
}
|
||||
|
||||
export function viewCrateGraph(ctx: Ctx): Cmd {
|
||||
function crateGraph(ctx: Ctx, full: boolean): 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);
|
||||
const params = {
|
||||
full: full,
|
||||
};
|
||||
const svg = await ctx.client.sendRequest(ra.viewCrateGraph, params);
|
||||
panel.webview.html = svg;
|
||||
};
|
||||
}
|
||||
|
||||
export function viewCrateGraph(ctx: Ctx): Cmd {
|
||||
return crateGraph(ctx, false);
|
||||
}
|
||||
|
||||
export function viewFullCrateGraph(ctx: Ctx): Cmd {
|
||||
return crateGraph(ctx, true);
|
||||
}
|
||||
|
||||
// Opens the virtual file that will show the syntax tree
|
||||
//
|
||||
// The contents of the file come from the `TextDocumentContentProvider`
|
||||
|
|
|
|||
|
|
@ -33,7 +33,11 @@ export interface ViewItemTreeParams {
|
|||
|
||||
export const viewItemTree = new lc.RequestType<ViewItemTreeParams, string, void>("rust-analyzer/viewItemTree");
|
||||
|
||||
export const viewCrateGraph = new lc.RequestType0<string, void>("rust-analyzer/viewCrateGraph");
|
||||
export interface ViewCrateGraphParams {
|
||||
full: boolean;
|
||||
}
|
||||
|
||||
export const viewCrateGraph = new lc.RequestType<ViewCrateGraphParams, string, void>("rust-analyzer/viewCrateGraph");
|
||||
|
||||
export interface ExpandMacroParams {
|
||||
textDocument: lc.TextDocumentIdentifier;
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ async function initCommonContext(context: vscode.ExtensionContext, ctx: Ctx) {
|
|||
ctx.registerCommand('viewHir', commands.viewHir);
|
||||
ctx.registerCommand('viewItemTree', commands.viewItemTree);
|
||||
ctx.registerCommand('viewCrateGraph', commands.viewCrateGraph);
|
||||
ctx.registerCommand('viewFullCrateGraph', commands.viewFullCrateGraph);
|
||||
ctx.registerCommand('expandMacro', commands.expandMacro);
|
||||
ctx.registerCommand('run', commands.run);
|
||||
ctx.registerCommand('copyRunCommandLine', commands.copyRunCommandLine);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue