Annotated Code Boxes
Jordan Johnson <jmj at fellowhuman dot com>
This package implements annotated code chunks in DrScheme. It allows you to write an expression, annotate it, and hide the code so that your expression is visually represented by a box containing only the annotation.
1 Creating Annotated Code
Installing this package adds two items to the DrScheme menu system, allowing you to insert annotated-code boxes and annotate selected code.
1.1 Inserting Annotated Code Boxes
On the Insert menu, this package adds an item Insert Annotated Code Box, which inserts a box at the current cursor position.
1.2 Annotating Existing Code
On the Scheme menu, this package adds an item Annotate this Code, which behaves as follows:
If text is currently selected (highlighted) in the active editor, the selected text will be replaced by an annotated-code box containing the text in its upper editor (the code editor).
Otherwise, if the cursor is inside an S-expression, the enclosing S-expression will be replaced by an annotated-code box containing the expression in its code editor.
2 Manipulating Annotated Code
Once created, an annotated-code box behaves somewhat similarly to a comment box. It will be evaluated as an expression in the context of the surrounding code, and the Tab and Shift-Tab keystrokes allow movement between the two fields.
At the left side of each annotated-code box the word "expr" appears. If the last edit inside the box left one or more complete expressions in the box’s code editor, "expr" will be blue; if not, it will be red. Right-clicking this "expr" produces a menu that allows hiding and showing the code editor, and converting the annotated-code box to plain Scheme source text (with or without including the annotation as a Scheme comment).