Added command line argument for socket communication
parent
ca0fcced20
commit
1a006deee5
|
@ -12,6 +12,21 @@ foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../autoload.php', __DI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$server = new LanguageServer(new ProtocolStreamReader(STDIN), new ProtocolStreamWriter(STDOUT));
|
if (count($argv) >= 3 && $argv[1] == '--tcp') {
|
||||||
|
$address = $argv[2];
|
||||||
|
$socket = stream_socket_client('tcp://' . $address, $errno, $errstr);
|
||||||
|
if ($socket === false) {
|
||||||
|
fwrite(STDERR, "Could not connect to language client. Error $errno\n");
|
||||||
|
fwrite(STDERR, "$errstr\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
$inputStream = $outputStream = $socket;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$inputStream = STDIN;
|
||||||
|
$outputStream = STDOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
$server = new LanguageServer(new ProtocolStreamReader($inputStream), new ProtocolStreamWriter($outputStream));
|
||||||
|
|
||||||
Loop\run();
|
Loop\run();
|
||||||
|
|
Loading…
Reference in New Issue