GSoC/GCI Archive
Google Code-in 2013 KDE

KDevelop Python: code completion for string formatting

completed by: Atanas

mentors: Sven Brauch

kdev-python provides Python language support for the KDevelop IDE.

The idea of this task is to implement code completion for the string formatting mini-language: http://docs.python.org/2/library/string.html#format-examples It is used to create formatted output, but with its many abbreviations it's notoriously difficult to remember. Thus it would be great to provide code completion for it: When a user types an opening curly brace in a string (or a colon/exclamation mark, look at the above link to get an idea what makes sense), give him a list of possible formatting options to choose from. For implementing this, you should start looking at codecompletion/context.cpp in the kdev-python repository.

The task is not trivial; if you have problems, please contact me and I'll be happy to help. You will need somewhat firm knowledge in C++ to accomplish this task. For marking this task as solved, I'd expect a few common options to be working, as a demo. If you're interested, I can then create various other tasks which build on this one, such as implementing more options, using kate's template engine to provide easy-to-edit templates for formatters such as :02X or similar, or displaying the relevant formatting argument in a tooltip when providing arguments to "...".format(...).