PHP support for KDevelop 4 (and eventually Quanta+)
Hello Planet KDE!
I want to give you a little insight on the current state of PHP support in KDevelop4:
Me and Nikolaus Sams (nsams) are working diligently on a plugin for PHP support in playground. It’s somewhat stable, i.e. we fix any crashes we stumble upon, but I would call it Alpha state at most. It may eat your babies so to speak. Yet I’m happy to say that at least one user is already using it for production (hi leinir ;-) ).
implemented PHP support
Well, here’s a (not complete) list of features that are already working. Though I have to warn you: no screenshots included ;-) It’s actually all very similar to the C++ screenies you can see on the web.
Let’s start with a feature that only very recently was added for PHP - semantic highlighting. Niko moved some language independent parts of the C++ plugin from KDevelop to KDevplatform and now PHP has the same code highlighting features as C++.
I personally love this feature since it makes it even easier to grasp code and it makes the code highlighting more consistent since there is no visual difference between PHP built-in functions/constants and your own.
Arguably one of the most useful features the DUChain enables us to write is code completion. There’s already full support for:
- PHP built-in functions, classes, constants, superglobals
- user-defined functions, classes, constants, superglobals, variables, etc.
- proper code completion for objects which respects access modifiers (private, public, protected) and differentiates between static/non-static members and methods
- code completion for overridable and implementable functions inside classes
- hints in the argument list of function- and method class
- sane code completion after keywords such as “extends, implements, catch(), new, throw” and some more I think
There’s still some bugs to fix and a few features to implement. But I can easily say that even the current state of code completion makes one wonder how he could use Quanta (from KDE3 times) for such a long time! It’s simply nothing compared to this!
The next feature I hope to add is support for type hinting in function calls. I.e. only show arrays where arrays are requested and the same for objects of a given type. Also no PHP keywords are currently completed at all …
other DUChain/UseBuilder stuff
Thanks to the DUChain you already get lots of information about declarations, such as uses (which files, which lines etc.). Also very neat is the hover popup you might now from C++ which among others shows you phpdoc comments inside your browser. I also plan to integrate the php.net documentation into KDevelop, similar to what is already possible for QtHelp.
inline validation / syntax checking / linting
Another feature which saves lots of time is on-the-fly syntax checking: You won’t have to fire up your web-app inside a browser just to be greated by that pesty “syntax error, unexpected ‘CHAR’ in FILE on line XYZ” message… No! Instead you will see a nice reddish zig-zag line where you made the error and can fix it before heading off to the browser.
But we don’t only do basic syntax checking. We do more than that, thanks again to the power of the (holy?) DUChain. You can spot undeclared variables, function/method/class/constant redeclarations and more. Actually I hope that one day we spot most of the notices, warnings and errors PHP could emit.
We already have a multitude of regression tests which will make sure that we don’t mess up any existing stuff. Lets hope for even more of them :) I love test-driven development.
Well, thats pretty much it for the moment. You can have a look at what we are up to at the Quanta Feature plan on techbase.
If you are a PHP developer and can write C++ with Qt, why not get in touch with us? You can find us both on the KDevelop mailinglist and at least me and leinir are often found in #kdevelop on freenode.
Let me finish with a quick introduction of myself:
Some of you might now my from the LinuxTag in Berlin where I could be found at the Kubuntu-De.org community booth. At least with some of you I had a beer (well, I doubt it was only one ). I hope to repeat this tradition in 2009. Every once in a while I can also be spotted at ubuntu-berlin events.