mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 20:28:33 +00:00
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 <lnicola@dend.ro>
This commit is contained in:
commit
ceffcf8a11
@ -39,8 +39,7 @@ fn set_rerun() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn rev() -> Option<String> {
|
fn rev() -> Option<String> {
|
||||||
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 stdout = String::from_utf8(output.stdout).ok()?;
|
||||||
let short_hash = stdout.get(0..7)?;
|
Some(stdout)
|
||||||
Some(short_hash.to_owned())
|
|
||||||
}
|
}
|
||||||
|
@ -253,11 +253,10 @@ export function ssr(ctx: Ctx): Cmd {
|
|||||||
export function serverVersion(ctx: Ctx): Cmd {
|
export function serverVersion(ctx: Ctx): Cmd {
|
||||||
return async () => {
|
return async () => {
|
||||||
const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" });
|
const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" });
|
||||||
const commitHash = stdout.slice(`rust-analyzer `.length).trim();
|
const versionString = stdout.slice(`rust-analyzer `.length).trim();
|
||||||
const { releaseTag } = ctx.config.package;
|
|
||||||
|
|
||||||
void vscode.window.showInformationMessage(
|
void vscode.window.showInformationMessage(
|
||||||
`rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})`
|
`rust-analyzer version: ${versionString}`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user