1
1
import { execSync } from "node:child_process" ;
2
2
import * as vscode from "vscode" ;
3
+ import { buildCommand } from "./executable" ;
3
4
4
5
function testElixirCommand ( command : string ) : false | Buffer {
5
6
try {
@@ -9,24 +10,27 @@ function testElixirCommand(command: string): false | Buffer {
9
10
}
10
11
}
11
12
12
- export function testElixir ( ) : boolean {
13
- const testResult = testElixirCommand ( "elixir" ) ;
13
+ export function testElixir ( context : vscode . ExtensionContext ) : boolean {
14
+ // Use the same script infrastructure as the language server to ensure
15
+ // consistent environment setup (version managers, etc.)
16
+ const checkCommand = buildCommand ( context , "elixir_check" , undefined ) ;
17
+ const testResult = testElixirCommand ( `"${ checkCommand } "` ) ;
14
18
15
19
if ( ! testResult ) {
16
20
vscode . window . showErrorMessage (
17
- "Failed to run ' elixir' command. ElixirLS will probably fail to launch. Logged PATH to Development Console." ,
21
+ "Failed to run elixir check command. ElixirLS will probably fail to launch. Logged PATH to Development Console." ,
18
22
) ;
19
23
console . warn (
20
- `Failed to run ' elixir' command. Current process's PATH: ${ process . env . PATH } ` ,
24
+ `Failed to run elixir check command. Current process's PATH: ${ process . env . PATH } ` ,
21
25
) ;
22
26
return false ;
23
27
}
24
28
if ( testResult . length > 0 ) {
25
29
vscode . window . showErrorMessage (
26
- "Running ' elixir' command caused extraneous print to stdout. See VS Code's developer console for details." ,
30
+ "Running elixir check command caused extraneous print to stdout. See VS Code's developer console for details." ,
27
31
) ;
28
32
console . warn (
29
- `Running ' elixir -e \"\"' printed to stdout:\n${ testResult . toString ( ) } ` ,
33
+ `Running elixir check command printed to stdout:\n${ testResult . toString ( ) } ` ,
30
34
) ;
31
35
return false ;
32
36
}
0 commit comments