aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-02-21 01:57:24 +0000
committerEdwin Cheng <[email protected]>2020-02-21 10:33:45 +0000
commit489be40d3a6181b0eb0ee71e8b399692b639baf4 (patch)
tree70cd5ad963cce601451c958119255fb4698ce456 /editors/code/src
parente7a0d8f8d0ab4b03e1d85fce2973bdc50d0391c0 (diff)
Use ensureServerBinary instead
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/commands/server_version.ts22
1 files changed, 17 insertions, 5 deletions
diff --git a/editors/code/src/commands/server_version.ts b/editors/code/src/commands/server_version.ts
index 307408a37..34c18bf3b 100644
--- a/editors/code/src/commands/server_version.ts
+++ b/editors/code/src/commands/server_version.ts
@@ -1,10 +1,22 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import { ServerVersion } from '../installation/server'; 2import { ensureServerBinary } from '../installation/server';
3import { Cmd } from '../ctx'; 3import { Ctx, Cmd } from '../ctx';
4import { spawnSync } from 'child_process';
4 5
5export function serverVersion(): Cmd { 6export function serverVersion(ctx: Ctx): Cmd {
6 return () => { 7 return async () => {
7 vscode.window.showInformationMessage('rust-analyzer version : ' + ServerVersion); 8 const binaryPath = await ensureServerBinary(ctx.config.serverSource);
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 res = spawnSync(binaryPath, ["--version"]);
18 const version = res.output?.filter(x => x !== null).map(String).join(" ");
19 vscode.window.showInformationMessage('rust-analyzer version : ' + version);
8 }; 20 };
9} 21}
10 22