aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2021-03-12 17:49:00 +0000
committerLaurenČ›iu Nicola <[email protected]>2021-03-12 17:49:00 +0000
commit88ef0541a5110563f3f2e92532da37209d264ad9 (patch)
tree4e7a8cdab4df02b11434049e0f70daf952a54098
parentc0459c53572f90fa9134192e432562af3daba5fa (diff)
Improve version display
-rw-r--r--crates/rust-analyzer/build.rs5
-rw-r--r--editors/code/src/commands.ts5
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() {
39} 39}
40 40
41fn rev() -> Option<String> { 41fn rev() -> Option<String> {
42 let output = Command::new("git").args(&["rev-parse", "HEAD"]).output().ok()?; 42 let output = Command::new("git").args(&["describe", "--tags"]).output().ok()?;
43 let stdout = String::from_utf8(output.stdout).ok()?; 43 let stdout = String::from_utf8(output.stdout).ok()?;
44 let short_hash = stdout.get(0..7)?; 44 Some(stdout)
45 Some(short_hash.to_owned())
46} 45}
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 {
253export function serverVersion(ctx: Ctx): Cmd { 253export function serverVersion(ctx: Ctx): Cmd {
254 return async () => { 254 return async () => {
255 const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" }); 255 const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" });
256 const commitHash = stdout.slice(`rust-analyzer `.length).trim(); 256 const versionString = stdout.slice(`rust-analyzer `.length).trim();
257 const { releaseTag } = ctx.config.package;
258 257
259 void vscode.window.showInformationMessage( 258 void vscode.window.showInformationMessage(
260 `rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})` 259 `rust-analyzer version: ${versionString}`
261 ); 260 );
262 }; 261 };
263} 262}