Published: May 19, 2014Last Updated: October 25, 2016

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

Todd Whiteman

Todd Whiteman

Todd Whiteman is the Development Lead for Komodo IDE. He works adeptly with Mozilla, Python and JavaScript to ensure that Komodo IDE is the IDE of choice for development teams. Todd has been working on Komodo IDE for nearly 6 years, adding components such as the Vi Key Bindings, Distributed Source Code Control, 64-bit Linux builds as well as Remote SSH support into Komodo IDE.