fix: always use a TCP socket instead of STDIO
STDIO locks up for large responsespull/202/head
parent
a62996fe33
commit
ddddf2a178
|
@ -62,21 +62,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
|
|||
}
|
||||
|
||||
const serverOptions = () => new Promise<ChildProcess | StreamInfo>((resolve, reject) => {
|
||||
function spawnServer(...args: string[]): ChildProcess {
|
||||
// The server is implemented in PHP
|
||||
args.unshift(context.asAbsolutePath(path.join('vendor', 'felixfbecker', 'language-server', 'bin', 'php-language-server.php')));
|
||||
args.push('--memory-limit=' + memoryLimit);
|
||||
const childProcess = spawn(executablePath, args);
|
||||
childProcess.stderr.on('data', (chunk: Buffer) => {
|
||||
console.error(chunk + '');
|
||||
});
|
||||
childProcess.stdout.on('data', (chunk: Buffer) => {
|
||||
console.log(chunk + '');
|
||||
});
|
||||
return childProcess;
|
||||
}
|
||||
if (process.platform === 'win32') {
|
||||
// Use a TCP socket on Windows because of blocking STDIO
|
||||
// Use a TCP socket because of problems with blocking STDIO
|
||||
const server = net.createServer(socket => {
|
||||
// 'connection' listener
|
||||
console.log('PHP process connected');
|
||||
|
@ -88,12 +74,20 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
|
|||
});
|
||||
// Listen on random port
|
||||
server.listen(0, '127.0.0.1', () => {
|
||||
spawnServer('--tcp=127.0.0.1:' + server.address().port);
|
||||
// The server is implemented in PHP
|
||||
const childProcess = spawn(executablePath, [
|
||||
context.asAbsolutePath(path.join('vendor', 'felixfbecker', 'language-server', 'bin', 'php-language-server.php')),
|
||||
'--tcp=127.0.0.1:' + server.address().port,
|
||||
'--memory-limit=' + memoryLimit
|
||||
]);
|
||||
childProcess.stderr.on('data', (chunk: Buffer) => {
|
||||
console.error(chunk + '');
|
||||
});
|
||||
childProcess.stdout.on('data', (chunk: Buffer) => {
|
||||
console.log(chunk + '');
|
||||
});
|
||||
return childProcess;
|
||||
});
|
||||
} else {
|
||||
// Use STDIO on Linux / Mac
|
||||
resolve(spawnServer());
|
||||
}
|
||||
});
|
||||
|
||||
// Options to control the language client
|
||||
|
|
Loading…
Reference in New Issue