]> git.lizzy.rs Git - rust.git/blob - editors/code/src/commands/server_version.ts
vscode: amend server installation logic to account for nightlies
[rust.git] / editors / code / src / commands / server_version.ts
1 import * as vscode from 'vscode';
2 import { ensureServerBinary } from '../installation/server';
3 import { Ctx, Cmd } from '../ctx';
4 import { spawnSync } from 'child_process';
5
6 export function serverVersion(ctx: Ctx): Cmd {
7     return async () => {
8         const binaryPath = await ensureServerBinary(ctx.config);
9
10         if (binaryPath == null) {
11             throw new Error(
12                 "Rust Analyzer Language Server is not available. " +
13                 "Please, ensure its [proper installation](https://rust-analyzer.github.io/manual.html#installation)."
14             );
15         }
16
17         const version = spawnSync(binaryPath, ["--version"], { encoding: "utf8" }).stdout;
18         vscode.window.showInformationMessage('rust-analyzer version : ' + version);
19     };
20 }