From code to related bug report or review in just a hover & click

When working on existing code bases, now and then one reads code that raises some questions and the desire for more context, to understand the purpose or the intention of that code. Context like the commit message, the author, the commit date, or some review discussion of the commit or some bug report or feature request the commit was done for.

In the Beginning There Were Raw Commit Ids…

KDevelop, the extensible cross-platform IDE for C, C++, Python, PHP and other languages, has supported showing line-by-line commit data annotations since many years, starting by showing the commit id and in the tooltip info like author, date and message.
See here a screenshot from the KDevelop 4.1 Dot article (2010):

Annotations border in KDevelop 4.1

Then There Were Year and Author…

Not everyone was capable to deal with raw commit ids, also is it just a reference to the actual metadata, so since some versions of KDevelop the annotation border was changed to show the author name and the commit year instead.
See here a screenshot how it looks by the example of upcoming KDevelop 5.3:

Annotations border in KDevelop 5.3

Soon We Might Get the Message and More

While year and author are already interesting info about a commit, if one is looking at a bunch of lines coming from different commits, it can be unpleasant having always to do some explicit action to get further data, like the commit message, by moving the mouse to trigger the tooltip. And with the recent trend in screen sizes, there often is some vertical space left asking to get its Return-On-Investment πŸ˜‰ .
More, if in the raw commit message displayed in the tooltip some review discussion or bug report is mentioned, one has to remember the review id or bug id and manually navigate to e.g. the respective web page. Again unpleasant if having to do this multiple times.

End of last year two patches have been started with the goal to improve those things:

The first patch would extend KTextEditor by a new class AbstractAnnotationItemDelegate (modelled after QAbstractItemDelegate), which then gives KDevelop and other potential API users full independent flexibility to decide on which data about annotations to render and how, as developers and users prefer by the time.
The second patch would change KDevelop to make use of that delegate option and change what is rendered for a start: for groups of consecutive lines from the same commit the first would show the commit message summary line, with the age of the commit, a second line would show the author. And it would make use of the KDevelop::ActiveToolTip class (as also used e.g. for code type information tooltips), which allows the user to interact with the content of the tooltip, like copying text or clicking links in the commit message, which would be shown enriched with links where feasible.
The latter though currently misses some support from the KDevelop git plugin, which only delivers the message summary line in the data model (due to making use of git blame --porcelain, possibly needs rewrite using libgit2 instead of parsing git output). So tooltips for now still only show the summary line as before at least with git (did not test the other VCS plugins yet).
See here a screenshot how it looks with the patches applied to master branches of KTextEditor & KDevelop (and some example complete commit message text for demoing what is possible):

Annotations border in a future KDevelop?

Please Help to See If It Is Good

Work on those patches has been picked up again the last week, and they have now reached Merge Candidate state and are ready for final review, targeting KTextEditor of KF 5.52 (to be merged right after tagging 5.51) and KDevelop 5.4.

If you are interested in this feature, please consider to help now by testing those patches and/or reviewing their code (see links to patches above), so the feature will be good once it arrives at users like yourself πŸ™‚

Advertisements

One thought on “From code to related bug report or review in just a hover & click

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.