Not all class members are proposed in completion
parent
10fb3c92e0
commit
9124b52904
|
@ -4,12 +4,10 @@ declare(strict_types = 1);
|
|||
namespace LanguageServer;
|
||||
|
||||
use PhpParser\Node;
|
||||
use phpDocumentor\Reflection\Types;
|
||||
use LanguageServer\Protocol\{
|
||||
TextEdit,
|
||||
Range,
|
||||
Position,
|
||||
SymbolKind,
|
||||
CompletionList,
|
||||
CompletionItem,
|
||||
CompletionItemKind
|
||||
|
@ -156,8 +154,12 @@ class CompletionProvider
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$fqn = $this->definitionResolver->resolveReferenceNodeToFqn($node);
|
||||
$prefixes = $fqn !== null ? [$fqn] : [];
|
||||
$prefix = $this->definitionResolver->resolveReferenceNodeToFqn($node);
|
||||
$index = ($index = strpos($prefix, '->')) ? $index : strpos($prefix, '::');
|
||||
if ($index) {
|
||||
$prefix = substr($prefix, 0, $index + 2);
|
||||
}
|
||||
$prefixes = $prefix !== null ? [$prefix] : [];
|
||||
}
|
||||
|
||||
foreach ($this->project->getDefinitions() as $fqn => $def) {
|
||||
|
|
|
@ -200,6 +200,12 @@ class CompletionTest extends TestCase
|
|||
new Position(2, 14)
|
||||
)->wait();
|
||||
$this->assertEquals(new CompletionList([
|
||||
new CompletionItem(
|
||||
'TEST_CLASS_CONST',
|
||||
CompletionItemKind::VARIABLE,
|
||||
'int',
|
||||
'Anim labore veniam consectetur laboris minim quis aute aute esse nulla ad.'
|
||||
),
|
||||
new CompletionItem(
|
||||
'staticTestProperty',
|
||||
CompletionItemKind::PROPERTY,
|
||||
|
@ -208,6 +214,12 @@ class CompletionTest extends TestCase
|
|||
null,
|
||||
null,
|
||||
'$staticTestProperty'
|
||||
),
|
||||
new CompletionItem(
|
||||
'staticTestMethod',
|
||||
CompletionItemKind::METHOD,
|
||||
'mixed',
|
||||
'Do magna consequat veniam minim proident eiusmod incididunt aute proident.'
|
||||
)
|
||||
], true), $items);
|
||||
}
|
||||
|
@ -254,10 +266,25 @@ class CompletionTest extends TestCase
|
|||
new Position(2, 13)
|
||||
)->wait();
|
||||
$this->assertEquals(new CompletionList([
|
||||
new CompletionItem(
|
||||
'TEST_CLASS_CONST',
|
||||
CompletionItemKind::VARIABLE,
|
||||
'int',
|
||||
'Anim labore veniam consectetur laboris minim quis aute aute esse nulla ad.'
|
||||
),
|
||||
new CompletionItem(
|
||||
'staticTestProperty',
|
||||
CompletionItemKind::PROPERTY,
|
||||
'\TestClass[]',
|
||||
'Lorem excepteur officia sit anim velit veniam enim.',
|
||||
null,
|
||||
null,
|
||||
'$staticTestProperty'
|
||||
),
|
||||
new CompletionItem(
|
||||
'staticTestMethod',
|
||||
CompletionItemKind::METHOD,
|
||||
'mixed', // Method return type
|
||||
'mixed',
|
||||
'Do magna consequat veniam minim proident eiusmod incididunt aute proident.'
|
||||
)
|
||||
], true), $items);
|
||||
|
@ -277,6 +304,21 @@ class CompletionTest extends TestCase
|
|||
CompletionItemKind::VARIABLE,
|
||||
'int',
|
||||
'Anim labore veniam consectetur laboris minim quis aute aute esse nulla ad.'
|
||||
),
|
||||
new CompletionItem(
|
||||
'staticTestProperty',
|
||||
CompletionItemKind::PROPERTY,
|
||||
'\TestClass[]',
|
||||
'Lorem excepteur officia sit anim velit veniam enim.',
|
||||
null,
|
||||
null,
|
||||
'$staticTestProperty'
|
||||
),
|
||||
new CompletionItem(
|
||||
'staticTestMethod',
|
||||
CompletionItemKind::METHOD,
|
||||
'mixed',
|
||||
'Do magna consequat veniam minim proident eiusmod incididunt aute proident.'
|
||||
)
|
||||
], true), $items);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue