Category Archives: Developers

Mercurial Support in Project Plugin

Christoph already wrote several blog posts about the upcoming projects plugin. In his last blog, he mentioned that a project can now be created on-the-fly by reading the git or subversion output: All the files under version control are automatically listed as files in the project.

However, this is restricted to git and subversion. If you always wanted to contribute to Kate, you can give other version control systems a try, such as Mercurial (command: hg manifest). Just quickly build Kate, and send us a patch!

Update (2013-10-31): Support was added in commit on 2013-03-02 and is available in KDE 4.10.5 and later versions.

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.

Project Management

Some years ago the Kate team introduced the “Session” feature.

This allows you easily to keep around different Kate sessions for different work tasks, like coding, web design, writing, …

Whereas I used that feature a lot at start during my normal daily work, I kind of no longer used it already since some years.

For my normal work pattern: Checkout a project, fix something in it or code an extension, then hop over to the next one, the session feature doesn’t really provide the right workflow.

My checkouts not always stay at the same location on disk, I keep multiple different checkouts of the same project around (or different clones) and I have too many different projects in company to create for all of them a session and keep any overview.

Even more years ago I wrote some project plugin for Kate allowing you to manage a more IDE style kind of project in Kate.

Instead of global sessions in your user account Kate allowed you to create project files which you can check in with your individual projects into your version control.

I purged that plugin later on again, as I lost interest in it because of one major design flaw: You really needed to use the UI to configure your project and add your stuff. That is REALLY annoying if your code base in in a state of flux or evolution and things really keep changing. (The removal wasn’t that well perceived, btw., sorry, but without maintainer, such plugins really cause a lot of pain.)

Now, here we are, six years later :) Given I still have my itch to scratch, I decided to give the project plugin a new try. But this time with a completely different approach: don’t create any UI to create/modify projects but come up with a simple file format for them that a Kate plugin can load.

And yeah, given my history as researcher in compiler construction area, what would be better than write just and other parser for some not understandable language? But no, I want to focus on the real stuff, make the description of the projects lightweight and easy to understand and not try to invent some new syntax yet again.

Therefore I settled with just using JSON to describe the project and started to implement some simple format, like:

{
    "name": "Kate",

    "projects": [
        {
            "name": "KTextEditor",            
            "files": [ { "directory": "ktexteditor", "filters": ["*.cpp", "*.h"] } ]
        },

        {
            "name": "KatePart",            
            "files": [ { "directory": "part", "filters": ["*.cpp", "*.h"], "recursive": 1 } ]
        },

        {
            "name": "Kate",            
            "files": [ { "directory": "kate", "filters": ["*.cpp", "*.h"], "recursive": 1 } ]
        },

        {
            "name": "KWrite",            
            "files": [ { "directory": "kwrite", "filters": ["*.cpp", "*.h"] } ]
        }
    ]
}

This small description should be enough to create the project “Kate” in my kate.git, containing 4 different toplevel parts: KTextEditor, KatePart, Kate and KWrite.

Without many hassle it just collects everything I need for daily work and constructs some tree structure (hehe, that part is not really done at the moment, but the output in my konsole looks OK).

Actually for my normal company work that format suites even better, as the projects there are normally even more fine grained than kate.git is (and for kate.git subprojects in kate/part/kwrite would even make more sense, above that is just an example).

Unfortunately there is not much done atm, beside some basic format handling in JSON and konsole output of the results, but I hope more will be done in the next weeks in my scratch repo.