Skip to content
This repository was archived by the owner on Mar 6, 2022. It is now read-only.

Commit c737d53

Browse files
committed
Start watch before showing done message
1 parent ec2fb13 commit c737d53

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/LanguageServerIndexer/Handler/IndexerHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Generator;
1010
use Phpactor\AmpFsWatch\Exception\WatcherDied;
1111
use Phpactor\AmpFsWatch\Watcher;
12+
use Phpactor\AmpFsWatch\WatcherProcess;
1213
use Phpactor\Extension\LanguageServerIndexer\Event\IndexReset;
1314
use Phpactor\LanguageServer\Core\Handler\Handler;
1415
use Phpactor\LanguageServer\Core\Server\ClientApi;
@@ -125,13 +126,14 @@ public function indexer(CancellationToken $cancel): Promise
125126
yield new Delayed(1);
126127
}
127128

129+
$process = yield $this->watcher->watch();
128130
$this->clientApi->window()->showMessage()->info(sprintf(
129131
'Done indexing (%ss), watching with %s',
130132
number_format(microtime(true) - $start, 2),
131133
$this->watcher->describe()
132134
));
133135

134-
return yield from $this->watch($cancel);
136+
return yield from $this->watch($process, $cancel);
135137
});
136138
}
137139

@@ -149,11 +151,9 @@ public function reindex(bool $soft = false): Promise
149151
/**
150152
* @return Generator<Promise>
151153
*/
152-
private function watch(CancellationToken $cancel): Generator
154+
private function watch(WatcherProcess $process, CancellationToken $cancel): Generator
153155
{
154156
try {
155-
$process = yield $this->watcher->watch();
156-
157157
while (null !== $file = yield $process->wait()) {
158158
try {
159159
$cancel->throwIfRequested();

tests/LanguageServerIndexer/Unit/IndexerHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testIndexer(): void
3434
);
3535

3636
$this->tester->initialize();
37-
wait(delay(10));
37+
wait(delay(15));
3838

3939
self::assertGreaterThanOrEqual(2, $this->tester->transmitter()->count());
4040
self::assertStringContainsString('Indexing', $this->tester->transmitter()->shift()->params['message']);

0 commit comments

Comments
 (0)