› Blog 
» Improved PHP support in Kate
Wed, 08/26/2009 - 16:20
Not only KDevelop gets better and better PHP support — the Kate PHP syntax file also got a few new features and fixes over the last weeks. The good thing is of course that all users of KWrite, Kate, Quanta, KDevelop and other editors leveraging the Katepart benefit from these changes.
Improved HereDocs
screenshot of improved highlighting in PHP heredocsI went over PHP related bugs on bugs.kde.org today and spotted one that was fairly easy to fix:
vim-like syntax highlighting support for heredocs in php.xml
With some magic (
IncludeRulesjust rocks) I got it working fairly easy. You can see the results to the right.Additionally I added code folding to heredocs, since often these strings include lots of text and hiding it often makes sense.
Better support for overlapping syntax regions
code folding with overlapping syntax regionsAnother long standing bug (”accommodate overlapping syntax regions (especially for php)”) got fixed by James Sleeman.
Finally PHP templates with code such as
- <?php if ( true ) : ?>
- <!-- some html stuff -->
- <?php elseif ( false ) { ?>
- <!-- some other html stuff -->
- <?php } ?>
can be folded properly. This kind of spaghetti code is used quite often in simple templates and having the posibility to fold it properly is a huge win in my opinion. Thanks to James Sleeman again!
» News for PHP in KDevelop
Sun, 08/16/2009 - 01:24
So, after a period of silence I present you an unsorted list of features and bug fixes I did to the PHP plugin for KDevelop in the last few weeks:
added support for path autocompletion after require / include statements: This shares code with the Cpp plugin and it’s completion after #include. I plan to use this autocompletion eventually also for functions accepting filenames or paths. Think of fopen, file_get_contents etc. pp. So far only URLs that are covered by an open project can be completed. We will need support for custom include paths so we can support e.g. global PEAR or framework installations.worked around a bug where the “schedule all project files for parsing” had no affect. Apaku is currently working on making some internal changes so I can remove the workaround and fix this properly. With this fixed/worked around you should retry the PHP plugin along with frameworks or similar to see how well it works. Just make sure to have the framework inside your project so it gets parsed.
fixed code completion of static class members for classes that where not defined in the current file
by sharing code with the cpp plugin I made it possible to show information about includes on hover. You can open the file from that popup or just see what classes, functions, variables etc. are defined there and jump to them quickly.report errors when the user tries to include a directory
totally rewrite a huge part of the code completion: It now utilizes the token stream and can hence work much more reliably. Also the code is much cleaner in my opinion and it should be easier to extend its functionality. If you spot places where you think no code completion should happen or vice versa, please report that to me!
don’t crash on empty includes (i.e.
include "";)ignore xml declarations (i.e.
<?xml ... ?>)support implicit declarations of referenced arguments, esp. important for e.g.
preg_match("#...#", $string, $matches);, before the$matcheswas said to be undefined. Additionally references should be marked and shown as such now in the popups of e.g. function arguments.support implicit array declarations, e.g.
$a[0] = 1; // now $a is an arrayfix bug which made the class browser not aware of changes in PHP class structures. Now we can see new classes, methods and members directly after writing them in a PHP file.
support
/// commentsyntax for doc-comments, especially useful for type hints of variables.report error when someone tries to declare a class constant with an invalid type (i.e. not bool, int, float or string)
I’m very happy to say that we seem to get more and more (happy) users!
» Dear Lazy Web: Hackable Mobile Phone with good Music Player?
Mon, 07/06/2009 - 10:31
Hey all, I need your help:
I lost my Ipod and now have to live without music on the road… Sucks pretty much, I can’t live without music…
Since my current mobile phone is pretty shabby I thought about fixing both in one go: Buy a mobile phone which could replace my Ipod as well!
Now lets first say what I need most:
- should’nt be too expensive: A new Ipod with 120gb costs only ~200€. So even though I hate that device, I doubt I’ll pay like twice the sum just to get something different…
- It needs a “Klinke” stereo output, i.e. something where I can put my normal headphones in.
- I need space for my music: My last Ipod (80Gb) was completly full… Ok, I think I can make a few cuts, though 8gb only is not enough. Hence the phone should support hot-swapping of SDHC cards at least.
- If I buy such an expensive device, I’d like to be able to write my own software for it, or put existing software on it.
What I found is the Nokia 5800 express music. It costs like ~260€. 16Gb more space costs like ~45€… It has stereo output and SDHC support. But what I don’t know: Where will custom software be saved on? Also on the SDHC? That would make hot-swapping kind of pointless…
Good thing: It’s S60 5th gen, so Qt will run it and I can write my own software - that’s pretty cool. Though one question: Do I need Windows for the SDKs or can I develop under Linux?
So… Does anyone have a better suggestion? Or any experience with that mobile phone? I really hate that there is no alternative to Ipods with a lot of space… Monopoly sucks! And I can’t even put my own stuff on such an Ipod… Not even Rockbox any more :( I hate Apple for that!
But since I’m a poor student I somehow really doubt that I’ll get myself a new phone, esp. since additional SDHC cards cost quite much…
» Progress in non-cpp KDevelop4 land
Wed, 05/27/2009 - 21:09
Has been a time since I wrote the last update for PHP / webdevelopment related work in KDevelop4…
XDebug
First of all, Niko (nsams) is working diligently on the general debugger framework for KDevelop4. Of course gdb is still the main focus so far yet he always has his XDebug plugin (which is currently unusable) in mind. So expect some great debugging features once he’s done with the framework.
Remote Projects
Another thing I’ve not yet written about is a bunch of commits I did just after the Hackaton: Remote Projects! Yes, finally you can work directly on the server with KDevelop. I still have to make sure that the user does not try to open a remote cmake project (or similar), because that is of course not supported. Only the Generic Project Manager (basically a list of files in a dir) works. There’s for sure some things to polish, yet I’d like to see user feedback for that use-case at least.
Note: There is still some functionality missing in other areas, like creating a new remote project from a template etc.
Out-of-class declarations of member variables
The PHP plugin itself got support for some more code, like declarations of members variables outside the class context which was reported by one of our early adopters (hint hint - do the same! we need more wishes and bug reports!).
Improved DeclarationBuilder
Additionally I changed the logic of our DeclarationBuilder so it does not create a new variable declaration for each assigment expression. I think this makes refactoring, use-highlighting etc. in a PHP environment much better for many cases. Sadly it is not yet perfect since we still need to redeclare variables when their type changes. Fixing that would require potentially big changes to the DUChain and I’m not sure when it will happen.
Error Reporting
Furthermore I’ve added some more inline error reportings, namely for redeclaration of
$thisin a class context. This is also an area where you might help us a lot: Send us PHP snippets which fail when executed but are not yet highlighted in the editor. I’ll try to add them then. Just use the bugtracker on http://bugs.kde.org.Performance
Also David (dnolden / zwabel) of Cpp-KDev4 fame made some changes which resulted in a good performance win. Thanks!
» KDevelop Hack Sprint 2009 - Day 2 and 3
Thu, 04/23/2009 - 01:31
Ok, just a quick update on what we are doing / have done the last two days except drinking beer and eating quite a lot of food (though it never seems to be enough somehow….)
- Apol was polishing CMake support, speeding up KDevelop startup time when you enabled the QtHelp plugin, making sure that Kross plugins get loaded properly and some other things
- Adymo started some refactoring of Sublime in an experimental branch (actually they had quite a long discussion right now about things in the UI which should be changed/fixed). Besides that he also fixed some little bugs in the includepath resolver for CMake
- Nsams is fixing PHP support and adding new features here and there. Esp. completion inside a foreach over a Iterator class works now!
- and as always ZWabel did fix quite a lot of bugs, most of them which only were discoverable in a few corner cases, very nice indeed.
- shaforo who sadly already left us again to attend university fixed the sorting in the Project view among other things
- With Apols help I managed to get started with a documentation plugin which (currently) integrates PHP.net. I plan to make it possible to use the downloadable PHP.net documentation as well to speed things up. Actually setting up a documentation plugin is very easy! Maybe I’ll take a look at writing a documentation plugin for Zend, Symfony, etc. pp. as well - should be fairly easy. Maybe I can come up with a generic documentation plugin which makes it possible to include any kind of
.htmldocumentation with some configurable mapping… lets see! Or maybe I should take a look at writing Kross plugins (Apol could help me here as well) for that purpose.
Except these changes we also discussed how to support dynamically typed languages like PHP, Ruby, Python and JavaScript better. One result of it that we now plan to fully support the dedicated map types of each language, with autocompletion and such. Of course that won’t be possible for 100% of the use-cases, but we hope to support at least the most common ones (i.e. 90%). You can take a look at http://www.kdevelop.org/mediawiki/index.php/SupportForDynamicMaps for more information.
Additionally Nsams, Apol and Zwabel took a look at the GDB plugin and started working on it a bit. It’s still a work in progress though.
My biggest change is that color highlighting support for dark color schemes now is in trunk. It automatically adapts to changes in the global KDE color scheme, yet you still have to manually change the Kate color scheme. Actually I intend to add an interface to Kate so we can use it’s color schemes instead of the global KDE one - makes much more sense and would fix some bugs (i.e. fix from dark color scheme to a light one). Here’s a screenshot of it (with the PHP.net documentation showing):
dark color scheme and syntax highlighting in KDevelop 4If you followed the planet kde you might have seen some blog posts about color reception and color generation by Ariya Hidayat. I will take a look at it and implement it in KDevelop. Or I simply pick a given set of colors and use them - for 10 colors or so we need it doesn’t make that much sense to let them be generated. Yet the article he linked to about adaptive coloring for syntax highlighting will be helpful I think! Thanks!
Yet it currently works quite well I’ll first try to fix the colors in the Declaration tooltip, quickopen and codecompletion lists.
So stay tuned for more KDevelop goodness throughout the next days.
» KDevelop Hack Sprint 2009 - Day 1
Mon, 04/20/2009 - 23:01
Ok, a short blog about the first day of our KDevelop Hack Sprint at Mykolayiv (see my first blog post). First up, being in the Ukraine is a very interesting experience since it’s totally different from any place I have ever been to. And thanks to the great hospitality of Alexander (adymo) we already had a city tour of Odessa and Mykolayiv.
Tomorrow will be the first real day of our hack sprint: Today we only hacked at our flat for a few hours. Before that we had the city tour through Mykolayiv. And tomorrow David Nolden (zwabel) and Nick Shaforostoff will arrive which will make the list complete.
Today I personally worked on making KDevelop support dark color schemes better which is still a work in progress (nothing comitted so far). Actually for a real good experience I’ll have to extend KTextEditor to make it’s color configuration available for the parent application (i.e. KDevelop). Let’s see when I get to that. Though I plan to push my patches to KDevplatform beforehand for an intermediate solution.
Random other notes about Ukraine: - I love the Vodka (esp. with its prices) here! - breakfast at a cafe is pretty much a no-go here it seems - street lights are luxury - very many old building all across the city, looks pretty good. Though would look even better if all of them would be in a good shape… Yet I still prefer it that way - I hate what was done to Berlin after the war, i.e. that they teared most of the old buildings apart instead of repairing them…
So, lets see what tomorrow brings, now I’m back to some more hacking :)
» About being a Nerd
Tue, 04/07/2009 - 23:41
A quick meta-blog about nothing directly KDE related, but I think those of you who can understand German should see it nonetheless. Hope you don’t mind me spreading it on the planet:
I just stumbled upon a great video about the definition of “being a nerd”. You can watch it here:
http://www.elektrischer-reporter.de/elr/video/115/ (note: it’s in German!)
I have to say that I can identify myself with the message of the video, very nicely done. Must see for anyone! I’ll spread it in my circle of friends so they understand me better when I talk (proudly) about being a geek.
» KDevelop Hack Sprint
Thu, 04/02/2009 - 01:38
Huzza! The KDevelop Hack Sprint 09 is now official.
Thanks to the huge engagement of Alexander Dymo we will meet from the 19th to 26th April 2009. The meeting will take place at Alexander’s university, the national university of shipbuilding in
OdessaMykolayiv, Ukraine. Thanks to the people there responsible for making this sprint possible by providing us with the premises, internet, power etc.Since this is my very first Hack Sprint and considering that I only recently started contributing to KDE in general and KDevelop in particular I am very excited. The topics I will plan to hack on include (all related to PHP language support plugin):
- add auto completion after
require(_once)andinclude(_once), just like it works for#includein CPP - add auto completion of PHP statements (think
echo,exit,require(_once,include(_once)etc. pp.) - add auto completion for build-in PHP keywords
- fix auto completion of interfaces / classes after the keywords
implementsandextends(working on that right now) - fix KDevplatform and the Generic Plugin Manager to support remote projects, i.e. via
fishorftp(or anything else supported by KIO)
Since I’ll have a whole week of hacking time I hope to get all that done. And more. Since another great thing about the Sprint will be that I can finally meet Niko (nsams) in person. For those of you who don’t know: He’s the one who started the PHP language support plugin. Expect some additional points from our roadmap getting implemented / fixed during that time!
Furthermore it looks like Mr DUChain himself - David Nolden - will attend as well. I have some ideas regarding parts of the PHP plugin I want to refactor but need additional insight to the way the DUChain works. Let’s see if David and I can work it out.
And maybe I can even take a look at Quanta 4 itself… Let’s see!
I’m very much looking forward to the Sprint and meeting some of the other developers! And much thanks again to Alexander for planning all this. Oh and also a very great Thank You goes to the KDE e.V. for sponsoring the event. I wouldn’t have been able to attend otherwise!
Keep an eye on the planet for more blog posts during the Hack Sprint, I’ll try to write some daily coverage. Now lets see if I can get to sleep…
Update: The meeting actually takes place in Mykolayiv, 120km from Odessa :) Thank god that I will be picked up at the airport and don’t have to find it myself…
- add auto completion after
» Building KDevplatform, KDevelop and the PHP plugin from SVN
Fri, 03/06/2009 - 01:21
In a follow up to my last post about the PHP plugin for KDevelop and Quanta I want to detail how I setup my build environment. Since I’m only working on KDevelop I only want to compile that. For all other applications, I use the packages my distribution makes available. Below you this is possible.
Note: I use Kubuntu and hence some commands like
aptitudeand the package names etc. will have to be adapted to your specific distribution. But the general idea should be the same and the packages should be called at least somewhat similar. You could always take a look at the techbase article on compilation of KDE 4 to get a more general HowTo.It is generally a very good idea to read some articles on the techbase. Especially in the Getting Started section.
getting the dependencies
First, you’ll need to install some packages to satisfy dependencies and to get a working compile chain (think cmake, gcc and stuff). The following command only lists very few packages but they have a huge list of dependencies which your package manager will take into account automatically. Don’t be suprised by a possibly huge list of packages ;-) So some disk space will be required (though I doubt it’s more than 250MB in total).
Note: You’ll need the KDE 4.2.x versions of the KDE libraries and development packages. When you use Kubuntu, you can follow this article to get up to date packages for the 8.10 release.
- # I hope these are all, it's been a time since I did that the last time
- # please report if anything is missing
- aptitude install kdelibs5-dev kdebase-workspace-dev \
- libqt4-dev build-essential subversion kdesdk-scripts \
- bison flex
removing old cruft
To prevent binary compatibility issues that will result in crashes, you have to remove all KDevelop & KDevplatform packages provided by your package maintainer. In karmic it should be enough to remove kdevplatform, and it will remove all dependent packages:
- aptitude purge kdevplatform libsublime
setting up your environment
Inspired by the techbase article on improved productivity in KDE4, particularly the bashrc listed there, I’ve come up with the following way to configure my system:
First visit my shell helper git repo on GitHub and download the two files
kde4_setup_build_environment.shandbash_setup_kde4_programming.set the environment variables
Move the file
kde4_setup_build_environment.shto~/.kde/envand make it executable. You might want to adapt the paths for the variablesKDE_BUILD,KDE_SRCandKDEDIRinside that file to your likings.This part is required to make sure that compiled programs will act just like normal programs installed globally (e.g. with your package manager) right from the start of your KDE session. I.e. KRunner works fine and custom plugins are found etc.
make your life easier with some bash magic
Now alter your
~/.bashrcand to the bottom of that file add the following line:- . ~/.bash_setup_kde4_programming
NOTE: This assumes that you saved the afore mentioned
bash_setup_kde4_programmingfile to~/.bash_setup_kde4_programming. You might have to change the path.NOTE: That file also sources the above script to set the environment variables. I’m not sure it’s required, but it doesn’t hurt. So make sure the path is correct there.
Now to the fun part
Once all that’s done, you have to log out of your bash session to get the environments. Maybe even logout of your KDE session to make it aware of the new paths as well.
checking out KDevplatform, KDevelop and the PHP plugin
Get the latest and greatest directly from SVN (see also Using Subversion with KDE on techbase):
- cs # cs is not a typo! see above
- git clone git://gitorious.org/kdevelop/kdevplatform.git
- git clone git://gitorious.org/kdevelop/kdevelop.git
- git clone git://gitorious.org/kdevelop/kdevelop-pg-qt.git
- git clone git://gitorious.org/kdevelop/php.git
- git clone git://gitorious.org/kdevelop/php-docs.git
compiling and installing
Now it’s time to compile all that code you just checked out. Hopefully you got all required dependencies. If you need all bells and whistles, you’ll have to install some more packages I’m sure. If you run the code below, take a good look at the output of the
cmakekdecommand (especially at the beginning). It lists not-found dependencies.Note:
cmakekdeis supposed to be run from inside your source folder (e.g.cs $FOLDER; cmakekde).- for p in kdevplatform kdevelop kdevelop-pg-qt php php-docs; do
- cs $p
- cmakekde
- done;
- kbuildsycoca4 # make sure new plugins etc. are found
Pretty easy, hum? Let’s hope everything worked fine :)
staying up to date
That above command is only required once. Everytime after that, you can simply do the following which will make sure you are running the latest and greatest:
- for p in kdevplatform kdevelop kdevelop-pg-qt php php-docs; do
- cs $p
- git pull --rebase && make install
- done
The End
Hope I have not forgotten anything and that this (rather lengthy…) HowTo is of some help to a few of you out there. Looking forward to feature requests, bug reports etc.
UPDATE 18/05/10: updated to include
kdevelop-pg-qt, introducedforloops in setup snippetsUPDATE 07/05/10: updated to git locations
UPDATE 08/01/10: updated to extragear location of php & php-docs
UPDATE 01/12/09: added php-docs, updated to extragear location of kdevplatform & kdevelop.
UPDATE 17/12/09: updated to kdereview location of php & php-docs
» PHP support for KDevelop 4 (and eventually Quanta+)
Tue, 03/03/2009 - 00:28
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.
sematic highlighting
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.
code completion
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.
tests
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.
The End
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.
PS:
Let me finish with a quick introduction of myself:
My name is Milian Wolff, I study Physics at the FU Berlin (just finished the 3rd semester). I started learning programming when I was around 14 with PHP. Over the years I became very good in it and the other webdevelopment techniques like Css, JavaScript etc. Recently I started to fullfill my biggest geek dream by learning C++/Qt/KDE and starting to contribute to the KDE project.
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.