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

How to add code completion to Sublime Text?

Can someone, in a step by step manner, please explain how to get code completion for Phalcon in Sublime Text without assuming anything?

I am not familiar to Sublime Text, I am using aptana studio.

Maybe it can help you if I explain how I fixed the problem.

I downloaded the whole phalcon dev-tools ide library 1.3.1 to my disk. In Aptana studio I can go to preferences -> libraries and add an php library to locate the phalcon dev-tools ide library 1.3.1/phalcon



16.3k

You need a SublimeCodeIntel Package and then add the path to /phalcon-devtools/ide/VERSION to SublimeCodeIntel.sublime-settings file.

example:

{
"PHP": {
            "phpExtraPaths": ["/opt/phalcon-devtools/ide/1.3.2/"]
        }
}

First, you'll need to install the SublimeText Package manager plugin. Do a Google search for instructions on how to do that.

Then, you'll need to install the SublimeCodeIntel Package that @Sum mentioned. Again, Google for instructions on that.

You'll also need to install the dev-tools IDE like @noonecaresreally mentioned. I have no experience doing that, so I can't help.

Finally, in SublimeText, go to Preferences > Package Settings > SublimeCodeIntel > Settings - User, and add the line that @Sum showed.



8.1k
edited May '14

This was asked again about in some other posts recently, I think this thread is the best place to give the instructions.

  1. Put stubs folder somewhere, either in your project folder, or at a fixed place on your drive. To make life easier, I suggest the first option. My stubs are (relative to my project root) in: vendor/phalcon/devtools/ide/1.3.1/Phalcon
  2. Make sure you are working with your stuff as a project in SublimeText. The path you are about to add is relative to the project root.
  3. Add this path for SublimeCodeIntel: https://github.com/SublimeCodeIntel/SublimeCodeIntel#configuring I use the .codeintel folder option. AFAIK, in contrary to what is suggested above, it does NOT work to add this to the user preferences file.
  4. Disco: https://youtu.be/UkSPUDpe0U8?t=11s ;-) (disclaimer: blatantly copied from Chosen jQuery plugin instructions ;))

Edit: it DOES seem you can also add the path to your user config. Sorry, my molestake. Just make sure you add the whole "codeintel_config" setting, that includes the "PHP" config. Note that everything you add to your user settings, overwrites the corresponding default setting. (It does not complement it.)

And you might have to wait a bit till you see stuff starting to work. The plugin might be busy indexing. It also might help, if nothing seems to be happening, to close/reopen your files and/or resart SublimeText.



67
edited Sep '14
  1. Previously you need to install phalcon developer tools, in docs it is explained step by step
  2. install sublime condeintel, search in google how to....
  3. in sublime go to Preferences > Package Settings > SublimeCodeIntel > Settings - Default
  4. in the file that gets open go to the end where says ............. "PHP": { "phpExtraPaths": [], "codeintel_scan_files_in_project": false, "codeintel_max_recursive_dir_depth": 5 }
    And change the phpExtraPaths value for the directory to phalcon developer tools.

my directory for developer tools "PHP": { "phpExtraPaths": ["C:\phalcon-tools\ide\1.3.2\Phalcon"], "codeintel_scan_files_in_project": false, "codeintel_max_recursive_dir_depth": 5 }

I Hope this helps someone!!

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



165

I suggest to try Codelobster It has better special Phalcon autocomplete