Augmented Source Code

Author: Samuel Williams When: Friday, 06 August 2010

Source code can be augmented in many ways to provide useful feedback for a programmer. It would be great to see existing source code editors augmented to provide these features.

Code Reviewing
Highlight lines not covered by unit tests.
Highlight code which has been changed since the last review.
Hyperlink function names to source code bodies.
Inline documentation (including images/eps and other kinds of markup).
Bug Fixing
Highlight code based on its age.
Highlight and link code based on program flow/coverage.
Augment variable names with values (i.e. in a bubble).
Optimisation
Highlight code based on execution time.
Augment function definitions with execution details (such as execution time, memory contention issues, threading issues).

Some of these features could be integrated by using the history of the source code exposed by a source code management system, other features would require a well defined compiler framework.

One option would be to expose a common format for marking up source code. This could be a separate file which annotates sequences of characters with meta-data which could then be used by the editor for highlighting source code. Various tools could produce this standard output and this could be used by the editor to augment the source code text.

Syntax Augmentation Format

This file format is very simple and is designed so that it can be generated and parsed very easily. It is designed to annotate specific parts of a text file with information such as

<?xml version="1.0" encoding="UTF-8" ?>
<annotations file="{source-code-file}">
	<marker id="{unique-id}" start="{character-offset}" end="{character-offset}">
		<tag name="function" />
		<metric name="time" value="32" />
	</marker>
	<marker start="{character-offset}" end="{character-offset}">
		<!-- Link a function call with its body -->
		<link href="{unique-id}" />
	</marker>
</annotations>

I hope to add this functionality to jQuery.Syntax as a concept demonstration.

Comments

Leave a comment

Please note, comments must be formatted using Markdown. Links can be enclosed in angle brackets, e.g. <www.codeotaku.com>.