1
0
Fork 0

Merge branch 'master' into master

pull/153/head
Michal Niewrzal 2016-11-18 11:53:05 +01:00 committed by GitHub
commit 82bc3e8b20
2 changed files with 16 additions and 18 deletions

View File

@ -179,8 +179,7 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
$startTime = microtime(true);
yield Promise\all(array_map(function ($textDocument, $i) use ($count) {
return coroutine(function () use ($textDocument, $i, $count) {
foreach ($textDocuments as $i => $textDocument) {
// Give LS to the chance to handle requests while indexing
yield timeout();
$this->client->window->logMessage(
@ -195,8 +194,7 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
"Error parsing file {$textDocument->uri}: " . (string)$e
);
}
});
}, $textDocuments, array_keys($textDocuments)));
}
$duration = (int)(microtime(true) - $startTime);
$mem = (int)(memory_get_usage(true) / (1024 * 1024));

View File

@ -58,9 +58,9 @@ class LanguageServerTest extends TestCase
$input = new MockProtocolStream;
$output = new MockProtocolStream;
$output->on('message', function (Message $msg) use ($promise) {
if ($msg->body->method === 'window/logMessage') {
if ($msg->body->method === 'window/logMessage' && $promise->state === Promise::PENDING) {
if ($msg->body->params->type === MessageType::ERROR) {
$promise->reject();
$promise->reject(new Exception($msg->body->params->message));
} else if (strpos($msg->body->params->message, 'All 10 PHP files parsed') !== false) {
$promise->fulfill();
}