I'm using Komodo Edit 4.0 Beta 5 and PHP.
I noticed that autocompletion for user-defined classes wasn't working for me. I thought that adding the class directory to Project Properties > Languages > PHP Directories would solve the issue, but it didn't. Komodo doesn't seem to automatically read in the class files in that directory.
Finally, autocompletion worked when I explicitly included the file in my script with require_once 'Family/Family.php';. The problem is that I would like to use the __autoload() function to automatically load classes rather than to explicitly list every class file. Since I was using __autoload(), Komodo Edit's autocompletion wasn't working for me. It would be great if Komodo Edit could recognize the following piece of code and autoload the class definitions.
function __autoload($class_name) {
require_once 'Family/' . $class_name . '.php';
}Does Komodo IDE already do this?
No, Komodo does not handle __autoload(). You will need to manually add a require statement for the file(s) you need before Komodo's php codeintel will complete for it (Note: you can add one file, which requires everything you need and then simply require that one file).
This is because of the nature of dynamic function loading, you can never be sure what this __autoload function will actually do until runtime.
This is something we are looking at improving for Komodo 4.x.
We have been discussing ways of addressing this, the best approach we have come up with so far has been "include-everything" semantics. So, everything on your php include path would have completion (this can be somewhat overkill). Any other suggestions are wecolme.
Cheers,
Todd
There is now a Komodo 4.0.3 beta which now has support for the PHP "import everything" semantics.
http://support.activestate.com/forum-topic/4-0-3-beta-1
Let us know if this does not help for your above situation.
Thanks,
Todd
I'm trying out Komodo 4.1 and would love to have autocompletion working. I use the Zend Framework, so the autoload is on the one file in the web root that in turn calls Zend_Loader::loadClass. So may views don't have reference to an include or an autoload. Any way to get autocomplete working?
Both Komodo 4.0.3 and Komodo 4.1.0 now contain support for this.
You will need to add the directory path you wish completion for in Komodo's PHP preferences:
Edit->Preferences->Languages->PHP->PHP DirectoriesOnce you've aded the directory, the next time you trigger a php completion event, Komodo will scan this directory you've just added and provide completions for it.
Cheers,
Todd
Hi everyone, now I'm using Komodo 5.1, I've added desired folder to the PHP directories but autocompletion doesn't seem to work, e.g. I'm adding Zend folder which contains Acl.php with class Zend_Acl, right? but intellisense still doesn't show the name Zend_Acl...
Am I dong something wrong???
This is the only problem for me with Komodo IDE, if you help me solve it I'll say that Komodo is the best :)))
Thanks a lot
Giorgi
its me again, seems like autocompletion needs time to start working, now it worked fine, thanks for awesome product, Komodo IDE rules indeed :)
Regards
Giorgi
Nevermind.
Problem is we can not (or I did not find how) include a sftp directory in the include path. I manage to do that using sshfs but It's may be diffult for a normal user ...
Yes, the code intelligence will not include files from remote servers... mostly because this is a huge performance issue as well as very technically challenging.