2020-03-17 12:44:31 +01:00
|
|
|
import * as vscode from "vscode";
|
|
|
|
|
import { spawnSync } from "child_process";
|
2020-02-21 09:57:24 +08:00
|
|
|
import { Ctx, Cmd } from '../ctx';
|
2020-02-21 10:04:03 +08:00
|
|
|
|
2020-02-21 09:57:24 +08:00
|
|
|
export function serverVersion(ctx: Ctx): Cmd {
|
|
|
|
|
return async () => {
|
2020-03-24 01:15:56 +02:00
|
|
|
const { stdout } = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" });
|
|
|
|
|
const commitHash = stdout.slice(`rust-analyzer `.length).trim();
|
|
|
|
|
const { releaseTag } = ctx.config;
|
|
|
|
|
|
|
|
|
|
void vscode.window.showInformationMessage(
|
|
|
|
|
`rust-analyzer version: ${releaseTag ?? "unreleased"} (${commitHash})`
|
|
|
|
|
);
|
2020-02-21 10:04:03 +08:00
|
|
|
};
|
2020-02-20 16:49:31 +08:00
|
|
|
}
|