Sublime text phalcon-devtools/ide auto-completion

Hi, is this possible to have code auto-completion in sublime text for phalcon from https://github.com/phalcon/phalcon-devtools/tree/master/ide ???



83.5k

You can use: http://sublimecodeintel.github.io/SublimeCodeIntel/

You can get the phalcon stubs autocompleted with that plugin



15.9k

I have added this folder https://github.com/phalcon/phalcon-devtools/tree/master/ide/1.2.6/Phalcon to project folder, but for example, when I type: $this->flash-> then in popup is only "Direct (class)" and "message (function)", there is no "success", "error", etc autocompletion.

$this->flash is magic getter and you must add proper PHPDoc for autocomplete to work



15.9k

I don't understand, what mean "add proper PHPDoc"???

if you use flash in Controller: (you can write this in BaseController extended by any normal controller)

class IndexController extends \Phalcon\Mvc\Controller
{
    /**
     * @var Phalcon\Flash\Session
     */
    public $flash;

    public function indexAction()
    {
        $this->flash->error('message');
    }
}

You can also use alternatice PHPDoc approach

/**
 * @property Phalcon\Flash\Session $flash
 */
class IndexController extends \Phalcon\Mvc\Controller
{
    public function indexAction()
    {
        $this->flash->error('message');
    }
}


15.9k
edited Mar '14

It was a lot easier in eclipse - just include path. Is this possible to have this all PHPDoc generated in BaseController without writing it every time? Second thing - what about views, I'd like to use there $this->tag autocompletion, is this possible??

Yes you can write it in BaseController.

With views I don't think this is possible ($this in phtml file is really weird for me), but maybe someone else will have answer how to do it, because my knowledge is one year old. Currently I don't use autocomplete in SublimeText at all :(



15.9k

Do I have to write this, or is there a way to generate it?



10.6k

I've downloaded the devtools. How do I add the stubs for Sublime Text to actually see and use them? I've tried dumping them into Users/Library/Application Support/Sublime Text 2/Packages and restarted the app. No change.

Can someone - in a very specific and thorough way - explain how to add code completion for phalcon in Sublime Text without assuming anything?



10.6k

Can this question not be answered? Or is the solution so obvious, that people simply ignore it for being to stupid?

I made a competions package for Sublime Text. You can download it here on github or search package control for phalcon and it should come up.