Category Archives: Common

Kate Script IDE Plugin

Hello everyone! In this post i am going to introduce the new Scripting IDE Plugin for Kate. Although scripting KatePart via ECMAScript is a powerful feature that has been available for quite some time now, it is still rarely used. In order to make it appealing for a wider public, the Script IDE aims at supporting the user with the process of creating and managing scripts.

The Plugin mainly consists of a tree view which shows currently available scripts, as well as functions contained in these scripts.

Additional scripts can be imported and new scripts can be created via a dialog, which requests necessary information about the script. Supported is the creation of all three types of scripts used in KPart: indentation scripts, command line scripts and API scripts. Further, help for command line scripts will be editable via the GUI.

After i have finished some crucial refactoring, the future plan for Scripting IDE features involves auto-completion for available APIs in the document view, as long as the Script IDE Plugin is loaded. Also, some restructuring of the way KPart handles scripts will most likely be necessary.

As soon as there are new major features implemented, i will post them here. Everyone’s welcome to comment with his own ideas!

Project Plugin, Current State

After some days of more hacking on the plugin, there current state is already nice for my daily use.

A simple file like

{
     "name": "Kate"
   , "files": [ { "git": 1 } ]
}

defines already the complete project for the kate.git.

If you open any file with Kate inside your local kate.git clone (and the project plugin from master branch is loaded), Kate will auto-open the project and highlight the file you just opened there in the tree. No need to think about opening some project in the menu, just open the file you want to start working at and start. The project plugin won’t get into your way or require additional steps.

It will allow you nice and fast file switching between your project files in the filesystem tree like structure without any noise of non-git tracked files ;) Still the normal “Documents” view is around like it used to be, if you want to just navigate between currently opened files.

If you modify the project file, the project will auto-refresh itself, still a reload button is needed to trigger e.g. reparsing of git files, if your add/remove files and want a fresh project tree. The auto-reload won’t help there, as is is more or less a nop if the project file content was unchanged.

The “Search and Replace” plugin will integrate nicely and per default will do project wide searches, if any project is currently active (you can switch to other search modes like before in the combobox, just the default is changed, if the project plugin is active). Thanks to Kåre’s nice design of the plugin, this addition was really easy to implement.

Exuberant Ctags integration is work-in-progress. At the moment on project load, a background thread will generate a ctags index (after it has constructed the file tree from git/svn/…) and the auto-completion will use this index for all files associated with your project. An additional toolview, that allows you to search inside the index will be implemented, too. It is a bit like the current ctags plugin, but without any setup or manual indexing ;) For the kate.git, the indexing (in the background) needs less than half second, even for kdelibs frameworks branch it is only 2-3 seconds. On Kate exit the index files (created as temp files in your local temp directory) will vanish again. No index database polluting your checkouts/clones or homes.

Will try to add more features I like for my daily work, if you have any ideas to improve the plugin, just let me know here or on bugs.kde.org ;)

Project Management, Take Three

After bit more playing around with the project plugin, I did get aware that I am even to lazy to open project files. Normally if I need to fix something or add new features, I just go to the directory and open the source or build system files I need to work on.  Therefore the project plugin now just watches which files you open and will load the corresponding project on the fly for you ;) (instead of naming your project, you create a .kateproject hidden file in the toplevel project dir, just like Git would do it with its .git directory)

Next issue that arised: even with the simple pattern syntax like:

"files": [ { "directory": "kate", "filters": ["*.cpp", "*.h", "*.ui", "CMakeLists.txt", "Find*.cmake"], "recursive": 1 } ]

it is hard to enumerate all files in the kate.git, as we have .py files, .xml files, .desktop files, .sh files and so on.

As I started here locally to add more and more extensions, I got the impression that just asking Git would be an better idea, and voila:

"files": [ { "directory": "kate", "git": 1, "recursive": 1 } ]

and you get recursively all files that are registered in your Git clone in the kate directory ;)

If you still have SVN, no problem, for your project this will work:

"files": [ { "directory": "kate", "svn": 1, "recursive": 1 } ]

These extensions make creating your Kate project much easier I guess and avoid any battling with regular expressions to keep track of the important files.

Other improvements:

  • Current file will be selected correctly in the projects view
  • Search and Replace is enhanced with an “in Project” option, if the project plugin is loaded and any project active, for this a bit work was needed to allow inter-plugin communication ;)

And again, the mandatory screenshot:

Project Management, Take Two

After a bit toying around, the first version of project management plugin has landed in the master branch of the kate.git.

First time I developed a new feature in a feature-clone in my scratch space on git.kde.org. Very cool, KDE sysadmins did a GREAT job with that stuff: easy to setup and use ;)

Now, people wanting to try out that, just clone our kate.git and compile the master branch.

Example project is toplevel in kate.git: kate.kateproject

To load it, open Kate, activate the “Project Plugin” and hit the “Open Project” button in your main menu bar and go to the “Projects” tool view on the left.

No, it won’t auto-raise atm and yeah, the button looks awful :P

And here the mandatory screenshot:

It still is not much, but I am happy with the result as this is first time since long for me to code something with model-view and Qt.