diff options
author | Edwin Cheng <[email protected]> | 2020-02-21 01:57:24 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-02-21 10:33:45 +0000 |
commit | 489be40d3a6181b0eb0ee71e8b399692b639baf4 (patch) | |
tree | 70cd5ad963cce601451c958119255fb4698ce456 /editors | |
parent | e7a0d8f8d0ab4b03e1d85fce2973bdc50d0391c0 (diff) |
Use ensureServerBinary instead
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/src/commands/server_version.ts | 22 |
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 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import { ServerVersion } from '../installation/server'; | 2 | import { ensureServerBinary } from '../installation/server'; |
3 | import { Cmd } from '../ctx'; | 3 | import { Ctx, Cmd } from '../ctx'; |
4 | import { spawnSync } from 'child_process'; | ||
4 | 5 | ||
5 | export function serverVersion(): Cmd { | 6 | export 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 | ||