All posts by Milian Wolff

KDevelop & KWrite/Kate hacksprint 2010 in Berlin

Hey everybody!

If you are a KDevelop and/or Kate/Kwrite developer and do not read the mailing lists: There’s a hack sprint coming up in Berlin in 2010. I think there’ve been enough sprints in Berlin already so that you know it’s a great city for such an event. Though this time it won’t be at KDAB or Nokia offices, but at the Physics Faculty of the FU-Berlin. Since I (currently) work there as an IT admin, it was my first choice and worked out. I hope it will be a good location for the meeting. If you want to attend, vote on doodle:

http://www.doodle.com/vkyh9up9794zr4s8

But you probably also should register either on the KDevelop or KWrite mailing lists so I have some kind of way to contact you.

PS: in unrelated news I’ll do an internship at KDAB next year! yay

first experience with Archlinux

So, I kinda messed up my desktop right after the upgrade to karmic, because I was too greedy for performance and converted my root file system to ext4. Well, that worked like a charm on my laptop, but it broke my desktop. This is in no way karmic’s fault, it’s my own misbehavior. Thankfully I could rescue most of my data.

Since I’d had to reinstall anyways, I decided to finally try out Archlinux. I find the rolling release mantra very intriguing. Together with a “simpler” packaging, namely no splitting between -dev and -dbg packages like debian/ubuntu does, this is destined to be a good environment for a developer. I always hated it to track down missing -dev packages when compiling software. And don’t get me started on outdated software in repos… I just compiled kdelibs and the only missing build dependency was hspell, that I don’t need anyways. Under Jaunty I had to compile stuff from kdesupport to fulfill updated dependencies. And the list of not-found optional dependencies was huge, since I did not spent time to install all those -dev packages by hand…

My first impression of Archlinux is very good so far. I also finally migrated to 64bit wich works like a charm, no issues with flash or anything. Since I never used a 64bit Ubuntu/Debian I’m not sure, whether the perceived performance increase is due to the switch to 64bit or whether Archlinux optimized packages are responsible. Probably both. Nevertheless I can safely say that my system feels snappier than before.

Of course, the installation and initial setup is not as straight forward / easy as with Debian/Ubuntu: Yet it’s no big deal for anyone with some Linux experience. And, once everything is setup, you are running KDE again, so no real difference. Thanks to the Chakra team for kdemod, it works like a charm!

I might have spent a bit more time during the installation / initial configuration, but I think this would have happened also if I’d installed any other distro I’ve never used before, like OpenSuse or Fedora.

Oh and since I can install sudo I can keep my old habits. Neat.

The only thing I miss so far is aptitude with it’s straight forward command structure. Yaourt/Pacman is fast and nice, esp. with pacman-color, but the commands don’t feel as straight forward to me… Personal preference I’d say.

To conclude: Archlinux is very nice, I can wholeheartedly recommend using it so far. Probably nothing for a novice Linux user, yet perfect for advanced users. Very good as a development environment. Fast. Up to date. I like it :)

Now I can finally continue hacking on Kate/Kdelibs again :) I’m currently in the process of refactoring Kate’s implementation of the TemplateInterface. Even in it’s current state it already implements features like mirrored snippets and the like. But once I’ve finished with the cleanup I will try to implement some more of the features that are found in e.g. yasnippet for Emacs. I really wonder why nobody else did that already…

Once this is finished, you can expect that I will deeply integrate that feature in various places in KDevelop, especially for code completion, snippet plugin etc. pp. Stay tuned!

Improved PHP support in Kate

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 heredocs
screenshot of improved highlighting in PHP heredocs

I 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 (IncludeRules just 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 regions
code folding with overlapping syntax regions

Another long standing bug (accommodate overlapping syntax regions (especially for php)) got fixed by James Sleeman.

Finally PHP templates with code such as

  1. <?php if ( true ) : ?>
  2. <!-- some html stuff -->
  3. <?php elseif ( false ) { ?>
  4. <!-- some other html stuff -->
  5. <?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!

Kate linter plugin

Just a quicky: I wrote a little plugin for KTextEditor which supplies you with basic error checking when you save documents. Currently only PHP (via php -l) and JavaScript (via JavaScript Lint) are supported.

Screenshots
Requirements
  • usual tools for compiling C++, e.g. gcc.
  • cmake
  • Qt development packages, i.e. under Ubuntu: sudo aptitude install libqt4-dev
  • KDE 4.2 with development packages for kdelibs and kdebase, i.e. under Ubuntu: sudo aptitude install kdebase-dev kdebase-workspace-dev kdelibs5-dev. Note: You’ll need the experimental KDE 4.2 packages activated as of now, see for example the Kubuntu news on KDE 4.2 RC1 for hints.
  • proper setup of environment variables, read this techbase article for more information. the .bashrc linked there should be enough for most people
  • For PHP support: a PHP executable which supports the -l switch for linting
  • For JavaScript support: a JavaScript Lint executable, you could download and compile the sources for example.
Installing

Get the sources for the linter plugin from KDE SVN and compile it, using e.g. the functions supplied via the .bashrc mentioned above:

  1. # go to your development folder
  2. cs
  3. # checkout sources
  4. svn co svn://anonsvn.kde.org/home/kde/trunk/playground/devtools/kte_linter
  5. cd kte_linter
  6. # build base linter plugin
  7. cd linter
  8. cmakekde
  9. # build php linter plugin
  10. cd ../phplinter
  11. cmakekde
  12. # build javascript linter plugin
  13. cd ../jslinter
  14. cmakekde
  15. # update sycoca
  16. kbuildsycoca4
  17. # start editor and select the plugins - happy coding!
  18. kwrite
Todo
  • Support for more languages

    If you know good linters drop me a note. But it would be even better if you could write your own linter plugin. It’s pretty easy, take a look at one of the existing plugins for a skeleton & documentation.

  • Right now each plugin returns a hardcoded list of highlighting-modes which it supports for linting. This should be made configurable so that custom highlighting modes are supported

  • make error messages more pretty

Happy coding!