BlogImproved PHP support in Kate Syndicate content

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 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!

Comments

Great! Great Work! I hope Thu, 08/27/2009 - 00:00 — gp (not verified)

Great!

Great Work!

I hope in a official release…

giuseppe

You can get the most-recent Thu, 08/27/2009 - 13:11 — Milian Wolff

You can get the most-recent language file right now, just go to “open/save” in the kate/kwrite settings and then to “Modes &amp; Filetypes”. There you find a button “Download highlighting files” at the bottom.

Post new comment

  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <pre>.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options