On the fly synthesis of edit suggestions

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.

[1]  Julia L. Lawall,et al.  Generic patch inference , 2008, 2008 23rd IEEE/ACM International Conference on Automated Software Engineering.

[2]  Hridesh Rajan,et al.  A study of repetitiveness of code changes in software evolution , 2013, 2013 28th IEEE/ACM International Conference on Automated Software Engineering (ASE).

[3]  Pedro M. Domingos,et al.  Learning Repetitive Text-Editing Procedures with SMARTedit , 2001, Your Wish is My Command.

[4]  Rob Miller,et al.  LAPIS: smart editing with text structure , 2002, CHI Extended Abstracts.

[5]  Sumit Gulwani,et al.  Mixed-Initiative Approaches to Global Editing in Slideware , 2015, CHI.

[6]  Sumit Gulwani,et al.  FlashExtract: a framework for data extraction by examples , 2014, PLDI.

[7]  Miryung Kim,et al.  Discovering and representing systematic code changes , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[8]  Sumit Gulwani,et al.  Synthesizing Number Transformations from Input-Output Examples , 2012, CAV.

[9]  Sumit Gulwani,et al.  FlashProfile: a framework for synthesizing data profiles , 2017, Proc. ACM Program. Lang..

[10]  Sumit Gulwani,et al.  FlashMeta: a framework for inductive program synthesis , 2015, OOPSLA.

[11]  Siau-Cheng Khoo,et al.  Semantic patch inference , 2012, 2012 Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering.

[12]  Miryung Kim,et al.  An empirical study of supplementary bug fixes , 2012, 2012 9th IEEE Working Conference on Mining Software Repositories (MSR).

[13]  林俊彦 用Visual Studio实践敏捷测试(一) , 2010 .

[14]  Sumit Gulwani,et al.  Learning Syntactic Program Transformations from Examples , 2016, 2017 IEEE/ACM 39th International Conference on Software Engineering (ICSE).

[15]  Zhendong Su,et al.  DECKARD: Scalable and Accurate Tree-Based Detection of Code Clones , 2007, 29th International Conference on Software Engineering (ICSE'07).

[16]  Pedro M. Domingos,et al.  Programming by demonstration: a machine learning approach , 2001 .

[17]  Isil Dillig,et al.  Automated Migration of Hierarchical Data to Relational Tables using Programming-by-Example , 2017, Proc. VLDB Endow..

[18]  Henry Lieberman,et al.  Your Wish is My Command , 2001, The Morgan Kaufmann series in interactive technologies.

[19]  Graham Neubig,et al.  Learning to Represent Edits , 2018, ICLR.

[20]  Friedrich Steimann,et al.  Refactorings without names , 2012, 2012 Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering.

[21]  Benjamin C. Pierce,et al.  Combinators for bi-directional tree transformations: a linguistic approach to the view update problem , 2005, POPL '05.

[22]  Andrew P. Black,et al.  High velocity refactorings in Eclipse , 2007, eclipse '07.

[23]  Henry Lieberman,et al.  Watch what I do: programming by demonstration , 1993 .

[24]  Andrew P. Black,et al.  How we refactor, and how we know it , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[25]  Sumit Gulwani,et al.  Automating string processing in spreadsheets using input-output examples , 2011, POPL '11.

[26]  K. Barraclough Eclipse , 2006, BMJ : British Medical Journal.

[27]  佚名,et al.  用Microsoft Word制作 精彩贺卡 , 2000 .

[28]  William G. Griswold,et al.  WitchDoctor: IDE support for real-time auto-completion of refactorings , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[29]  Benjamin Livshits,et al.  Finding application errors and security flaws using PQL: a program query language , 2005, OOPSLA '05.

[30]  Miryung Kim,et al.  Systematic editing: generating program transformations from an example , 2011, PLDI '11.

[31]  Miryung Kim,et al.  Lase: Locating and applying systematic edits by learning from examples , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[32]  Miryung Kim,et al.  A graph-based approach to API usage adaptation , 2010, OOPSLA.

[33]  Tom Mens,et al.  A survey of software refactoring , 2004, IEEE Transactions on Software Engineering.

[34]  Tessa Lau,et al.  Why PBD systems fail: Lessons learned for usable AI , 2008 .

[35]  Eran Yahav,et al.  Code completion with statistical language models , 2014, PLDI.

[36]  Isil Dillig,et al.  Synthesizing data structure transformations from input-output examples , 2015, PLDI.

[37]  Stas Negara,et al.  Mining fine-grained code changes to detect unknown change patterns , 2014, ICSE.

[38]  Jane Bates,et al.  Your wish is my command. , 2003, Nursing standard (Royal College of Nursing (Great Britain) : 1987).

[39]  William F. Opdyke,et al.  Refactoring object-oriented frameworks , 1992 .

[40]  Sorin Lerner,et al.  Interactive parser synthesis by example , 2015, PLDI.

[41]  Miryung Kim,et al.  A field study of refactoring challenges and benefits , 2012, SIGSOFT FSE.