Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

Commit

Permalink
Fix hover on namespaced function
Browse files Browse the repository at this point in the history
  • Loading branch information
dantleech committed Dec 27, 2020
1 parent 3265e50 commit 817179b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/LanguageServerHover/Handler/HoverHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private function renderMember(SymbolContext $symbolContext): string

private function renderFunction(SymbolContext $symbolContext): string
{
$name = $symbolContext->symbol()->name();
$name = $symbolContext->name();
$function = $this->reflector->reflectFunction($name);

return $this->renderer->render(new HoverInformation($name, $function->docblock()->formatted(), $function));
Expand Down
10 changes: 10 additions & 0 deletions tests/LanguageServerCompletion/Unit/Handler/HoverHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,15 @@ private function f<>oo():string {}
'<?php cl<>ass A { } }',
'A'
];

yield 'function' => [
'<?php function foo() {} f<>oo();',
'A'
];

yield 'namespaced function' => [
'<?php namespace Barf {function foo() {}} Barf\f<>oo();',
'A'
];
}
}

0 comments on commit 817179b

Please sign in to comment.