We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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 ???



98.9k

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

You can get the phalcon stubs autocompleted with that plugin



29.8k

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



29.8k

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');
    }
}


29.8k
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 :(



29.8k

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



15.1k

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?



15.1k

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.