phpcomplete.vim icon indicating copy to clipboard operation
phpcomplete.vim copied to clipboard

Completion not detecting member variable objects

Open mariusroets opened this issue 8 years ago • 1 comments

If member variables are objects, completion does not seem to work on them. Simply

$model = new MyModel();
$model->// Completion works here
$this->model = new MyModel();
$this->model->// Completion does not work here

mariusroets avatar Sep 14 '17 08:09 mariusroets

Hmm, at the moment the plugin doesn't try to figure out object attribute types from direct assignment.

What you might be able to do in your example, is that if the $model variable's type is detectable by the plugin you can set up an type-annotated attribute in that class's definition and then it will be inferred from there.

So something like:

Class MyModel {
   /**
   * model
   *
   * @var MyModel
   */
  public $model;
}

$model = new MyModel();
$model->model-> // should work here.

I guess your situation is more dynamic here so this might not apply. I'll have to look into how this could be implemented.

complex857 avatar Sep 17 '17 11:09 complex857