Peekmo / atom-autocomplete-php

Autocomplete for PHP in atom editor
MIT License
136 stars 34 forks source link

Autocomplete for external object instance #185

Closed harpreetsb closed 9 years ago

harpreetsb commented 9 years ago

simply i have class

namespace Model;
use Wplib\Reviews;
use Model\Base;
class Reviewmodel extends Base{
    private $wpReviewClass;
    /**
     * contructor
     * @return          nothing
     */
    public function __construct() {
        parent::__construct();
        $this->wpReviewClass = new Reviews();
    }
        ............................
}

now using

$this->wpReviewClass->{no auto suggests here}
ghost commented 9 years ago

You are missing a docblock with a @var tag above your $wpReviewClass variable to indicate what type it is:

class Reviewmodel extends Base{
    /**
     * @var Reviews
     */
    private @wpReviewClass;

    ...

This should make it work. The exact requirements for autocompletion perhaps weren't entirely clear, the readme on the main page has been updated to contain more detail about what is needed to get autocompletion working properly.

harpreetsb commented 9 years ago

@hotoiledgoblinsack no that does not work either.

Peekmo commented 9 years ago

Your project is manage with composer ?

harpreetsb commented 9 years ago

Well some part of it. The api folder uses composer, you can see the vendor folder. the app does not, thought he autocomplete I am asking is from this. In the plugin settings I have mentioned the index.php from this folder. But the suggestion does not work for any case. selection_020

Peekmo commented 9 years ago

Ok,

The problem is the following : The plugin, in order to work, needs that the opened folder is the root folder of your composer.json. It also needs that your class autoloading is managed by composer.

So, if your class autoloading is managed by composer in your "api" folder, then, if you open your window on the "api" folder, it will work. For "app", it will, unfortunately, doesn't work.

harpreetsb commented 9 years ago

seems I have stick to Komodo Edit then.

ghost commented 9 years ago

Ok, pull requests to improve the situation are always welcome. If you have any further questions, feel free to open another ticket.