parent
96ea8608d7
commit
0b61951a9c
|
@ -276,8 +276,13 @@ class TextDocument
|
|||
return new Hover([]);
|
||||
}
|
||||
$range = Range::fromNode($node);
|
||||
if ($definedFqn = DefinitionResolver::getDefinedFqn($node)) {
|
||||
// Support hover for definitions
|
||||
$def = $this->index->getDefinition($definedFqn);
|
||||
} else {
|
||||
// Get the definition for whatever node is under the cursor
|
||||
$def = $this->definitionResolver->resolveReferenceNodeToDefinition($node);
|
||||
}
|
||||
if ($def === null) {
|
||||
return new Hover([], $range);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,21 @@ class HoverTest extends ServerTestCase
|
|||
], $reference->range), $result);
|
||||
}
|
||||
|
||||
public function testHoverForClassLikeDefinition()
|
||||
{
|
||||
// class TestClass implements TestInterface
|
||||
// Get hover for TestClass
|
||||
$definition = $this->getDefinitionLocation('TestClass');
|
||||
$result = $this->textDocument->hover(
|
||||
new TextDocumentIdentifier($definition->uri),
|
||||
$definition->range->start
|
||||
)->wait();
|
||||
$this->assertEquals(new Hover([
|
||||
new MarkedString('php', "<?php\nclass TestClass implements \\TestInterface"),
|
||||
'Pariatur ut laborum tempor voluptate consequat ea deserunt.'
|
||||
], $definition->range), $result);
|
||||
}
|
||||
|
||||
public function testHoverForMethod()
|
||||
{
|
||||
// $obj->testMethod();
|
||||
|
|
Loading…
Reference in New Issue