felixfbecker / php-language-server

PHP Implementation of the VS Code Language Server Protocol 🆚↔🖥
ISC License
1.16k stars 185 forks source link

atom, completion returns 0 results, depth 2 #623

Open pelallemant opened 6 years ago

pelallemant commented 6 years ago

Hi,

To illustrate my case, I wrote the following example. It does work perfectly with that size, but in my current project, it isn't able to resolve completion at the last line.

class SuperClass
{
  public function __construct() {}
  public function method1SuperClass() {}
  public function method2SuperClass() {}
}

class MyClass
{
  /** @var SuperClass */
  public $instance_superclass;

  public function __construct() {
    $this->instance_superclass = new SuperClass();
  }

  /**
   * @return SuperClass 
   */
  public function getInstance() {
    return $this->instance_superclass;
  }
}

$t = new MyClass();
// the following line, ctrl + space shows a modal with 'getInstance()' and 'MySuperClass' type resolved
$t->
// the following line, ctrl + space shows nothing, in the log there is are textDocument/completion received with 0 items.
$t->getInstance()->

For example, I would like to have the autocompletion to do:

$t->
$t->getter1()->
$t->getter1()->getter2()->
$t->getter1()->getter2()->getter3()->
$t->getter1()->getter2()->getter3()->getter4()->

But after $t->getter1()-> I do received only textDocument/completion notifications with 0 items.

Are there way to see if some classes are parsed ?

felixfbecker commented 6 years ago

Hmm, I get completion:

image

But I noticed it's not consistent for some reason. Something fishy is going on. Maybe it enters an infinite loop somewhere

pelallemant commented 6 years ago

If I remind well, in my project, I use private packages. My private packages which are required in composer.json doesn't have a 'version' in their own composer.json . If the packages are parsed then written into cache files with the version, it may be from that.