cleanup
parent
6d725a234c
commit
18f2f4c85c
|
@ -201,18 +201,16 @@ class CompletionProvider
|
|||
$this->definitionResolver->resolveExpressionNodeToType($node->dereferencableExpression)
|
||||
);
|
||||
|
||||
$checksCount = 0;
|
||||
$start = microtime(true);
|
||||
// Add the object access operator to only get members of all parents
|
||||
// The namespaces of the symbol and its parents (eg the implemented interfaces)
|
||||
$namespaces = [];
|
||||
foreach ($this->expandParentFqns($fqns) as $namespace) {
|
||||
$namespaces[] = $namespace;
|
||||
}
|
||||
|
||||
// Collect all definitions that match any of the prefixes
|
||||
// Collect namespaces definitions
|
||||
foreach ($namespaces as $namespace) {
|
||||
foreach ($this->index->getDefinitionsForNamespace($namespace) as $fqn => $def) {
|
||||
++$checksCount;
|
||||
// Add the object access operator to only get members of all parents
|
||||
$prefix = $namespace . '->';
|
||||
if (substr($fqn, 0, strlen($prefix)) === $prefix && !$def->isMember) {
|
||||
$list->items[] = CompletionItem::fromDefinition($def);
|
||||
|
@ -220,25 +218,6 @@ class CompletionProvider
|
|||
}
|
||||
}
|
||||
|
||||
// $prefixes = [];
|
||||
// foreach ($this->expandParentFqns($fqns) as $prefix) {
|
||||
// $prefixes[] = $prefix . '->';
|
||||
// }
|
||||
// foreach ($this->index->getDefinitions() as $fqn => $def) {
|
||||
// foreach ($prefixes as $prefix) {
|
||||
// ++$checksCount;
|
||||
// if (substr($fqn, 0, strlen($prefix)) === $prefix && !$def->isGlobal) {
|
||||
// $list->items[] = CompletionItem::fromDefinition($def);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
$duration = microtime(true) - $start;
|
||||
// file_put_contents(
|
||||
// '/home/nicolas/tmp/php_language-server.log',
|
||||
// sprintf("%d items found, %d checks, memory : %d bytes, %ss\n", sizeof($list->items), $checksCount, memory_get_usage(true), $duration),
|
||||
// FILE_APPEND
|
||||
// );
|
||||
|
||||
} elseif (
|
||||
($scoped = $node->parent) instanceof Node\Expression\ScopedPropertyAccessExpression ||
|
||||
($scoped = $node) instanceof Node\Expression\ScopedPropertyAccessExpression
|
||||
|
@ -252,23 +231,21 @@ class CompletionProvider
|
|||
//
|
||||
// TODO: $a::|
|
||||
|
||||
$checksCount = 0;
|
||||
$start = microtime(true);
|
||||
// Resolve all possible types to FQNs
|
||||
$fqns = FqnUtilities\getFqnsFromType(
|
||||
$classType = $this->definitionResolver->resolveExpressionNodeToType($scoped->scopeResolutionQualifier)
|
||||
);
|
||||
|
||||
// Append :: operator to only get static members of all parents
|
||||
// The namespaces of the symbol and its parents (eg the implemented interfaces)
|
||||
$namespaces = [];
|
||||
foreach ($this->expandParentFqns($fqns) as $namespace) {
|
||||
$namespaces[] = $namespace;
|
||||
}
|
||||
|
||||
// Collect all definitions that match any of the prefixes
|
||||
// Collect namespaces definitions
|
||||
foreach ($namespaces as $namespace) {
|
||||
foreach ($this->index->getDefinitionsForNamespace($namespace) as $fqn => $def) {
|
||||
++$checksCount;
|
||||
// Append :: operator to only get static members of all parents
|
||||
$prefix = strtolower($namespace . '::');
|
||||
if (substr(strtolower($fqn), 0, strlen($prefix)) === $prefix && !$def->isMember) {
|
||||
$list->items[] = CompletionItem::fromDefinition($def);
|
||||
|
@ -276,26 +253,6 @@ class CompletionProvider
|
|||
}
|
||||
}
|
||||
|
||||
// $prefixes = [];
|
||||
// foreach ($this->expandParentFqns($fqns) as $prefix) {
|
||||
// $prefixes[] = $prefix . '::';
|
||||
// }
|
||||
|
||||
// foreach ($this->index->getDefinitions() as $fqn => $def) {
|
||||
// foreach ($prefixes as $prefix) {
|
||||
// ++$checksCount;
|
||||
// if (substr(strtolower($fqn), 0, strlen($prefix)) === strtolower($prefix) && !$def->isGlobal) {
|
||||
// $list->items[] = CompletionItem::fromDefinition($def);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
$duration = microtime(true) - $start;
|
||||
file_put_contents(
|
||||
'/home/nicolas/tmp/php_language-server_static.log',
|
||||
sprintf("%d items found, %d checks, memory : %d bytes, %ss\n", sizeof($list->items), $checksCount, memory_get_usage(true), $duration),
|
||||
FILE_APPEND
|
||||
);
|
||||
|
||||
} elseif (
|
||||
ParserHelpers\isConstantFetch($node)
|
||||
// Creation gets set in case of an instantiation (`new` expression)
|
||||
|
|
Loading…
Reference in New Issue