Skip to content

Commit

Permalink
feat: AnalyzerStatusParams
Browse files Browse the repository at this point in the history
FYI #256
  • Loading branch information
fannheyward committed Sep 30, 2020
1 parent 35caf3e commit 473a2a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ function countLines(text: string): number {

export function analyzerStatus(ctx: Ctx): Cmd {
return async () => {
const ret = await ctx.client.sendRequest(ra.analyzerStatus);
const { document } = await workspace.getCurrentState();
if (!isRustDocument(document)) return;
const params: ra.AnalyzerStatusParams = {
textDocument: { uri: document.uri },
};
const ret = await ctx.client.sendRequest(ra.analyzerStatus, params);
workspace.echoLines(ret.split('\n'));
};
}
Expand Down
5 changes: 4 additions & 1 deletion src/lsp_ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

import * as lc from 'vscode-languageserver-protocol';

export const analyzerStatus = new lc.RequestType0<string, void>('rust-analyzer/analyzerStatus');
export interface AnalyzerStatusParams {
textDocument?: lc.TextDocumentIdentifier;
}
export const analyzerStatus = new lc.RequestType<AnalyzerStatusParams, string, void>('rust-analyzer/analyzerStatus');
export const memoryUsage = new lc.RequestType0<string, void>('rust-analyzer/memoryUsage');

export type Status = 'loading' | 'ready' | 'invalid' | 'needsReload';
Expand Down

0 comments on commit 473a2a8

Please sign in to comment.