mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Use ensureServerBinary instead
This commit is contained in:
parent
e7a0d8f8d0
commit
489be40d3a
1 changed files with 17 additions and 5 deletions
|
@ -1,10 +1,22 @@
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { ServerVersion } from '../installation/server';
|
import { ensureServerBinary } from '../installation/server';
|
||||||
import { Cmd } from '../ctx';
|
import { Ctx, Cmd } from '../ctx';
|
||||||
|
import { spawnSync } from 'child_process';
|
||||||
|
|
||||||
export function serverVersion(): Cmd {
|
export function serverVersion(ctx: Ctx): Cmd {
|
||||||
return () => {
|
return async () => {
|
||||||
vscode.window.showInformationMessage('rust-analyzer version : ' + ServerVersion);
|
const binaryPath = await ensureServerBinary(ctx.config.serverSource);
|
||||||
|
|
||||||
|
if (binaryPath == null) {
|
||||||
|
throw new Error(
|
||||||
|
"Rust Analyzer Language Server is not available. " +
|
||||||
|
"Please, ensure its [proper installation](https://rust-analyzer.github.io/manual.html#installation)."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = spawnSync(binaryPath, ["--version"]);
|
||||||
|
const version = res.output?.filter(x => x !== null).map(String).join(" ");
|
||||||
|
vscode.window.showInformationMessage('rust-analyzer version : ' + version);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue