Source Code Annotate Macro

Macro Monday – a new macro to dig into every Monday!

When working with source code, it’s often handy to know who last changed a
particular line of code – so you know who to point your finger at when s%!$
breaks. It just so happens there is a feature called *annotate* in the source
code control world that does exactly that.

## The Macro

This macro works for Git and Subversion (I’m lazy and haven’t added support for
other VCS – pull requests are welcome), which will run a scc annotate operation
using Komodo’s [Run Command][] service, parse the annotate output and place this
information in the left [editor margin].

Clicking on the annotate margin will launch the Komodo SCC History dialog for
that file.

## Screenshot

Note that the margin uses different colors to represent different commits, but
it doesn’t guarantee that two adjacant commits do not share the same color.

## Installation

To install the macro simply hit the “View Resource” and “Install Instructions”
links below.

Execute the macro by double-clicking on the macro in the toolbox, or use the
Invoke Tool (Ctrl+Shift+K) to search/execute “annotate”, or assign your own
keybinding to the macro. Run the macro again to remove the annotations.

## Related Materials

* [Run Command Tutorial][] – what you can do with run commands in Komodo
* [Komodo Developer Extension][] – play around with JavaScript or Python code in
the context of the Komodo window
* [Komodo Macro API][] – to programatically interact with the Komodo editor –
available to both Python and Javascript
* [Editor API][] – the Komodo editor provides a wrapper around the Scintilla API

[Run Command]: https://github.com/Komodo/KomodoEdit/blob/master/src/run/koIRunService.idl#L367
[editor margin]: http://www.scintilla.org/ScintillaDoc.html#Margins
[Run Command Tutorial]: https://docs.activestate.com/komodo/latest/tutorial/runcmdtut.html
[Komodo Developer Extension]: https://community.activestate.com/node/1824
[Komodo Macro API]: https://docs.activestate.com/komodo/latest/macroapi.html
[Editor API]: http://www.scintilla.org/ScintillaDoc.html

Recent Posts

Tech Debt Best Practices: Minimizing Opportunity Cost & Security Risk

Tech debt is an unavoidable consequence of modern application development, leading to security and performance concerns as older open-source codebases become more vulnerable and outdated. Unfortunately, the opportunity cost of an upgrade often means organizations are left to manage growing risk the best they can. But it doesn’t have to be this way.

Read More
Scroll to Top