From 88ef0541a5110563f3f2e92532da37209d264ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Fri, 12 Mar 2021 19:49:00 +0200 Subject: Improve version display --- crates/rust-analyzer/build.rs | 5 ++--- editors/code/src/commands.ts | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/rust-analyzer/build.rs b/crates/rust-analyzer/build.rs index 5ae76ba30..999dc5928 100644 --- a/crates/rust-analyzer/build.rs +++ b/crates/rust-analyzer/build.rs @@ -39,8 +39,7 @@ fn set_rerun() { } fn rev() -> Option { - let output = Command::new("git").args(&["rev-parse", "HEAD"]).output().ok()?; + let output = Command::new("git").args(&["describe", "--tags"]).output().ok()?; let stdout = String::from_utf8(output.stdout).ok()?; - let short_hash = stdout.get(0..7)?; - Some(short_hash.to_owned()) + Some(stdout) } diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index 283b9a160..3e96fbad8 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -253,11 +253,10 @@ export function ssr(ctx: Ctx): Cmd { export function serverVersion(ctx: Ctx): Cmd { return async () => { const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" }); - const commitHash = stdout.slice(`rust-analyzer `.length).trim(); - const { releaseTag } = ctx.config.package; + const versionString = stdout.slice(`rust-analyzer `.length).trim(); void vscode.window.showInformationMessage( - `rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})` + `rust-analyzer version: ${versionString}` ); }; } -- cgit v1.2.3