Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve types recursively #54

Closed
felixfbecker opened this issue Oct 9, 2016 · 4 comments · Fixed by #155
Closed

Resolve types recursively #54

felixfbecker opened this issue Oct 9, 2016 · 4 comments · Fixed by #155
Assignees

Comments

@felixfbecker
Copy link
Owner

felixfbecker commented Oct 9, 2016

From #49:

Go To Definition currently works for

  • class instantiations
  • static method calls
  • class constant access
  • static property access
  • parameter type hints
  • return type hints
  • method calls, if the variable was assigned to a new object in the same scope
  • property access, if the variable was assigned to a new object in the same scope
  • variables
  • parameters
  • imported closure variables (use)
  • use statements that import a class-like
  • class-like after implements/extends
  • function calls
  • constant access

What does not work yet:

$x = new Whatever();
$y = $x;
$y->myMethod(); // cannot get definition for myMethod

$x = new Whatever();
$x->property->myMethod(); // cannot get definition for myMethod
$x->myMethod()->anotherMethod(); // cannot get definition for anotherMethod

$this->myMethod(); // cannot get definition for myMethod, $this is not resolved to the class

trait MyTrait {}
class MyClass {
  use MyTrait; // cannot get definition for MyTrait
}
  • Method/property access on a return value needs to be resolved recursively
  • Variable reassignments need to be resolved recursively
  • DocBlocks need to be parsed
@dmythro
Copy link

dmythro commented Oct 31, 2016

Hi. Just checked with VSCode. I see a great work was done here but not yet looks usable to me.
Maybe, I'm doing something wrong, or that was not yet released to the VSCode extension?

From the checklist must say that class constant access doesn't work. As well as class constants auto-complete. I get huge list of everything except class constants, actually when typing self::

screen shot 2016-11-01 at 01 17 00

That list includes static functions, but not constants.

Also, can't get any completion for anything of other classes, even the list of available classes.

And no PhpDoc reading. E.g. I have a view with header like this:

<?
/**
 * ...
 *
 * @var View $this
 * @var Meta $meta
 * @var bool $isUser
 * @var array|bool $release
 * @var array|bool $next
 * @var array|bool $previous
 */

No auto-complete at all as well.

@felixfbecker
Copy link
Owner Author

@Z-AX This issue is about go to definition, not completion. Completion is tracked by #9

@dmythro
Copy link

dmythro commented Nov 1, 2016

Well, go to definition doesn't work for those as well.
Thanks, will subscribe for both threads.

@felixfbecker
Copy link
Owner Author

felixfbecker commented Nov 1, 2016

@Z-AX there is a (passing) unit test for class constant definition: https://github.com/felixfbecker/php-language-server/blob/master/tests/Server/TextDocument/Definition/GlobalTest.php#L71

If you found a bug, please open a separate issue, this issue tracks resolving types dynamically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants