When working with a document, users often perform context-specific repetitive edits – changes to the document
that are similar but specific to the contexts at their locations. Programming by demonstration/examples
(PBD/PBE) systems automate these tasks by learning programs to perform the repetitive edits from demonstration
or examples. However, PBD/PBE systems are not widely adopted, mainly because they require modal
UIs – users must enter a special mode to give the demonstration/examples. This paper presents Blue-Pencil,
a modeless system for synthesizing edit suggestions on the fly. Blue-Pencil observes users as they make
changes to the document, silently identifies repetitive changes, and automatically suggests transformations
that can apply at other locations. Blue-Pencil is parameterized – it allows the “plug-and-play” of different
PBE engines to support different document types and different kinds of transformations. We demonstrate this
parameterization by instantiating Blue-Pencil to several domains – C# and SQL code, markdown documents,
and spreadsheets – using various existing PBE engines. Our evaluation on 37 code editing sessions shows that
Blue-Pencil synthesized edit suggestions with a precision of 0.89 and a recall of 1.0, and took 199 ms to return
suggestions on average. Finally, we report on several improvements based on feedback gleaned from a field
study with professional programmers to investigate the use of Blue-Pencil during long code editing sessions.
Blue-Pencil has been integrated with Visual Studio IntelliCode to power the IntelliCode refactorings feature.