internal: add "Shuffle Crate Graph" command

This commit is contained in:
Jonas Schievink
2021-12-07 15:38:12 +01:00
parent 9ae3158292
commit deb5c1426d
10 changed files with 106 additions and 0 deletions

View File

@@ -85,6 +85,15 @@ export function memoryUsage(ctx: Ctx): Cmd {
};
}
export function shuffleCrateGraph(ctx: Ctx): Cmd {
return async () => {
const client = ctx.client;
if (!client) return;
await client.sendRequest(ra.shuffleCrateGraph);
};
}
export function matchingBrace(ctx: Ctx): Cmd {
return async () => {
const editor = ctx.activeRustEditor;

View File

@@ -9,6 +9,7 @@ export interface AnalyzerStatusParams {
}
export const analyzerStatus = new lc.RequestType<AnalyzerStatusParams, string, void>("rust-analyzer/analyzerStatus");
export const memoryUsage = new lc.RequestType0<string, void>("rust-analyzer/memoryUsage");
export const shuffleCrateGraph = new lc.RequestType0<null, void>("rust-analyzer/shuffleCrateGraph");
export interface ServerStatusParams {
health: "ok" | "warning" | "error";

View File

@@ -117,6 +117,7 @@ async function initCommonContext(context: vscode.ExtensionContext, ctx: Ctx) {
ctx.registerCommand('analyzerStatus', commands.analyzerStatus);
ctx.registerCommand('memoryUsage', commands.memoryUsage);
ctx.registerCommand('shuffleCrateGraph', commands.shuffleCrateGraph);
ctx.registerCommand('reloadWorkspace', commands.reloadWorkspace);
ctx.registerCommand('matchingBrace', commands.matchingBrace);
ctx.registerCommand('joinLines', commands.joinLines);