Code completion in views with Eclipse PDT

Published on and tagged with cakephp  eclipse  view

If you use Eclipse PDT you probably noticed that there is no code completion in the view for helpers. The reason for that behavior is that Eclipse doesn’t know anything about CakePHP’s magic and so cannot provide code completion.

Now someone called “voidstate” posted a little trick in the CakePHP Google Group which makes it possible to get code completion in the view for helpers. For this purpose you have to create a PHP file somewhere in your project (it doesn’t matter where) with the following content:

 // stop page loading 
// reference helpers so Eclipse provides code completion 
 $ajax = new AjaxHelper(); 
 $cache = new CacheHelper(); 
 $form = new FormHelper(); 
 $html = new HtmlHelper(); 
 $javascript = new JavascriptHelper(); 
 $number = new NumberHelper(); 
 $session = new SessionHelper(); 
 $text = new TextHelper(); 
 $time = new TimeHelper(); 

As soon as the file is stored, you should have code completion. Thanks to voidstate for this trick!

14 comments baked

© daniel hofstetter. Licensed under a Creative Commons License