1
0
Fork 0
pull/424/head
Felix Becker 2017-06-22 19:16:13 +02:00
parent 372e55725e
commit ee5b66abc6
2 changed files with 10 additions and 5 deletions

View File

@ -396,7 +396,8 @@ class TextDocument
} }
if ( if (
$def === null $def === null
|| ($def->symbolInformation !== null && Uri\parse($def->symbolInformation->location->uri)['scheme'] === 'phpstubs') || $def->symbolInformation === null
|| Uri\parse($def->symbolInformation->location->uri)['scheme'] === 'phpstubs'
) { ) {
return []; return [];
} }
@ -406,8 +407,8 @@ class TextDocument
if (!$packageName && $this->composerJson !== null) { if (!$packageName && $this->composerJson !== null) {
$packageName = $this->composerJson->name; $packageName = $this->composerJson->name;
} }
$symbol = new SymbolDescriptor($def->fqn, new PackageDescriptor($packageName)); $descriptor = new SymbolDescriptor($def->fqn, new PackageDescriptor($packageName));
return [new SymbolLocationInformation($symbol, $symbol->location)]; return [new SymbolLocationInformation($descriptor, $def->symbolInformation->location)];
}); });
} }
} }

View File

@ -13,7 +13,8 @@ use LanguageServer\Protocol\{
PackageDescriptor, PackageDescriptor,
ReferenceInformation, ReferenceInformation,
DependencyReference, DependencyReference,
Location Location,
MessageType
}; };
use Sabre\Event\Promise; use Sabre\Event\Promise;
use function Sabre\Event\coroutine; use function Sabre\Event\coroutine;
@ -148,7 +149,10 @@ class Workspace
foreach ($refs as $uri => $fqns) { foreach ($refs as $uri => $fqns) {
foreach ($fqns as $fqn) { foreach ($fqns as $fqn) {
$def = $this->dependenciesIndex->getDefinition($fqn); $def = $this->dependenciesIndex->getDefinition($fqn);
$symbol->fqsen = $fqn; if ($def === null) {
$this->client->window->logMessage(MessageType::WARNING, "Reference $fqn not found in index");
continue;
}
// Find out package name // Find out package name
$packageName = getPackageName($def->symbolInformation->location->uri, $this->composerJson); $packageName = getPackageName($def->symbolInformation->location->uri, $this->composerJson);
$symbol = new SymbolDescriptor($fqn, new PackageDescriptor($packageName)); $symbol = new SymbolDescriptor($fqn, new PackageDescriptor($packageName));