[FIX] Checked changes and tested again
parent
680d2dbdbe
commit
dd3b6dc7e8
|
@ -6,4 +6,13 @@
|
||||||
},
|
},
|
||||||
"files.trimTrailingWhitespace": true,
|
"files.trimTrailingWhitespace": true,
|
||||||
"files.eol": "\n",
|
"files.eol": "\n",
|
||||||
|
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.git": true,
|
||||||
|
"**/.svn": true,
|
||||||
|
"**/.hg": true,
|
||||||
|
"**/CVS": true,
|
||||||
|
"**/.DS_Store": true,
|
||||||
|
"**/tests": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,50 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ThisChildClass extends TestClass {
|
class ThisChildClass extends TestClass
|
||||||
|
{
|
||||||
|
|
||||||
public function canSeeMethod()
|
public function canSeeMethod()
|
||||||
{
|
{
|
||||||
$this->
|
$this->
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Foo extends Bar
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getRandom()
|
||||||
|
{
|
||||||
|
$this->c;
|
||||||
|
return random_bytes(25);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
|
||||||
|
private $test;
|
||||||
|
protected $seeme;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->test = 'Basic';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTest()
|
||||||
|
{
|
||||||
|
return $this->test;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function cantSee()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function canSee($arg)
|
||||||
|
{
|
||||||
|
# code...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$foo = new Foo();
|
||||||
|
$foo->getRandom();
|
||||||
|
|
|
@ -159,7 +159,6 @@ class CompletionProvider
|
||||||
): CompletionList {
|
): CompletionList {
|
||||||
// This can be made much more performant if the tree follows specific invariants.
|
// This can be made much more performant if the tree follows specific invariants.
|
||||||
$node = $doc->getNodeAtPosition($pos);
|
$node = $doc->getNodeAtPosition($pos);
|
||||||
|
|
||||||
// Get the node at the position under the cursor
|
// Get the node at the position under the cursor
|
||||||
$offset = $node === null ? -1 : $pos->toOffset($node->getFileContents());
|
$offset = $node === null ? -1 : $pos->toOffset($node->getFileContents());
|
||||||
if (
|
if (
|
||||||
|
@ -248,18 +247,17 @@ class CompletionProvider
|
||||||
$this->definitionResolver->resolveExpressionNodeToType($node->dereferencableExpression)
|
$this->definitionResolver->resolveExpressionNodeToType($node->dereferencableExpression)
|
||||||
);
|
);
|
||||||
$isInMethodDeclaration = null !== $node->getFirstAncestor(\Microsoft\PhpParser\Node\MethodDeclaration::class);
|
$isInMethodDeclaration = null !== $node->getFirstAncestor(\Microsoft\PhpParser\Node\MethodDeclaration::class);
|
||||||
// Add the object access operator to only get members of all parents
|
// The FQNs of the symbol and its parents (eg the implemented interfaces)
|
||||||
$prefixes = [];
|
foreach ($this->expandParentFqns($fqns) as $parentFqn) {
|
||||||
foreach ($this->expandParentFqns($fqns) as $prefix) {
|
// Add the object access operator to only get members of all parents
|
||||||
$prefixes[] = $prefix . '->';
|
$prefix = $parentFqn . '->';
|
||||||
}
|
$prefixLen = strlen($prefix);
|
||||||
|
// Collect fqn definitions
|
||||||
// Collect all definitions that match any of the prefixes
|
foreach ($this->index->getChildDefinitionsForFqn($parentFqn) as $fqn => $def) {
|
||||||
foreach ($this->index->getDefinitions() as $fqn => $def) {
|
if (substr($fqn, 0, $prefixLen) === $prefix &&
|
||||||
foreach ($prefixes as $prefix) {
|
|
||||||
if (substr($fqn, 0, strlen($prefix)) === $prefix &&
|
|
||||||
$def->isMember &&
|
$def->isMember &&
|
||||||
$def->isVisible($prefix, $prefixes[0], $isInMethodDeclaration)) {
|
$def->isVisible($prefix, $fqns[0] . '->', $isInMethodDeclaration)
|
||||||
|
) {
|
||||||
$list->items[] = CompletionItemFactory::fromDefinition($def);
|
$list->items[] = CompletionItemFactory::fromDefinition($def);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue