It has been a while since my last post about kdev-python, the python language support plugin for KDevelop; I have been quite busy recently. Neverthereless, I got quite a few cool features (almost) finished now.
First, there’s support for argument type guessing. So whenever you call a function, KDevelop will try to find out the type of the parameters you passed, and add them to the possible types for that parameter. Look at the screenshot: the constructor of the “Material” class is called with a string as parameter (in the “currentMaterial = Material(name)” line). Thus, the “name” argument of the constructor is probably a string, and the “Material.name” attribute thus is, too. This also works for stuff like return types, and everything:
Especially for editing functions which are already being used in your code, you also get cool autocompletion this way:
Another feature I’ve implemented is better support for list content type tracking. Look at this:
“materials” is being initialized as an empty list. Then, somewhere something is appended to the list with the “append” function. This function is marked as altering the type of the list in the documentation file of kdev-python; thus, the type of its argument gets added to the type of the list. This behaviour is controlled by decorators (in the internal documentation code) and is thus very flexible; it will be easy to get other libraries’ container classes to work with this as well.
There’s a few more, not as huge features. For example, generators are supported now as follows:
I also fixed quite a few bugs.
You can get the code of the plugin by checking out the “alpha3” tag of the git://anongit.kde.org/kdev-python repository. I hope it doesn’t have nasty crash bugs, if it has, I’ll correct them in subsequent “alpha3.x” tags, so if any of those appear, please use them.
If you have any suggestions or problems, feel free to mail me or report a bug at bugs.kde.org.
Oh, and by the way: If the plugin seems slow, it currently spends more than 95% of its time for writing debug output to the console. You can disable that by typing “kdebugdialog” into a shell, then searching for “python” and disable both (9011 and 15000) debug areas which are found.