For the last couple of months, I have been working on Python language support for KDevelop, the well-known C++ IDE from the KDE project. Now I can finally release a first preview of my work to the public:
- Semantic syntax highlighting, as seen in the above screenshot.
- Code navigation telling you about declarations of stuff, types (if known) and arguments:
- If possible, intelligent auto-completion:
- If possible, autocompletion for function arguments:
- QuickOpen / Outline support (just type in part of a function-name, classname, filename, or anything and press enter):
- “Go to error” output widget (just click the line with the error or use F4 / Shift+F4 to jump to the next/previous error):
You can configure what script to launch with which python version in the Run » Confiure Launches dialog. Be sure to select “Script Application” in the list on the left side!
How to install
First of all, this should not be considered an official release meant for production use or packagers. It’s merely a preview.
The plugin is currently not very stable yet, but in my opinion it’s usable already. I recommend installing the plugin into a local directory (like ~/install) so you can safely and easily get rid of it in case you encounter major problems (the build system is not very reliable yet, sorry for that).
So, first, you need to compile and install KDevelop and KDevPlatform. There’s instructions on how to do this here: http://techbase.kde.org/KDevelop4/HowToCompile
It is very important that you use git to checkout the current master branch of both kdevelop and kdevplatform. If you download the tarballs, the plugin is NOT going to work, as it needs some recent changes in kdevplatform. You also cannot use it with any packages provided by your distribution currently. There will hopefully be packages in the future, but not until the plugins and all its dependencies have seen a stable release, which will at least take a few months.
If you’ve succeeded in installing KDevelop and KDevPlatform, you can now install the plugin in pretty much the same way:
“cd” to the directory you want to download the sources to, then get the plugin source code:
git clone git://anongit.kde.org/kdev-python
You can now checkout the alpha1.1 release by typing: “git checkout alpha1.1”. However, I do not recommend doing so, as I’ll continue doing bugfixes in the master branch and you probably want to have them.
Then do the following:
mkdir build cd build cmake .. make parser make install
You should of course specify a correct install path (-DCMAKE_INSTALL_PREFIX=/…) like for KDevelop and KDevPlatform. Especially you must not forget about the “make parser” step; it will compile a modified and stripped-down version of python (don’t worry, it will not (should not? 🙂 touch your system’s python installation) which is needed by the plugin code.
Then just run “kbuildsycoca4” and start up kdevelop. You should now have fancy syntax highlighting and stuff in any .py file. Have fun!
If you encounter any problems while installing or if the plugin crashes, please tell me! I’m very interested in fixing those problems as soon as possible.