diff --git a/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php b/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php index 78333633f..45418b5a3 100644 --- a/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php +++ b/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php @@ -42,10 +42,12 @@ class ProtocolStreamReader implements ProtocolReader { $input = new ResourceInputStream($input); asyncCall( - function () use ($input): \Generator { - while (($chunk = yield $input->read()) !== null) { + function () use ($input) : \Generator { + while ($this->is_accepting_new_requests && ($chunk = yield $input->read()) !== null) { /** @var string $chunk */ - $this->readMessages($chunk); + if ($this->readMessages($chunk) > 0) { + $this->emit('readMessageGroup'); + } } $this->emitClose();