mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +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 { ServerVersion } from '../installation/server';
|
||||
import { Cmd } from '../ctx';
|
||||
import { ensureServerBinary } from '../installation/server';
|
||||
import { Ctx, Cmd } from '../ctx';
|
||||
import { spawnSync } from 'child_process';
|
||||
|
||||
export function serverVersion(): Cmd {
|
||||
return () => {
|
||||
vscode.window.showInformationMessage('rust-analyzer version : ' + ServerVersion);
|
||||
export function serverVersion(ctx: Ctx): Cmd {
|
||||
return async () => {
|
||||
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