99use Generator ;
1010use Phpactor \AmpFsWatch \Exception \WatcherDied ;
1111use Phpactor \AmpFsWatch \Watcher ;
12+ use Phpactor \AmpFsWatch \WatcherProcess ;
1213use Phpactor \Extension \LanguageServerIndexer \Event \IndexReset ;
1314use Phpactor \LanguageServer \Core \Handler \Handler ;
1415use 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 ();
0 commit comments