diff --git a/src/LanguageServer.php b/src/LanguageServer.php index f1706e9..595c20b 100644 --- a/src/LanguageServer.php +++ b/src/LanguageServer.php @@ -54,27 +54,32 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher /** * @var ProtocolReader */ - private $protocolReader; + protected $protocolReader; /** * @var ProtocolWriter */ - private $protocolWriter; + protected $protocolWriter; /** * @var LanguageClient */ - private $client; + protected $client; /** * @var FilesFinder */ - private $filesFinder; + protected $filesFinder; /** * @var ContentRetriever */ - private $contentRetriever; + protected $contentRetriever; + + /** + * @var PhpDocumentLoader + */ + protected $documentLoader; /** * @param PotocolReader $reader @@ -139,6 +144,8 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher { return coroutine(function () use ($capabilities, $rootPath, $processId) { + yield null; + if ($capabilities->xfilesProvider) { $this->filesFinder = new ClientFilesFinder($this->client); } else { @@ -165,9 +172,7 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher ); if ($rootPath !== null) { - $pattern = Path::makeAbsolute('**/*.php', $rootPath); - $uris = yield $this->filesFinder->find($pattern); - $this->index($uris)->otherwise('\\LanguageServer\\crash'); + $this->index($rootPath)->otherwise('\\LanguageServer\\crash'); } $this->textDocument = new Server\TextDocument( @@ -228,11 +233,15 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher /** * Will read and parse the passed source files in the project and add them to the appropiate indexes * + * @param string $rootPath * @return Promise */ - private function index(array $uris): Promise + protected function index(string $rootPath): Promise { - return coroutine(function () use ($uris) { + return coroutine(function () use ($rootPath) { + + $pattern = Path::makeAbsolute('**/*.php', $rootPath); + $uris = yield $this->filesFinder->find($pattern); $count = count($uris); diff --git a/src/PhpDocumentLoader.php b/src/PhpDocumentLoader.php index b6c04cb..728225d 100644 --- a/src/PhpDocumentLoader.php +++ b/src/PhpDocumentLoader.php @@ -24,7 +24,7 @@ class PhpDocumentLoader /** * @var ContentRetriever */ - private $contentRetriever; + public $contentRetriever; /** * @var ProjectIndex