1
0
Fork 0
pull/229/head
Felix Becker 2017-01-03 19:54:33 -08:00
parent 662143abad
commit fc5f356d37
1 changed files with 14 additions and 10 deletions

View File

@ -54,27 +54,27 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
/** /**
* @var ProtocolReader * @var ProtocolReader
*/ */
private $protocolReader; protected $protocolReader;
/** /**
* @var ProtocolWriter * @var ProtocolWriter
*/ */
private $protocolWriter; protected $protocolWriter;
/** /**
* @var LanguageClient * @var LanguageClient
*/ */
private $client; protected $client;
/** /**
* @var FilesFinder * @var FilesFinder
*/ */
private $filesFinder; protected $filesFinder;
/** /**
* @var ContentRetriever * @var ContentRetriever
*/ */
private $contentRetriever; protected $contentRetriever;
/** /**
* @param PotocolReader $reader * @param PotocolReader $reader
@ -139,6 +139,8 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
{ {
return coroutine(function () use ($capabilities, $rootPath, $processId) { return coroutine(function () use ($capabilities, $rootPath, $processId) {
yield null;
if ($capabilities->xfilesProvider) { if ($capabilities->xfilesProvider) {
$this->filesFinder = new ClientFilesFinder($this->client); $this->filesFinder = new ClientFilesFinder($this->client);
} else { } else {
@ -165,9 +167,7 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
); );
if ($rootPath !== null) { if ($rootPath !== null) {
$pattern = Path::makeAbsolute('**/*.php', $rootPath); $this->index($rootPath)->otherwise('\\LanguageServer\\crash');
$uris = yield $this->filesFinder->find($pattern);
$this->index($uris)->otherwise('\\LanguageServer\\crash');
} }
$this->textDocument = new Server\TextDocument( $this->textDocument = new Server\TextDocument(
@ -228,11 +228,15 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
/** /**
* Will read and parse the passed source files in the project and add them to the appropiate indexes * Will read and parse the passed source files in the project and add them to the appropiate indexes
* *
* @param string $rootPath
* @return Promise <void> * @return Promise <void>
*/ */
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); $count = count($uris);