File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
editors/code/src/commands Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change 11import * as vscode from 'vscode' ;
2- import { ServerVersion } from '../installation/server' ;
3- import { Cmd } from '../ctx' ;
2+ import { ensureServerBinary } from '../installation/server' ;
3+ import { Ctx , Cmd } from '../ctx' ;
4+ import { spawnSync } from 'child_process' ;
45
5- export function serverVersion ( ) : Cmd {
6- return ( ) => {
7- vscode . window . showInformationMessage ( 'rust-analyzer version : ' + ServerVersion ) ;
6+ export function serverVersion ( ctx : Ctx ) : Cmd {
7+ return async ( ) => {
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 ) ;
820 } ;
921}
1022
You can’t perform that action at this time.
0 commit comments