Skip to content

Commit

Permalink
feat: rust-analyzer.viewFullCrateGraph
Browse files Browse the repository at this point in the history
  • Loading branch information
fannheyward committed Jul 2, 2021
1 parent 783e9f4 commit 70a051e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ You can use these commands by `:CocCommand XYZ`.
| rust-analyzer.upgrade | Download latest `rust-analyzer` from [GitHub release](https://github.com/rust-analyzer/rust-analyzer/releases) |
| rust-analyzer.viewHir | View Hir |
| rust-analyzer.viewCrateGraph | View Crate Graph |
| rust-analyzer.viewFullCrateGraph | View Crate Graph (Full) |

## Highlight Group

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,11 @@
"title": "View Crate Graph",
"category": "Rust Analyzer"
},
{
"command": "rust-analyzer.viewFullCrateGraph",
"title": "View Crate Graph (Full)",
"category": "Rust Analyzer"
},
{
"command": "rust-analyzer.echoRunCommandLine",
"title": "Echo Run Command Line",
Expand Down
9 changes: 8 additions & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,14 @@ export function moveItemDown(ctx: Ctx): Cmd {

export function viewCrateGraph(ctx: Ctx): Cmd {
return async () => {
const svg = await ctx.client.sendRequest(ra.viewCrateGraph);
const svg = await ctx.client.sendRequest(ra.viewCrateGraph, { full: false });
window.echoLines([svg]);
};
}

export function viewFullCrateGraph(ctx: Ctx): Cmd {
return async () => {
const svg = await ctx.client.sendRequest(ra.viewCrateGraph, { full: true });
window.echoLines([svg]);
};
}
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
ctx.registerCommand('serverVersion', cmds.serverVersion);
ctx.registerCommand('analyzerStatus', cmds.analyzerStatus);
ctx.registerCommand('viewCrateGraph', cmds.viewCrateGraph);
ctx.registerCommand('viewFullCrateGraph', cmds.viewFullCrateGraph);
ctx.registerCommand('reloadWorkspace', cmds.reloadWorkspace);
ctx.registerCommand('toggleInlayHints', cmds.toggleInlayHints);
ctx.registerCommand('echoRunCommandLine', cmds.echoRunCommandLine);
Expand Down
6 changes: 5 additions & 1 deletion src/lsp_ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 70a051e

Please sign in to comment.