Category Archives: Common

Kate Part (KF5): New Default Styles for better Color Schemes

Kate Part gained 17 new default styles in addition to the existing 14 default styles. These changes are available for Kate based on the KDE frameworks 5 initiative and currently live in ktexteditor.git module.

Default Styles are predefined font and color styles that are used by Kate Part’s syntax highlighting. For instance, Kate Part always had a default style for comments. Therewith, the comments in all syntax highlighting files look the same (by default, a gray color). Or keywords are by default always bold and black.

However, during the last years it became apparent that the list of 14 default styles were not always enough. Consequently, lots of syntax highlighting files defined their own hard-coded colors. For instance, doxygen comments were hard-coded in a dark blue color. The problem with hard-coded colors is that they do not adapt when changing the default styles. Hence, doxygen comments were barely readable on a dark color scheme.

Therefore, a discussion took place on kwrite-devel (thread 1, thread 2, thread 3) that ended in 17 new default styles and a categorization of these as follows (the new default styles are bold):

Category “Normal Text and Source Code

  • dsNormal: default for normal text and source code.
  • dsKeyword: Used for language keywords.
  • dsFunction: Used for function definitions and function calls.
  • dsVariable: Used for variables, if applicable. Example: $foo in PHP.
  • dsControlFlow: Used for control flow highlighting, e.g., if, then, else, return, continue.
  • dsOperator: Used for operators such as +, -, *, / and :: etc.
  • dsBuiltIn: Used for built-in language classes and functions, if applicable.
  • dsExtension: Used for extensions, such as Qt or boost.
  • dsPreprocessor: Used for preprocessor statements.
  • dsAttribute: Used for attributes of functions or objects, e.g. @override in Java, or __declspec(…) and __attribute__((…))in C/C++.

Category “Strings & Characters

  • dsChar: Used for a single character.
  • dsSpecialChar: Used for an escaped character in strings, e.g. “hello\n”.
  • dsString: Default for strings.
  • dsVerbatimString: Used for verbatim strings such as HERE docs.
  • dsSpecialString: Used for special strings such as regular expressions in ECMAScript or LaTeX math mode.
  • dsImport: Used for includes, imports, modules, or LaTeX packages

Category “Numbers, Types & Constants

  • dsDataType: Used for data types such as int, char, float etc.
  • dsDecVal: Used for decimal values.
  • dsBaseN: Used for numbers with base other than 10.
  • dsFloat: Used for floating point numbers.
  • dsConstant: Used for language constants, e.g. True, False, None in Python or nullptr in C/C++.

Category “Comments & Documentation

  • dsComment: Used for normal comments.
  • dsDocumentation: Used for comments that reflect API documentation, e.g., the default style for /** */ comments.
  • dsAnnotation: Used for annotations in comments, e.g. @param in Doxygen or JavaDoc.
  • dsCommentVar: Used to refer to variables in a comment, e.g. after @param <identifier> in Doxygen or JavaDoc.
  • dsRegionMarker: Used for region markers, typically defined by BEGIN/END.
  • dsInformation: Used for information, e.g. the keyword @note in Doxygen.
  • dsWarning: Used for warnings, e.g. the keyword @warning in Doxygen.
  • dsAlert: Used for comment specials such as TODO and WARNING in comments.

Category “Miscellaneous

  • dsOthers: Used for attributes that do not match any of the other default styles.
  • dsError: Used to indicate wrong syntax.

Existing Syntax Highlighting Files

If the new default styles are not used, syntax highlighting files are backwards compatible to Kate Part in KDE SC 4. However, the plan is to use the new default styles where applicable to avoid hard-coded colors. To this end, the kateversion attribute in the language element will be set to 5.0 (yes, Kate Part’s version changed from 3 to 5 to match KDE frameworks 5) to avoid loading incompatible syntax highlighting xml files in older Kate Part versions. Example:

<language name="C++" kateversion="5.0" [other attributes omitted]>

With the new default styles, the Default Styles tab looks as follows:
Default Styles in KF5


In comparison, the KDE 4.x version looks like this:
Default Styles in KDE 4


The new default style colors are not fixed yet, so improvements and additional color themes we can ship with Kate Part by default are a welcome addition!

A Note at 3rd Party Developers

There are other implementations (such as in Qt Creator or for Haskell). If you developers read this, we encourage you to add these default styles as well once Kate Part 5 is released (stable). Otherwise, the new syntax highlighting files may not be compatible.

Lumen – A Code-Completion Plugin for the D Programming Language

