Requires N:M mapping

This mapping has 9 all-to-all groups: every node on one side corresponds to every node on the other, and none is deleted or inserted. Each member carries an all N:M badge; selecting one highlights all of its counterparts, in the tree and in the code view alike.

Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1fun calculateRectangleArea(width: Double, height: Double): Double {
2 return width * height
3}
4
5fun calculateRectanglePerimeter(width: Double, height: Double): Double {
6 return 2 * (width + height)
7}
8
9fun main() {
10 val width = 5.0
11 val height = 3.0
12 println("Area: ${calculateRectangleArea(width, height)}")
13 println("Perimeter: ${calculateRectanglePerimeter(width, height)}")
14}
15

After

1data class Rectangle(val width: Double, val height: Double) {
2 fun area(): Double = width * height
3 fun perimeter(): Double = 2 * (width + height)
4}
5
6fun main() {
7 val rectangle = Rectangle(5.0, 3.0)
8 println("Area: ${rectangle.area()}")
9 println("Perimeter: ${rectangle.perimeter()}")
10}
11

Before

source_file
function_declaration
fun "fun"
identifier "calculateRectangleArea"
function_value_parameters
( "("
parameter
identifier "width" all 2:1
: ":" all 2:1
user_type all 2:1
identifier "Double" all 2:1
, "," all 2:1
parameter
identifier "height" all 2:1
: ":" all 2:1
user_type all 2:1
identifier "Double" all 2:1
) ")"
: ":"
user_type
identifier "Double"
function_body
block
{ "{"
return_expression
return "return"
binary_expression
identifier "width"
* "*"
identifier "height"
} "}"
function_declaration
fun "fun"
identifier "calculateRectanglePerimeter"
function_value_parameters
( "("
parameter
identifier "width" all 2:1
: ":" all 2:1
user_type all 2:1
identifier "Double" all 2:1
, "," all 2:1
parameter
identifier "height" all 2:1
: ":" all 2:1
user_type all 2:1
identifier "Double" all 2:1
) ")"
: ":"
user_type
identifier "Double"
function_body
block
{ "{"
return_expression
return "return"
binary_expression
number_literal "2"
* "*"
parenthesized_expression
( "("
binary_expression
identifier "width"
+ "+"
identifier "height"
) ")"
} "}"
function_declaration
fun "fun"
identifier "main"
function_value_parameters
( "("
) ")"
function_body
block
{ "{"
property_declaration
val "val"
variable_declaration
identifier "width"
= "="
float_literal "5.0"
property_declaration
val "val"
variable_declaration
identifier "height"
= "="
float_literal "3.0"
call_expression
identifier "println"
value_arguments
( "("
value_argument
string_literal
" "\""
string_content "Area: "
interpolation
${ "${"
call_expression
identifier "calculateRectangleArea"
value_arguments
( "("
value_argument
identifier "width"
, ","
value_argument
identifier "height"
) ")"
} "}"
" "\""
) ")"
call_expression
identifier "println"
value_arguments
( "("
value_argument
string_literal
" "\""
string_content "Perimeter: "
interpolation
${ "${"
call_expression
identifier "calculateRectanglePerimeter"
value_arguments
( "("
value_argument
identifier "width"
, ","
value_argument
identifier "height"
) ")"
} "}"
" "\""
) ")"
} "}"

After

source_file
class_declaration
modifiers
class_modifier
data "data"
class "class"
identifier "Rectangle"
primary_constructor
class_parameters
( "("
class_parameter
val "val"
identifier "width" all 2:1
: ":" all 2:1
user_type all 2:1
identifier "Double" all 2:1
, "," all 2:1
class_parameter
val "val"
identifier "height" all 2:1
: ":" all 2:1
user_type all 2:1
identifier "Double" all 2:1
) ")"
class_body
{ "{"
function_declaration
fun "fun"
identifier "area"
function_value_parameters
( "("
) ")"
: ":"
user_type
identifier "Double"
function_body
= "="
binary_expression
identifier "width"
* "*"
identifier "height"
function_declaration
fun "fun"
identifier "perimeter"
function_value_parameters
( "("
) ")"
: ":"
user_type
identifier "Double"
function_body
= "="
binary_expression
number_literal "2"
* "*"
parenthesized_expression
( "("
binary_expression
identifier "width"
+ "+"
identifier "height"
) ")"
} "}"
function_declaration
fun "fun"
identifier "main"
function_value_parameters
( "("
) ")"
function_body
block
{ "{"
property_declaration
val "val"
variable_declaration
identifier "rectangle"
= "="
call_expression
identifier "Rectangle"
value_arguments
( "("
value_argument
float_literal "5.0"
, ","
value_argument
float_literal "3.0"
) ")"
call_expression
identifier "println"
value_arguments
( "("
value_argument
string_literal
" "\""
string_content "Area: "
interpolation
${ "${"
call_expression
navigation_expression
identifier "rectangle"
. "."
identifier "area"
value_arguments
( "("
) ")"
} "}"
" "\""
) ")"
call_expression
identifier "println"
value_arguments
( "("
value_argument
string_literal
" "\""
string_content "Perimeter: "
interpolation
${ "${"
call_expression
navigation_expression
identifier "rectangle"
. "."
identifier "perimeter"
value_arguments
( "("
) ")"
} "}"
" "\""
) ")"
} "}"