Tuesday, October 5, 2010

Hooray for CodeIgniter Code Completion

Now you might have already seen it, but there are methods of getting code completion for native CodeIgniter objects and methods. You can look here for an example that works in NetBeans. Well I have just made the discovery that this will also work in Komodo Edit, which is currently my editor of choice. All you need to do is create a file at the root of your project (I named mine autocomplete.php). Then you put all of the @property lines in it that were defined in the post I just linked. Restart Komodo Edit, and voila you got yourself some code completion.

Though it is not automatic per se if you create a custom library or model you can add those to your auto complete file and they will show up exactly the same. 

While not perfect it is much better than nothing. Also with Komodo Edit's project templates you can make a CodeIgniter base project that already includes an auto complete file. The world is your oyster now!

Here is a link to the autocomplete.php file I use in Komodo Edit. Just drop this into your project root (the same place as the .kpf file) restart Komodo Edit and you should have native CodeIgniter auto completion. If you have custom libraries add them where specified.

http://dl.dropbox.com/u/13081549/autocomplete.php

7 comments:

  1. Thanks very much, Jim. I'm running a version of CI 2 downloaded from Ellis Lab's bitbucket repository. I found that another clean way to do this is to extend CI_Controller and CI_Model with MY_Controller and MY_Model in application/core and add your comments to those files. Without this approach and using the autocomplete.php file you suggested, I was getting some errors with the HTML extension; it didn't know which "Controller" to use.

    ReplyDelete
  2. hy man thaaaaaaaaaanx A loooooooooot for the idea. i got it working in my Komodo just fine. really like a charm.
    you rocksssss.

    ReplyDelete
  3. Glad you like it. I probably should update it for the latest version of CI and get it on GitHub.

    ReplyDelete
  4. It would be great if you could do that!!

    ReplyDelete