Category Archives: Users

Kate in KDE 4.10

According to our release schedule, KDE SC 4.10.0 will be available to the public in early February 2013. Following Kate in KDE 4.7, Kate in KDE 4.8 and Kate in KDE 4.9, this blog post highlights what’s new in Kate in KDE 4.10.

New Features

News in the Plugins World

  • Kate’s Pate plugin now provides several new plugins by default, with Python 3 support.
  • Kate gained a new and very powerful Project plugin with ctags code completion. It is tightly integrated with the Search & Replace plugin as well as the GDB Plugin and the Quick Open feature.
  • Kate Search & Replace plugin gained find-as-you-type support.

Improvements

Bug Fixes

Most of the following work was done during the yearly KDE conference and especially the joint Kate/KDevelop meeting this October in Vienna. A massive bug database cleanup was performed mainly by Christoph, so we closed several hundreds of bug reports, where ~280 are really fixed. So we are down to a total of 400 reports (only 70 of these 400 reports are bugs), where we initially had > 800 open issues. This also is reflected in the Kate bug charts:

Thanks to all contributors to make yet another release rock! :-) And as always: We are happy for every contribution, so check out the Kate sources and send us patches! We hope you enjoy using Kate as much as we enjoy its development :-)

Default Color Schemas

With KDE 4.10, the naming of the color schemas in Kate Part changed. Instead of having “<app name> – Normal” and “<app name> – Printing” we now just have “Normal” and “Printing,” meaning that all applications using Kate Part now share these color schemas. In other words: If you change the Normal schema in KDevelop, you also will see these changes in Kile, Kate, or any other application that embeds Kate Part. If you just want to change the color schema for a single application, create a new color schema and then use this new schema as default!

Besides that, it’s been a looong way, but finally Kate will ship several default color schemas in KDE 4.10:

Normal Color Schema

Vim (dark)

The colors are not all perfect, so we hope to improve them over time, so if you always wanted to contribute to Kate, we could need help here :-)

Kate Scripting Updates & Zen-like Quick Coding

In KDE >= 4.10, Kate Part’s scripting changed a bit. The changes are already documented in the Kate handbook, but we’ll quickly have a look into it now anyway.

Prior to KDE SC 4.10, scripts in Kate Part always had to contain the “type” in the scripting header, like indentation or command. This was changed to simply using different folders (system wide or in your $HOME kde folder) as follows:

  • indenters are located in share/apps/katepart/script/indentation
  • commands are located in share/apps/katepart/script/commands
  • api is located in share/apps/katepart/script/libraries

Further, the API is not loaded automatically anymore. Instead, we introduced the function require(“file.js”), which takes one argument. For instance, if you want to use the Cursor and Range API, you just write

require("cursor.js");
require("range.js");

In this example, it would even suffice to just write require(“range.js”); since range.js itself contains the line require(“cursor.js”); Kate Part tracks, which files are already included through require, so you don’t have to worry about include guards like in C/C++.

Now as we are able to just load the libraries that we really need, we can add as many libraries as wanted. For instance, the author of zen-coding wrote a thin wrapper to make all the zen-coding goodies available to Kate Part. It’s included in the emmet subfolder in the script/libraries folder. So if you need this stuff, you just write require(“emmet/desired-file.js”);

It’s a bit unfortunate that we still break how the scripting works from time to time, but it’s better to fix and improve the scripting instead of living with limited capabilities. So if you have own scripts, it’s the best time to contribute them to Kate!

Generic Quick Coding Features

Further, we have some new command line script called quickcoding.js that already uses the zen-coding idea: If you for instance write

 c#n:Test#p:Parent

and press Ctrl+Alt+# in C++ files (the Mode must be C++!), it will automatically expand to

/**
 * Class Test
 */
class Test : public Parent
{
  public:
    /**
     * Constructor of Test
     */
    Test ();

    /**
     * Destructor of Test
     */
    ~Test ();
};

So how does it work? Since the file mode is C++, the quick coding command will read files from katepart/script/files/quickcoding/cpp/. The first character of this cryptic string is ‘c’, which tells the quick coding command to look into c.template. This template now expands according to the specified arguments: n:Test sets the class name to Test, and the optional p:Parent derives Test from Parent.

This is just a proof of concept, and you can do the same with Text Snippts in Kate. But still, this is another way adding support for quick coding for arbitrary languges, and the implementation is completely in JavaScript, so it is rather easy to extend and customize it to your needs. We’ll probably extend/change this feature a bit more over time, let’s see :-) It’s also not yet documented in the Kate Handbook. We’ll probably add ‘official’ documentation for this in later Kate releases. Happy coding!