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

Webinar - Walking Dead Past Python EOL
Walking Dead Past Python EOL

Stuck living with zombie applications running on Python 2, 3.7 or other past-EOL software? Learn the case for maintaining vs. upgrading, and how you can adopt a culture of getting current and staying current, with lessons from our customers.

Read More
Scroll to Top