Add version info to status bar item

This commit is contained in:
Lukas Wirth 2024-06-07 14:20:05 +02:00
parent 7c5d496ef8
commit 0ee8a4f472
2 changed files with 46 additions and 24 deletions

View file

@ -9,7 +9,6 @@ import {
applySnippetTextEdits,
type SnippetTextDocumentEdit,
} from "./snippets";
import { spawnSync } from "child_process";
import { type RunnableQuickPick, selectRunnable, createTask, createArgs } from "./run";
import { AstInspector } from "./ast_inspector";
import {
@ -415,10 +414,9 @@ export function serverVersion(ctx: CtxInit): Cmd {
void vscode.window.showWarningMessage(`rust-analyzer server is not running`);
return;
}
const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" });
const versionString = stdout.slice(`rust-analyzer `.length).trim();
void vscode.window.showInformationMessage(`rust-analyzer version: ${versionString}`);
void vscode.window.showInformationMessage(
`rust-analyzer version: ${ctx.serverVersion} [${ctx.serverPath}]`,
);
};
}