1
1
2
2
import * as path from 'path' ;
3
- import { spawn , execFile , ChildProcess } from 'mz/child_process' ;
3
+ import { spawn , ChildProcess } from 'mz/child_process' ;
4
4
import * as vscode from 'vscode' ;
5
5
import { LanguageClient , LanguageClientOptions , StreamInfo } from 'vscode-languageclient' ;
6
6
import * as semver from 'semver' ;
7
7
import * as net from 'net' ;
8
8
import * as url from 'url' ;
9
+ import execa from 'execa' ;
9
10
10
11
export async function activate ( context : vscode . ExtensionContext ) : Promise < void > {
11
12
12
13
const conf = vscode . workspace . getConfiguration ( 'php' ) ;
13
- const executablePath = conf . get < string > ( 'executablePath' ) || 'php' ;
14
+ const executablePath = conf . get < string > ( 'executablePath' ) ||
15
+ conf . get < string > ( 'validate.executablePath' ) ||
16
+ ( process . platform === 'win32' ? 'php.exe' : 'php' ) ;
14
17
15
18
const memoryLimit = conf . get < string > ( 'memoryLimit' ) || '4095M' ;
16
19
@@ -28,7 +31,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
28
31
// Check path (if PHP is available and version is ^7.0.0)
29
32
let stdout : string ;
30
33
try {
31
- [ stdout ] = await execFile ( executablePath , [ '--version' ] ) ;
34
+ stdout = await execa . stdout ( executablePath , [ '--version' ] ) ;
32
35
} catch ( err ) {
33
36
if ( err . code === 'ENOENT' ) {
34
37
const selected = await vscode . window . showErrorMessage (
0 commit comments