I am the original author of the Lumen KTextEditor plugin and I am happy to announce, I just committed it to the Kate repository for KDE 4.13!

Lumen is just the name for a plugin providing code-completion for the D programming language in KTextEditor/Kate and KDevelop. But Lumen is just a connection between the editor and the D Completion Daemon (a server providing all the information) called  DCD. The plugin currently supports all major features of the completion server: feeding the server with import files, displaying documentation and several types of completion:


example of lumen (imports)

Basic Completion:

example of lumen (code completion)

Completion (overloaded Function):

example of lumen (code completion)


example of lumen (calltips)


To make Lumen work you have to install DCD, unfortunately no Linux distribution has DCD packaged so far. Luckily the D community provides a remedy.

For all Debian/apt based distributions like Ubuntu and Debian of course, there is the d-apt, simply follow the instructions on how to setup the apt-repository and install DCD via apt.  For Archlinux exists an AUR Package. Everyone else has to setup DCD manually, but it’s really not hard, simply follow these instructions.

After installing DCD edit ~/.config/dcd/dcd.conf (create if it does not exist already) and add a path to your D include/import files (phobos), for me this is /usr/include/dlang/dmd (on ArchLinux), for other installations this would most likely be /usr/include/d. Furthermore Lumen will try to read a .lumenconfig in every parent folder of the currently opened D source file and add every line in this file as include path to the DCD server. Add all dependencies of your current project to this file.

Now start the completion server with dcd-server, enable the Lumen plugin in your settings and you will have code completion for the D programming language in your favorite editor!

Kate/KDevelop/Skanlite Sprint Wrap-Up

From 18th to 25th of January 2014, the Kate, KDevelop and Skanlite developers met in Barcelona to work on these projects full time for a week. Full time usually implies about 14 hours per person a day (yes, besides food, we do nothing but developing). 11 developers working 14 hours a day for 7 days makes a total of 1078 hours. If we divide this by 8 hours, the typical amount of work hours in a day, this makes 134 man-days of work, or about 27 weeks of continued development time. While this calculation is a bit theoretical, it is still very valid to estimate the amount of work that is put into these projects during such a sprint, especially since usually developers have far less time for development in their spare time.

The efforts focus mostly on KDE Frameworks 5, so what is listed next is mostly relevant only for the KF5/Qt5 version of Kate etc. Going through the Kate and Skanlite commits from 18th to the 25th of January, we have (not listing all commits):

January, 18th (arrival day):

  • KTextEditor::Cursor and KTextEditor::Range are declared as Q_MOVABLE_TYPE, telling Qt containers that these primitive types can be mem-moved without copy constructor.
  • since KTextEditor and KatePart are now merged into a single list, the API was changed such that KTextEditor::Editor::instance() is a singleton. Therefore, KTextEditor::Document::editor() was dropped, as it is not needed anymore.
  • vi input mode: new sentence text object
  • merged code completion models
  • some API cleanups
  • removed ModeInterface, which was never implemented

January, 19th:

January, 20th:

January, 21th:

January, 22th:

January, 23th:

January, 24th:

January, 25th (departure day):

In the days after the sprint we did a lot more fine tuning and cleanups with respect to the changes we did during the sprint. So let’s have a look at Kate before the sprint:

Kate on KF5


Kate after the sprint:

Kate after the Developer Sprint

So Kate changed in several ways:

  • New status bar: The status bar is in the KTextEditor interfaces now. That implies that KDevelop, Kile, and all other applications using the KTextEditor framework will have the same status bar.
  • It is now possible to change the indent settings (tabs, spaces) through the status bar. The same holds for the encoding and the current highlighting.
  • Double click on “Line: …, Column: …” switches into goto-mode (Ctrl+G).
  • Double click on INSERT changes to OVERWRITE mode, if not in vi input mode.
  • New Tab Bar in each view space: This tab bar shows the documents you are working on in a least recently used (LRU) fashion. It only shows as many tabs as fit into the tab bar, since we want to avoid horizonal scrolling (it does not scale). If not all documents fit into the tab bar, just use the Documents tab on the left, or the quick open icon in the view space tab bar bar on the right to to launch quick open.
  • Since we now have a tab bar, we can now show the splitting actions at a more prominent place on the very right. New features include to hide inactive views, which equals maximizing the current view space.
  • Yes, no worries, the tab bar can be disabled.

We’ll cover the workflow of the tab bar in a separate blog post.

…oh, and we have much more in the pipe (not related to the sprint) 🙂