Files
rust/editors/code/src/commands/server_version.ts

16 lines
547 B
TypeScript
Raw Normal View History

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 () => {
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
}