diff --git a/data/fixtures/scopes/c/interior/interior.switchCase.scope b/data/fixtures/scopes/c/interior/interior.switchCase.scope index 1034635c48..db0d61b7cc 100644 --- a/data/fixtures/scopes/c/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/c/interior/interior.switchCase.scope @@ -22,20 +22,7 @@ switch (foo) { 8| break; --------------< -[#1 Removal] = 0:14-9:0 - > -0| switch (foo) { -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - < - +[#1 Removal] = [#1 Domain] = 0:14-9:0 > 0| switch (foo) { @@ -59,13 +46,7 @@ switch (foo) { 3| break; --------------< -[#2 Removal] = 1:11-3:14 - > -1| case 0: -2| bar; -3| break; - --------------< - +[#2 Removal] = [#2 Domain] = 1:11-3:14 > 1| case 0: @@ -80,13 +61,7 @@ switch (foo) { >------< 5| break; -[#3 Removal] = 4:13-6:4 - > -4| case 1: { -5| break; -6| } - ----< - +[#3 Removal] = [#3 Domain] = 4:13-6:4 > 4| case 1: { @@ -101,12 +76,7 @@ switch (foo) { >------< 8| break; -[#4 Removal] = 7:12-8:14 - > -7| default: -8| break; - --------------< - +[#4 Removal] = [#4 Domain] = 7:12-8:14 > 7| default: diff --git a/data/fixtures/scopes/cpp/interior/interior.constructor.scope b/data/fixtures/scopes/cpp/interior/interior.constructor.scope index d64baa9016..3c0f1442bc 100644 --- a/data/fixtures/scopes/cpp/interior/interior.constructor.scope +++ b/data/fixtures/scopes/cpp/interior/interior.constructor.scope @@ -7,13 +7,7 @@ class Foo { >---------< 1| Foo() { } -[#1 Removal] = 0:11-2:0 - > -0| class Foo { -1| Foo() { } -2| } - < - +[#1 Removal] = [#1 Domain] = 0:11-2:0 > 0| class Foo { diff --git a/data/fixtures/scopes/cpp/interior/interior.method.scope b/data/fixtures/scopes/cpp/interior/interior.method.scope index bd398f6473..a292acdca1 100644 --- a/data/fixtures/scopes/cpp/interior/interior.method.scope +++ b/data/fixtures/scopes/cpp/interior/interior.method.scope @@ -7,13 +7,7 @@ class Foo { >--------------< 1| void bar() { } -[#1 Removal] = 0:11-2:0 - > -0| class Foo { -1| void bar() { } -2| } - < - +[#1 Removal] = [#1 Domain] = 0:11-2:0 > 0| class Foo { diff --git a/data/fixtures/scopes/csharp/interior/interior.constructor.scope b/data/fixtures/scopes/csharp/interior/interior.constructor.scope index babc97caa5..a77478d9a9 100644 --- a/data/fixtures/scopes/csharp/interior/interior.constructor.scope +++ b/data/fixtures/scopes/csharp/interior/interior.constructor.scope @@ -7,13 +7,7 @@ class Foo { >----------------< 1| public Foo() { } -[#1 Removal] = 0:11-2:0 - > -0| class Foo { -1| public Foo() { } -2| } - < - +[#1 Removal] = [#1 Domain] = 0:11-2:0 > 0| class Foo { diff --git a/data/fixtures/scopes/csharp/interior/interior.lambda.scope b/data/fixtures/scopes/csharp/interior/interior.lambda.scope index 355508bec5..72a74f2447 100644 --- a/data/fixtures/scopes/csharp/interior/interior.lambda.scope +++ b/data/fixtures/scopes/csharp/interior/interior.lambda.scope @@ -5,10 +5,7 @@ >----< 0| () => { foo; }; -[Removal] = 0:7-0:13 - >------< -0| () => { foo; }; - +[Removal] = [Domain] = 0:7-0:13 >------< 0| () => { foo; }; diff --git a/data/fixtures/scopes/csharp/interior/interior.method.scope b/data/fixtures/scopes/csharp/interior/interior.method.scope index dae6bb4ef6..43e4ec8130 100644 --- a/data/fixtures/scopes/csharp/interior/interior.method.scope +++ b/data/fixtures/scopes/csharp/interior/interior.method.scope @@ -7,13 +7,7 @@ class Foo { >---------------------< 1| public void Bar() { } -[#1 Removal] = 0:11-2:0 - > -0| class Foo { -1| public void Bar() { } -2| } - < - +[#1 Removal] = [#1 Domain] = 0:11-2:0 > 0| class Foo { diff --git a/data/fixtures/scopes/csharp/interior/interior.switchCase.scope b/data/fixtures/scopes/csharp/interior/interior.switchCase.scope index 1034635c48..db0d61b7cc 100644 --- a/data/fixtures/scopes/csharp/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/csharp/interior/interior.switchCase.scope @@ -22,20 +22,7 @@ switch (foo) { 8| break; --------------< -[#1 Removal] = 0:14-9:0 - > -0| switch (foo) { -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - < - +[#1 Removal] = [#1 Domain] = 0:14-9:0 > 0| switch (foo) { @@ -59,13 +46,7 @@ switch (foo) { 3| break; --------------< -[#2 Removal] = 1:11-3:14 - > -1| case 0: -2| bar; -3| break; - --------------< - +[#2 Removal] = [#2 Domain] = 1:11-3:14 > 1| case 0: @@ -80,13 +61,7 @@ switch (foo) { >------< 5| break; -[#3 Removal] = 4:13-6:4 - > -4| case 1: { -5| break; -6| } - ----< - +[#3 Removal] = [#3 Domain] = 4:13-6:4 > 4| case 1: { @@ -101,12 +76,7 @@ switch (foo) { >------< 8| break; -[#4 Removal] = 7:12-8:14 - > -7| default: -8| break; - --------------< - +[#4 Removal] = [#4 Domain] = 7:12-8:14 > 7| default: diff --git a/data/fixtures/scopes/java/interior/interior.constructor.scope b/data/fixtures/scopes/java/interior/interior.constructor.scope index bcbf1899fe..8def46671f 100644 --- a/data/fixtures/scopes/java/interior/interior.constructor.scope +++ b/data/fixtures/scopes/java/interior/interior.constructor.scope @@ -7,13 +7,7 @@ public class Foo { >----------------< 1| public Foo() { } -[#1 Removal] = 0:18-2:0 - > -0| public class Foo { -1| public Foo() { } -2| } - < - +[#1 Removal] = [#1 Domain] = 0:18-2:0 > 0| public class Foo { diff --git a/data/fixtures/scopes/java/interior/interior.method.scope b/data/fixtures/scopes/java/interior/interior.method.scope index bc30c69903..b391e9d5fc 100644 --- a/data/fixtures/scopes/java/interior/interior.method.scope +++ b/data/fixtures/scopes/java/interior/interior.method.scope @@ -7,13 +7,7 @@ public class Foo { >---------------------< 1| public void bar() { } -[#1 Removal] = 0:18-2:0 - > -0| public class Foo { -1| public void bar() { } -2| } - < - +[#1 Removal] = [#1 Domain] = 0:18-2:0 > 0| public class Foo { diff --git a/data/fixtures/scopes/java/interior/interior.static.scope b/data/fixtures/scopes/java/interior/interior.static.scope index 7faf9b8a6c..a361538a23 100644 --- a/data/fixtures/scopes/java/interior/interior.static.scope +++ b/data/fixtures/scopes/java/interior/interior.static.scope @@ -7,13 +7,7 @@ class Foo { >----------< 1| static { } -[#1 Removal] = 0:11-2:0 - > -0| class Foo { -1| static { } -2| } - < - +[#1 Removal] = [#1 Domain] = 0:11-2:0 > 0| class Foo { diff --git a/data/fixtures/scopes/java/interior/interior.switchCase.scope b/data/fixtures/scopes/java/interior/interior.switchCase.scope index 7e04299152..1e00f488d5 100644 --- a/data/fixtures/scopes/java/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/java/interior/interior.switchCase.scope @@ -22,20 +22,7 @@ switch (value) { 8| break; --------------< -[#1 Removal] = 0:16-9:0 - > -0| switch (value) { -1| case 0: -2| foo; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - < - +[#1 Removal] = [#1 Domain] = 0:16-9:0 > 0| switch (value) { @@ -59,13 +46,7 @@ switch (value) { 3| break; --------------< -[#2 Removal] = 1:11-3:14 - > -1| case 0: -2| foo; -3| break; - --------------< - +[#2 Removal] = [#2 Domain] = 1:11-3:14 > 1| case 0: @@ -80,13 +61,7 @@ switch (value) { >------< 5| break; -[#3 Removal] = 4:13-6:4 - > -4| case 1: { -5| break; -6| } - ----< - +[#3 Removal] = [#3 Domain] = 4:13-6:4 > 4| case 1: { @@ -101,12 +76,7 @@ switch (value) { >------< 8| break; -[#4 Removal] = 7:12-8:14 - > -7| default: -8| break; - --------------< - +[#4 Removal] = [#4 Domain] = 7:12-8:14 > 7| default: diff --git a/data/fixtures/scopes/java/interior/interior.switchCase2.scope b/data/fixtures/scopes/java/interior/interior.switchCase2.scope index 14e1e2fc6d..b413e0e58c 100644 --- a/data/fixtures/scopes/java/interior/interior.switchCase2.scope +++ b/data/fixtures/scopes/java/interior/interior.switchCase2.scope @@ -16,17 +16,7 @@ switch (foo) { 5| default -> 3; -----------------< -[#1 Removal] = 0:14-6:0 - > -0| switch (foo) { -1| case 0 -> 1; -2| case 1 -> { -3| yield 2; -4| }; -5| default -> 3; -6| } - < - +[#1 Removal] = [#1 Domain] = 0:14-6:0 > 0| switch (foo) { @@ -45,10 +35,7 @@ switch (foo) { >--< 1| case 0 -> 1; -[#2 Removal] = 1:13-1:16 - >---< -1| case 0 -> 1; - +[#2 Removal] = [#2 Domain] = 1:13-1:16 >---< 1| case 0 -> 1; @@ -60,13 +47,7 @@ switch (foo) { >--------< 3| yield 2; -[#3 Removal] = 2:15-4:4 - > -2| case 1 -> { -3| yield 2; -4| }; - ----< - +[#3 Removal] = [#3 Domain] = 2:15-4:4 > 2| case 1 -> { @@ -81,10 +62,7 @@ switch (foo) { >--< 5| default -> 3; -[#4 Removal] = 5:14-5:17 - >---< -5| default -> 3; - +[#4 Removal] = [#4 Domain] = 5:14-5:17 >---< 5| default -> 3; diff --git a/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope b/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope index 31fb4f8777..21da00c906 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope @@ -7,13 +7,7 @@ class Foo { >-----------------< 1| constructor() { } -[#1 Removal] = 0:11-2:0 - > -0| class Foo { -1| constructor() { } -2| } - < - +[#1 Removal] = [#1 Domain] = 0:11-2:0 > 0| class Foo { diff --git a/data/fixtures/scopes/javascript.core/interior/interior.method.scope b/data/fixtures/scopes/javascript.core/interior/interior.method.scope index e953514d23..449b208346 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.method.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.method.scope @@ -7,13 +7,7 @@ class Foo { >---------< 1| bar() { } -[#1 Removal] = 0:11-2:0 - > -0| class Foo { -1| bar() { } -2| } - < - +[#1 Removal] = [#1 Domain] = 0:11-2:0 > 0| class Foo { diff --git a/data/fixtures/scopes/javascript.core/interior/interior.static.scope b/data/fixtures/scopes/javascript.core/interior/interior.static.scope index 7faf9b8a6c..a361538a23 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.static.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.static.scope @@ -7,13 +7,7 @@ class Foo { >----------< 1| static { } -[#1 Removal] = 0:11-2:0 - > -0| class Foo { -1| static { } -2| } - < - +[#1 Removal] = [#1 Domain] = 0:11-2:0 > 0| class Foo { diff --git a/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope b/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope index 1034635c48..db0d61b7cc 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope @@ -22,20 +22,7 @@ switch (foo) { 8| break; --------------< -[#1 Removal] = 0:14-9:0 - > -0| switch (foo) { -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - < - +[#1 Removal] = [#1 Domain] = 0:14-9:0 > 0| switch (foo) { @@ -59,13 +46,7 @@ switch (foo) { 3| break; --------------< -[#2 Removal] = 1:11-3:14 - > -1| case 0: -2| bar; -3| break; - --------------< - +[#2 Removal] = [#2 Domain] = 1:11-3:14 > 1| case 0: @@ -80,13 +61,7 @@ switch (foo) { >------< 5| break; -[#3 Removal] = 4:13-6:4 - > -4| case 1: { -5| break; -6| } - ----< - +[#3 Removal] = [#3 Domain] = 4:13-6:4 > 4| case 1: { @@ -101,12 +76,7 @@ switch (foo) { >------< 8| break; -[#4 Removal] = 7:12-8:14 - > -7| default: -8| break; - --------------< - +[#4 Removal] = [#4 Domain] = 7:12-8:14 > 7| default: diff --git a/data/fixtures/scopes/latex/interior.element.scope b/data/fixtures/scopes/latex/interior.element.scope index 34b602d342..058989bb26 100644 --- a/data/fixtures/scopes/latex/interior.element.scope +++ b/data/fixtures/scopes/latex/interior.element.scope @@ -7,13 +7,7 @@ >-----< 1| Hello -[Removal] = 0:13-2:0 - > -0| \begin{quote} -1| Hello -2| \end{quote} - < - +[Removal] = [Domain] = 0:13-2:0 > 0| \begin{quote} diff --git a/data/fixtures/scopes/lua/interior.if.scope b/data/fixtures/scopes/lua/interior.if.scope index 9e06cf6864..1f6ac6762a 100644 --- a/data/fixtures/scopes/lua/interior.if.scope +++ b/data/fixtures/scopes/lua/interior.if.scope @@ -11,13 +11,7 @@ end >-----< 1| a = 1 -[#1 Removal] = 0:12-2:0 - > -0| if true then -1| a = 1 -2| elseif false then - < - +[#1 Removal] = [#1 Domain] = 0:12-2:0 > 0| if true then @@ -32,13 +26,7 @@ end >-----< 3| a = 2 -[#2 Removal] = 2:17-4:0 - > -2| elseif false then -3| a = 2 -4| else - < - +[#2 Removal] = [#2 Domain] = 2:17-4:0 > 2| elseif false then @@ -53,13 +41,7 @@ end >-----< 5| a = 3 -[#3 Removal] = 4:4-6:0 - > -4| else -5| a = 3 -6| end - < - +[#3 Removal] = [#3 Domain] = 4:4-6:0 > 4| else diff --git a/data/fixtures/scopes/markdown/collectionItem.unenclosed.multiLine.scope b/data/fixtures/scopes/markdown/collectionItem.unenclosed.multiLine.scope index 334572988c..bdceb3f2ab 100644 --- a/data/fixtures/scopes/markdown/collectionItem.unenclosed.multiLine.scope +++ b/data/fixtures/scopes/markdown/collectionItem.unenclosed.multiLine.scope @@ -56,7 +56,8 @@ >----------------------------------------< 2| - This is the first level of a list again. -[#3 Removal] = 2:0-2:42 +[#3 Removal] = +[#3 Domain] = 2:0-2:42 >------------------------------------------< 2| - This is the first level of a list again. @@ -64,8 +65,4 @@ >< 2| - This is the first level of a list again. -[#3 Domain] = 2:0-2:42 - >------------------------------------------< -2| - This is the first level of a list again. - [#3 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/markdown/interior.cell.scope b/data/fixtures/scopes/markdown/interior.cell.scope index f8f2670a14..0278c97f9e 100644 --- a/data/fixtures/scopes/markdown/interior.cell.scope +++ b/data/fixtures/scopes/markdown/interior.cell.scope @@ -8,13 +8,7 @@ let foo; >--------< 1| let foo; -[Removal] = 0:5-2:0 - > -0| ```ts -1| let foo; -2| ``` - < - +[Removal] = [Domain] = 0:5-2:0 > 0| ```ts diff --git a/data/fixtures/scopes/markdown/interior.cell2.scope b/data/fixtures/scopes/markdown/interior.cell2.scope index 3538f475d2..04fc8cd005 100644 --- a/data/fixtures/scopes/markdown/interior.cell2.scope +++ b/data/fixtures/scopes/markdown/interior.cell2.scope @@ -8,13 +8,7 @@ Hello world >-----------< 1| Hello world -[Removal] = 0:3-2:0 - > -0| ``` -1| Hello world -2| ``` - < - +[Removal] = [Domain] = 0:3-2:0 > 0| ``` diff --git a/data/fixtures/scopes/plaintext/interior.surroundingPair.scope b/data/fixtures/scopes/plaintext/interior.surroundingPair.scope index f2a71db63a..f1dd86d282 100644 --- a/data/fixtures/scopes/plaintext/interior.surroundingPair.scope +++ b/data/fixtures/scopes/plaintext/interior.surroundingPair.scope @@ -5,10 +5,7 @@ >----< 0| ( text ) -[Removal] = 0:1-0:7 - >------< -0| ( text ) - +[Removal] = [Domain] = 0:1-0:7 >------< 0| ( text ) diff --git a/data/fixtures/scopes/python/interior/interior.class.scope b/data/fixtures/scopes/python/interior/interior.class.scope index d820932931..dbf3e40361 100644 --- a/data/fixtures/scopes/python/interior/interior.class.scope +++ b/data/fixtures/scopes/python/interior/interior.class.scope @@ -5,10 +5,7 @@ class Foo: pass >----< 0| class Foo: pass -[Removal] = 0:10-0:15 - >-----< -0| class Foo: pass - +[Removal] = [Domain] = 0:10-0:15 >-----< 0| class Foo: pass diff --git a/data/fixtures/scopes/python/interior/interior.constructor.scope b/data/fixtures/scopes/python/interior/interior.constructor.scope index 49188f85fe..0c6c282c43 100644 --- a/data/fixtures/scopes/python/interior/interior.constructor.scope +++ b/data/fixtures/scopes/python/interior/interior.constructor.scope @@ -6,12 +6,7 @@ class Foo: >------------------------< 1| def __init__(self): pass -[#1 Removal] = 0:10-1:28 - > -0| class Foo: -1| def __init__(self): pass - ----------------------------< - +[#1 Removal] = [#1 Domain] = 0:10-1:28 > 0| class Foo: @@ -25,10 +20,7 @@ class Foo: >----< 1| def __init__(self): pass -[#2 Removal] = 1:23-1:28 - >-----< -1| def __init__(self): pass - +[#2 Removal] = [#2 Domain] = 1:23-1:28 >-----< 1| def __init__(self): pass diff --git a/data/fixtures/scopes/python/interior/interior.foreach.scope b/data/fixtures/scopes/python/interior/interior.foreach.scope index b9441c8323..106220adee 100644 --- a/data/fixtures/scopes/python/interior/interior.foreach.scope +++ b/data/fixtures/scopes/python/interior/interior.foreach.scope @@ -5,10 +5,7 @@ for v in values: pass >----< 0| for v in values: pass -[Removal] = 0:16-0:21 - >-----< -0| for v in values: pass - +[Removal] = [Domain] = 0:16-0:21 >-----< 0| for v in values: pass diff --git a/data/fixtures/scopes/python/interior/interior.function.scope b/data/fixtures/scopes/python/interior/interior.function.scope index 441e198d50..ec88c340d9 100644 --- a/data/fixtures/scopes/python/interior/interior.function.scope +++ b/data/fixtures/scopes/python/interior/interior.function.scope @@ -5,10 +5,7 @@ def foo(): pass >----< 0| def foo(): pass -[Removal] = 0:10-0:15 - >-----< -0| def foo(): pass - +[Removal] = [Domain] = 0:10-0:15 >-----< 0| def foo(): pass diff --git a/data/fixtures/scopes/python/interior/interior.if.scope b/data/fixtures/scopes/python/interior/interior.if.scope index 77f83ef80a..c7b21ef55b 100644 --- a/data/fixtures/scopes/python/interior/interior.if.scope +++ b/data/fixtures/scopes/python/interior/interior.if.scope @@ -7,10 +7,7 @@ else: pass >----< 0| if True: pass -[#1 Removal] = 0:8-0:13 - >-----< -0| if True: pass - +[#1 Removal] = [#1 Domain] = 0:8-0:13 >-----< 0| if True: pass @@ -22,10 +19,7 @@ else: pass >----< 1| elif False: pass -[#2 Removal] = 1:11-1:16 - >-----< -1| elif False: pass - +[#2 Removal] = [#2 Domain] = 1:11-1:16 >-----< 1| elif False: pass @@ -37,10 +31,7 @@ else: pass >----< 2| else: pass -[#3 Removal] = 2:5-2:10 - >-----< -2| else: pass - +[#3 Removal] = [#3 Domain] = 2:5-2:10 >-----< 2| else: pass diff --git a/data/fixtures/scopes/python/interior/interior.method.scope b/data/fixtures/scopes/python/interior/interior.method.scope index 80757cc915..e246ebd018 100644 --- a/data/fixtures/scopes/python/interior/interior.method.scope +++ b/data/fixtures/scopes/python/interior/interior.method.scope @@ -6,12 +6,7 @@ class Foo: >---------------< 1| def bar(): pass -[#1 Removal] = 0:10-1:19 - > -0| class Foo: -1| def bar(): pass - -------------------< - +[#1 Removal] = [#1 Domain] = 0:10-1:19 > 0| class Foo: @@ -25,10 +20,7 @@ class Foo: >----< 1| def bar(): pass -[#2 Removal] = 1:14-1:19 - >-----< -1| def bar(): pass - +[#2 Removal] = [#2 Domain] = 1:14-1:19 >-----< 1| def bar(): pass diff --git a/data/fixtures/scopes/python/interior/interior.resource.scope b/data/fixtures/scopes/python/interior/interior.resource.scope index 0cfa7f42a7..bd38074c21 100644 --- a/data/fixtures/scopes/python/interior/interior.resource.scope +++ b/data/fixtures/scopes/python/interior/interior.resource.scope @@ -5,10 +5,7 @@ with file: pass >----< 0| with file: pass -[Removal] = 0:10-0:15 - >-----< -0| with file: pass - +[Removal] = [Domain] = 0:10-0:15 >-----< 0| with file: pass diff --git a/data/fixtures/scopes/python/interior/interior.switch.scope b/data/fixtures/scopes/python/interior/interior.switch.scope index 53c37096dd..584110fc82 100644 --- a/data/fixtures/scopes/python/interior/interior.switch.scope +++ b/data/fixtures/scopes/python/interior/interior.switch.scope @@ -6,12 +6,7 @@ match value: >------------< 1| case 0: pass -[#1 Removal] = 0:12-1:16 - > -0| match value: -1| case 0: pass - ----------------< - +[#1 Removal] = [#1 Domain] = 0:12-1:16 > 0| match value: @@ -25,10 +20,7 @@ match value: >----< 1| case 0: pass -[#2 Removal] = 1:11-1:16 - >-----< -1| case 0: pass - +[#2 Removal] = [#2 Domain] = 1:11-1:16 >-----< 1| case 0: pass diff --git a/data/fixtures/scopes/python/interior/interior.switchCase.scope b/data/fixtures/scopes/python/interior/interior.switchCase.scope index 5c13a3b2f5..d915b94297 100644 --- a/data/fixtures/scopes/python/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/python/interior/interior.switchCase.scope @@ -15,16 +15,7 @@ match foo: 5| pass ------------< -[#1 Removal] = 0:10-5:12 - > -0| match foo: -1| case 0: -2| bar -3| pass -4| case _: -5| pass - ------------< - +[#1 Removal] = [#1 Domain] = 0:10-5:12 > 0| match foo: @@ -44,13 +35,7 @@ match foo: 3| pass ------------< -[#2 Removal] = 1:11-3:12 - > -1| case 0: -2| bar -3| pass - ------------< - +[#2 Removal] = [#2 Domain] = 1:11-3:12 > 1| case 0: @@ -65,12 +50,7 @@ match foo: >----< 5| pass -[#3 Removal] = 4:11-5:12 - > -4| case _: -5| pass - ------------< - +[#3 Removal] = [#3 Domain] = 4:11-5:12 > 4| case _: diff --git a/data/fixtures/scopes/python/interior/interior.try.scope b/data/fixtures/scopes/python/interior/interior.try.scope index 34c051ece1..0488d10c33 100644 --- a/data/fixtures/scopes/python/interior/interior.try.scope +++ b/data/fixtures/scopes/python/interior/interior.try.scope @@ -7,10 +7,7 @@ finally: pass >----< 0| try: pass -[#1 Removal] = 0:4-0:9 - >-----< -0| try: pass - +[#1 Removal] = [#1 Domain] = 0:4-0:9 >-----< 0| try: pass @@ -22,10 +19,7 @@ finally: pass >----< 1| except: pass -[#2 Removal] = 1:7-1:12 - >-----< -1| except: pass - +[#2 Removal] = [#2 Domain] = 1:7-1:12 >-----< 1| except: pass @@ -37,10 +31,7 @@ finally: pass >----< 2| finally: pass -[#3 Removal] = 2:8-2:13 - >-----< -2| finally: pass - +[#3 Removal] = [#3 Domain] = 2:8-2:13 >-----< 2| finally: pass diff --git a/data/fixtures/scopes/python/interior/interior.try2.scope b/data/fixtures/scopes/python/interior/interior.try2.scope index 2bfcf4d829..f135aef374 100644 --- a/data/fixtures/scopes/python/interior/interior.try2.scope +++ b/data/fixtures/scopes/python/interior/interior.try2.scope @@ -6,10 +6,7 @@ except*: pass >----< 0| try: pass -[#1 Removal] = 0:4-0:9 - >-----< -0| try: pass - +[#1 Removal] = [#1 Domain] = 0:4-0:9 >-----< 0| try: pass @@ -21,10 +18,7 @@ except*: pass >----< 1| except*: pass -[#2 Removal] = 1:8-1:13 - >-----< -1| except*: pass - +[#2 Removal] = [#2 Domain] = 1:8-1:13 >-----< 1| except*: pass diff --git a/data/fixtures/scopes/python/interior/interior.while.scope b/data/fixtures/scopes/python/interior/interior.while.scope index ee0cb61af3..6b2b547f62 100644 --- a/data/fixtures/scopes/python/interior/interior.while.scope +++ b/data/fixtures/scopes/python/interior/interior.while.scope @@ -5,10 +5,7 @@ while True: pass >----< 0| while True: pass -[Removal] = 0:11-0:16 - >-----< -0| while True: pass - +[Removal] = [Domain] = 0:11-0:16 >-----< 0| while True: pass diff --git a/data/fixtures/scopes/talon/interior.command.scope b/data/fixtures/scopes/talon/interior.command.scope index 35f2bcc898..af75afd601 100644 --- a/data/fixtures/scopes/talon/interior.command.scope +++ b/data/fixtures/scopes/talon/interior.command.scope @@ -6,12 +6,7 @@ foo: >-------< 1| bar = 0 -[Removal] = 0:4-1:11 - > -0| foo: -1| bar = 0 - -----------< - +[Removal] = [Domain] = 0:4-1:11 > 0| foo: diff --git a/packages/cursorless-vscode-e2e/src/suite/serializeScopeFixture.ts b/packages/cursorless-vscode-e2e/src/suite/serializeScopeFixture.ts index 19aaf59e13..86b9a7b83d 100644 --- a/packages/cursorless-vscode-e2e/src/suite/serializeScopeFixture.ts +++ b/packages/cursorless-vscode-e2e/src/suite/serializeScopeFixture.ts @@ -179,41 +179,37 @@ function serializeTarget({ }: SerializeTargetArg): string { const lines: string[] = [""]; - const headers = ["Content"]; - - // Add removal and domain headers below content header if their ranges are equal - if (target.contentRange.isRangeEqual(target.removalRange)) { - headers.push("Removal"); - } - if (domain != null && target.contentRange.isRangeEqual(domain)) { - headers.push("Domain"); + // Group headers for identical ranges + const ranges: [string, Range][] = [ + ["Content", target.contentRange], + ["Removal", target.removalRange], + ]; + + // Domain should always be added last unless it's part of a group + const groupDomain = + domain != null && ranges.some(([_, range]) => domain.isRangeEqual(range)); + if (groupDomain) { + ranges.push(["Domain", domain]); } - lines.push( - ...headers.map((header, index) => - serializeHeader({ - header, - scopeNumber, - targetNumber, - range: index === headers.length - 1 ? target.contentRange : undefined, - }), - ), - serializeTargetRange(codeLines, target.contentRange), - ); + const rangeGroups = groupRanges(ranges); - // Add separate removal header below content if their ranges are not equal - if (!target.contentRange.isRangeEqual(target.removalRange)) { - lines.push( - "", - serializeHeader({ - header: "Removal", - scopeNumber, - targetNumber, - range: target.removalRange, - }), - serializeTargetRange(codeLines, target.removalRange), - ); - } + rangeGroups.forEach((group, i) => { + if (i > 0) { + lines.push(""); + } + group.headers.forEach((header, j) => { + lines.push( + serializeHeader({ + header, + scopeNumber, + targetNumber, + range: j === group.headers.length - 1 ? group.range : undefined, + }), + ); + }); + lines.push(serializeTargetRange(codeLines, group.range)); + }); if (target.leadingDelimiter != null) { lines.push( @@ -267,7 +263,7 @@ function serializeTarget({ ); } - if (domain != null && !target.contentRange.isRangeEqual(domain)) { + if (domain != null && !groupDomain) { lines.push( "", serializeHeader({ @@ -287,6 +283,24 @@ function serializeTarget({ return lines.join("\n"); } +function groupRanges(ranges: [string, Range][]) { + const groups: { headers: string[]; range: Range }[] = []; + const map: Record = {}; + + ranges.forEach(([header, range]) => { + const existingGroup = map[range.concise()]; + if (existingGroup != null) { + existingGroup.headers.push(header); + } else { + const group = { headers: [header], range }; + groups.push(group); + map[range.concise()] = group; + } + }); + + return groups; +} + function serializeTargetInsertionDelimiter( target: TargetRanges, scopeNumber: number | undefined,