Add support for static access without prefix
parent
8f30819a17
commit
635e6b3a8d
|
@ -24,7 +24,7 @@
|
|||
"bin": ["bin/php-language-server.php"],
|
||||
"require": {
|
||||
"php": ">=7.0",
|
||||
"nikic/php-parser": "dev-master#c5cdd5ad73ac20d855b84fa6d0f1f22ebff2e302",
|
||||
"nikic/php-parser": "dev-master#e52ffc4447e034514339a03b450aab9cd625e37c",
|
||||
"phpdocumentor/reflection-docblock": "^3.0",
|
||||
"sabre/event": "^5.0",
|
||||
"felixfbecker/advanced-json-rpc": "^2.0",
|
||||
|
|
|
@ -45,6 +45,10 @@ class CompletionProvider
|
|||
{
|
||||
$node = $document->getNodeAtPosition($position);
|
||||
|
||||
if ($node instanceof Node\Expr\Error) {
|
||||
$node = $node->getAttribute('parentNode');
|
||||
}
|
||||
|
||||
/** @var CompletionItem[] */
|
||||
$items = [];
|
||||
|
||||
|
@ -64,8 +68,8 @@ class CompletionProvider
|
|||
$this->definitionResolver->resolveExpressionNodeToType($node->var)
|
||||
);
|
||||
} else {
|
||||
$prefixes = [is_string($node->class) ? $node->class : ''];
|
||||
}
|
||||
$prefixes = [$node->class instanceof Node\Name ? (string)$node->class : ''];
|
||||
}
|
||||
// If we are just filtering by the class, add the appropiate operator to the prefix
|
||||
// to filter the type of symbol
|
||||
foreach ($prefixes as &$prefix) {
|
||||
|
|
Loading…
Reference in New Issue