Skip to content

Commit ceffcf8

Browse files
bors[bot]lnicola
andauthored
Merge #7984
7984: Improve version display r=matklad a=lnicola Maybe closes #7854 The version string for unreleased builds looks like this now: ``` $ rust-analyzer --version rust-analyzer 2021-03-08-159-gc0459c535 ``` Release builds should only have the tag name (`2021-03-15`). Co-authored-by: Laurențiu Nicola <[email protected]>
2 parents fe4a94f + 88ef054 commit ceffcf8

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

crates/rust-analyzer/build.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ fn set_rerun() {
3939
}
4040

4141
fn 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()?;
4343
let stdout = String::from_utf8(output.stdout).ok()?;
44-
let short_hash = stdout.get(0..7)?;
45-
Some(short_hash.to_owned())
44+
Some(stdout)
4645
}

editors/code/src/commands.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,10 @@ export function ssr(ctx: Ctx): Cmd {
253253
export function serverVersion(ctx: Ctx): Cmd {
254254
return async () => {
255255
const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" });
256-
const commitHash = stdout.slice(`rust-analyzer `.length).trim();
257-
const { releaseTag } = ctx.config.package;
256+
const versionString = stdout.slice(`rust-analyzer `.length).trim();
258257

259258
void vscode.window.showInformationMessage(
260-
`rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})`
259+
`rust-analyzer version: ${versionString}`
261260
);
262261
};
263262
}

0 commit comments

Comments
 (0)