Software developers frequently refactor code. Often, a single logical refactoring change involves changing multiple related components in a source base such as renaming each occurrence of a variable or function. While many code editors can perform such common and generic refactorings, they do not support more complex refactorings or those that are specific to a given code base. For those, as a flexible - albeit less interactive - alternative, developers can write refactoring scripts that can implement arbitrarily complex logic by manipulating the program's tree representation. In this work, we present Forest, a structural code editor that aims to bridge the gap between the interactiveness of code editors and the expressiveness of refactoring scripts. While structural editors have occupied a niche as general code editors, the key insight of this work is that they enable a novel structural multi-cursor design that allows Forest to reach a similar expressiveness as refactoring scripts; Forest allows to perform a single action simultaneously in multiple program locations and thus support complex refactorings. To support interactivity, Forest provides features typical for text code editors such as writing and displaying the program through its textual representation. Our evaluation demonstrates that Forest allows performing edits similar to those from refactoring scripts, while still being interactive. We attempted to perform edits from 48 real-world refactoring scripts using Forest and found that 11 were possible, while another 17 would be possible with added features. We believe that a multi-cursor setting plays to the strengths of structural editing, since it benefits from reliable and expressive commands. Our results suggest that multi-cursor structural editors could be practical for performing small-scale specialized refactorings.
翻译:软件开发者经常重构代码。 通常, 单一逻辑的重新设定变化涉及改变源基中多个相关内容, 比如重命名变量或函数的每个发生点。 虽然许多代码编辑者可以进行这些共同和通用的重新设定, 但是他们不支持更复杂的重新设定或特定代码基础所特有的内容。 对于这些内容来说, 开发者作为一个灵活( 虽然不那么互动) 的替代方案, 可以写出一些可以通过操纵程序树的表达方式来实施任意复杂逻辑的重新设定脚本。 在此工作中, 我们介绍Forest, 一个结构性代码编辑器, 目的是弥合代码编辑互动性、 多变量或函数的多功能之间的差距。 虽然许多代码编辑者可以进行这种共同和通用的重新设定, 但结构编辑器的主要洞察力是, 他们可以让新的结构多曲线设计师达到与再设定脚本相似的表达性; 森林可以同时在多个程序的位置执行一个单一的动作, 从而支持复杂的再添加的重新设定。 为了支持内部活动, 森林提供一些典型的文字编辑器编辑器特征, 例如写作和显示方向, 进行另一个的演示, 我们的再演化, 进行另一个的再演化, 显示, 我们的再演化, 我们的再演算。