Forest: Structural Code Editing with Multiple Cursors

10/20/2022
by   Philippe Voinov, et al.
0

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.

READ FULL TEXT

page 3

page 8

research
07/15/2022

GopCaml: A Structural Editor for OCaml

This talk presents Gopcaml-mode, the first structural editing plugin for...
research
08/16/2021

A Program Synthesis Approach for Adding Architectural Tactics to An Existing Code Base

Automatically constructing a program based on given specifications has b...
research
07/09/2020

RulePad: Interactive Authoring of Checkable Design Rules

Good documentation offers the promise of enabling developers to easily u...
research
07/09/2021

Sirius: Static Program Repair with Dependence Graph-Based Systematic Edit Patterns

Software development often involves systematic edits, similar but nonide...
research
05/29/2023

Coeditor: Leveraging Contextual Changes for Multi-round Code Auto-editing

Developers often dedicate significant time to maintaining and refactorin...
research
12/05/2022

Empirical Study of Co-Renamed Identifiers

Background: The renaming of program identifiers is the most common refac...
research
05/09/2022

A Tutorial on Structural Optimization

Structural optimization is a useful and interesting tool. Unfortunately,...

Please sign up or login with your details

Forgot password? Click here to reset