diff --git a/data/fixtures/scopes/csharp/argument.actual.constructor.iteration.scope b/data/fixtures/scopes/csharp/argument.actual.constructor.iteration.scope new file mode 100644 index 0000000000..484dd5c808 --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.actual.constructor.iteration.scope @@ -0,0 +1,10 @@ +new Foo(a, b); +--- + +[Range] = 0:8-0:12 + >----< +0| new Foo(a, b); + +[Domain] = 0:0-0:13 + >-------------< +0| new Foo(a, b); diff --git a/data/fixtures/scopes/csharp/argument.actual.constructor.scope b/data/fixtures/scopes/csharp/argument.actual.constructor.scope new file mode 100644 index 0000000000..adfbef60e8 --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.actual.constructor.scope @@ -0,0 +1,33 @@ +new Foo(a, b); +--- + +[#1 Content] = +[#1 Domain] = 0:8-0:9 + >-< +0| new Foo(a, b); + +[#1 Removal] = 0:8-0:11 + >---< +0| new Foo(a, b); + +[#1 Trailing delimiter] = 0:9-0:11 + >--< +0| new Foo(a, b); + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 0:11-0:12 + >-< +0| new Foo(a, b); + +[#2 Removal] = 0:9-0:12 + >---< +0| new Foo(a, b); + +[#2 Leading delimiter] = 0:9-0:11 + >--< +0| new Foo(a, b); + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argument.actual.constructor2.scope b/data/fixtures/scopes/csharp/argument.actual.constructor2.scope new file mode 100644 index 0000000000..83b174809d --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.actual.constructor2.scope @@ -0,0 +1,44 @@ +new Foo( + a, + b +); +--- + +[#1 Content] = +[#1 Domain] = 1:4-1:5 + >-< +1| a, + +[#1 Removal] = 1:4-2:4 + >-- +1| a, +2| b + ----< + +[#1 Trailing delimiter] = 1:5-2:4 + >- +1| a, +2| b + ----< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 2:4-2:5 + >-< +2| b + +[#2 Removal] = 1:5-2:5 + >- +1| a, +2| b + -----< + +[#2 Leading delimiter] = 1:5-2:4 + >- +1| a, +2| b + ----< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/csharp/argument.actual.method.iteration.scope b/data/fixtures/scopes/csharp/argument.actual.method.iteration.scope new file mode 100644 index 0000000000..c0370680a0 --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.actual.method.iteration.scope @@ -0,0 +1,10 @@ +foo.bar(a, b); +--- + +[Range] = 0:8-0:12 + >----< +0| foo.bar(a, b); + +[Domain] = 0:0-0:13 + >-------------< +0| foo.bar(a, b); diff --git a/data/fixtures/scopes/csharp/argument.actual.method.scope b/data/fixtures/scopes/csharp/argument.actual.method.scope new file mode 100644 index 0000000000..d318cad25e --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.actual.method.scope @@ -0,0 +1,33 @@ +foo.bar(a, b); +--- + +[#1 Content] = +[#1 Domain] = 0:8-0:9 + >-< +0| foo.bar(a, b); + +[#1 Removal] = 0:8-0:11 + >---< +0| foo.bar(a, b); + +[#1 Trailing delimiter] = 0:9-0:11 + >--< +0| foo.bar(a, b); + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 0:11-0:12 + >-< +0| foo.bar(a, b); + +[#2 Removal] = 0:9-0:12 + >---< +0| foo.bar(a, b); + +[#2 Leading delimiter] = 0:9-0:11 + >--< +0| foo.bar(a, b); + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argument.actual.method2.scope b/data/fixtures/scopes/csharp/argument.actual.method2.scope new file mode 100644 index 0000000000..8ea12dab83 --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.actual.method2.scope @@ -0,0 +1,44 @@ +foo.bar( + a, + b +); +--- + +[#1 Content] = +[#1 Domain] = 1:4-1:5 + >-< +1| a, + +[#1 Removal] = 1:4-2:4 + >-- +1| a, +2| b + ----< + +[#1 Trailing delimiter] = 1:5-2:4 + >- +1| a, +2| b + ----< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 2:4-2:5 + >-< +2| b + +[#2 Removal] = 1:5-2:5 + >- +1| a, +2| b + -----< + +[#2 Leading delimiter] = 1:5-2:4 + >- +1| a, +2| b + ----< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/csharp/argument.formal.constructor.iteration.scope b/data/fixtures/scopes/csharp/argument.formal.constructor.iteration.scope new file mode 100644 index 0000000000..4557615b0f --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.formal.constructor.iteration.scope @@ -0,0 +1,12 @@ +class MyClass { + MyClass(int a, int b) {} +} +--- + +[Range] = 1:12-1:24 + >------------< +1| MyClass(int a, int b) {} + +[Domain] = 1:4-1:28 + >------------------------< +1| MyClass(int a, int b) {} diff --git a/data/fixtures/scopes/csharp/argument.formal.constructor.scope b/data/fixtures/scopes/csharp/argument.formal.constructor.scope new file mode 100644 index 0000000000..c00e317d52 --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.formal.constructor.scope @@ -0,0 +1,35 @@ +class MyClass { + MyClass(int a, int b) {} +} +--- + +[#1 Content] = +[#1 Domain] = 1:12-1:17 + >-----< +1| MyClass(int a, int b) {} + +[#1 Removal] = 1:12-1:19 + >-------< +1| MyClass(int a, int b) {} + +[#1 Trailing delimiter] = 1:17-1:19 + >--< +1| MyClass(int a, int b) {} + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 1:19-1:24 + >-----< +1| MyClass(int a, int b) {} + +[#2 Removal] = 1:17-1:24 + >-------< +1| MyClass(int a, int b) {} + +[#2 Leading delimiter] = 1:17-1:19 + >--< +1| MyClass(int a, int b) {} + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argument.formal.constructor2.scope b/data/fixtures/scopes/csharp/argument.formal.constructor2.scope new file mode 100644 index 0000000000..f4a46fd108 --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.formal.constructor2.scope @@ -0,0 +1,46 @@ +class MyClass { + MyClass( + int a, + int b + ) {} +} +--- + +[#1 Content] = +[#1 Domain] = 2:8-2:13 + >-----< +2| int a, + +[#1 Removal] = 2:8-3:8 + >------ +2| int a, +3| int b + --------< + +[#1 Trailing delimiter] = 2:13-3:8 + >- +2| int a, +3| int b + --------< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 3:8-3:13 + >-----< +3| int b + +[#2 Removal] = 2:13-3:13 + >- +2| int a, +3| int b + -------------< + +[#2 Leading delimiter] = 2:13-3:8 + >- +2| int a, +3| int b + --------< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/csharp/argument.formal.method.iteration.scope b/data/fixtures/scopes/csharp/argument.formal.method.iteration.scope new file mode 100644 index 0000000000..938a3fcb41 --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.formal.method.iteration.scope @@ -0,0 +1,12 @@ +class MyClass { + void foo(int a, int b) {} +} +--- + +[Range] = 1:13-1:25 + >------------< +1| void foo(int a, int b) {} + +[Domain] = 1:4-1:29 + >-------------------------< +1| void foo(int a, int b) {} diff --git a/data/fixtures/scopes/csharp/argument.formal.method.scope b/data/fixtures/scopes/csharp/argument.formal.method.scope new file mode 100644 index 0000000000..f40432e5df --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.formal.method.scope @@ -0,0 +1,35 @@ +class MyClass { + void foo(int a, int b) {} +} +--- + +[#1 Content] = +[#1 Domain] = 1:13-1:18 + >-----< +1| void foo(int a, int b) {} + +[#1 Removal] = 1:13-1:20 + >-------< +1| void foo(int a, int b) {} + +[#1 Trailing delimiter] = 1:18-1:20 + >--< +1| void foo(int a, int b) {} + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 1:20-1:25 + >-----< +1| void foo(int a, int b) {} + +[#2 Removal] = 1:18-1:25 + >-------< +1| void foo(int a, int b) {} + +[#2 Leading delimiter] = 1:18-1:20 + >--< +1| void foo(int a, int b) {} + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argument.formal.method2.scope b/data/fixtures/scopes/csharp/argument.formal.method2.scope new file mode 100644 index 0000000000..7576e55c64 --- /dev/null +++ b/data/fixtures/scopes/csharp/argument.formal.method2.scope @@ -0,0 +1,46 @@ +class MyClass { + void foo( + int a, + int b + ) {} +} +--- + +[#1 Content] = +[#1 Domain] = 2:8-2:13 + >-----< +2| int a, + +[#1 Removal] = 2:8-3:8 + >------ +2| int a, +3| int b + --------< + +[#1 Trailing delimiter] = 2:13-3:8 + >- +2| int a, +3| int b + --------< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 3:8-3:13 + >-----< +3| int b + +[#2 Removal] = 2:13-3:13 + >- +2| int a, +3| int b + -------------< + +[#2 Leading delimiter] = 2:13-3:8 + >- +2| int a, +3| int b + --------< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/csharp/argumentList.actual.constructor.scope b/data/fixtures/scopes/csharp/argumentList.actual.constructor.scope new file mode 100644 index 0000000000..728f90d07c --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.actual.constructor.scope @@ -0,0 +1,13 @@ +new Foo(); +--- + +[Content] = +[Removal] = 0:8-0:8 + >< +0| new Foo(); + +[Domain] = 0:0-0:9 + >---------< +0| new Foo(); + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/csharp/argumentList.actual.constructor2.scope b/data/fixtures/scopes/csharp/argumentList.actual.constructor2.scope new file mode 100644 index 0000000000..3ba72064f0 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.actual.constructor2.scope @@ -0,0 +1,13 @@ +new Foo(a, b); +--- + +[Content] = +[Removal] = 0:8-0:12 + >----< +0| new Foo(a, b); + +[Domain] = 0:0-0:13 + >-------------< +0| new Foo(a, b); + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argumentList.actual.constructor3.scope b/data/fixtures/scopes/csharp/argumentList.actual.constructor3.scope new file mode 100644 index 0000000000..bbcff2f43c --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.actual.constructor3.scope @@ -0,0 +1,24 @@ +new Foo( + a, + b +); +--- + +[Content] = +[Removal] = 0:8-3:0 + > +0| new Foo( +1| a, +2| b +3| ); + < + +[Domain] = 0:0-3:1 + >-------- +0| new Foo( +1| a, +2| b +3| ); + -< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/csharp/argumentList.actual.method.scope b/data/fixtures/scopes/csharp/argumentList.actual.method.scope new file mode 100644 index 0000000000..91d34a15d7 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.actual.method.scope @@ -0,0 +1,13 @@ +foo.bar(); +--- + +[Content] = +[Removal] = 0:8-0:8 + >< +0| foo.bar(); + +[Domain] = 0:0-0:9 + >---------< +0| foo.bar(); + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/csharp/argumentList.actual.method2.scope b/data/fixtures/scopes/csharp/argumentList.actual.method2.scope new file mode 100644 index 0000000000..c4b50f6f84 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.actual.method2.scope @@ -0,0 +1,13 @@ +foo.bar(a, b); +--- + +[Content] = +[Removal] = 0:8-0:12 + >----< +0| foo.bar(a, b); + +[Domain] = 0:0-0:13 + >-------------< +0| foo.bar(a, b); + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argumentList.actual.method3.scope b/data/fixtures/scopes/csharp/argumentList.actual.method3.scope new file mode 100644 index 0000000000..26a8b9f4aa --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.actual.method3.scope @@ -0,0 +1,24 @@ +foo.bar( + a, + b +); +--- + +[Content] = +[Removal] = 0:8-3:0 + > +0| foo.bar( +1| a, +2| b +3| ); + < + +[Domain] = 0:0-3:1 + >-------- +0| foo.bar( +1| a, +2| b +3| ); + -< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/csharp/argumentList.actual.scope b/data/fixtures/scopes/csharp/argumentList.actual.scope new file mode 100644 index 0000000000..539138bcb6 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.actual.scope @@ -0,0 +1,13 @@ +foo(); +--- + +[Content] = +[Removal] = 0:4-0:4 + >< +0| foo(); + +[Domain] = 0:0-0:5 + >-----< +0| foo(); + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/csharp/argumentList.actual2.scope b/data/fixtures/scopes/csharp/argumentList.actual2.scope new file mode 100644 index 0000000000..8193f0939f --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.actual2.scope @@ -0,0 +1,13 @@ +foo(a, b); +--- + +[Content] = +[Removal] = 0:4-0:8 + >----< +0| foo(a, b); + +[Domain] = 0:0-0:9 + >---------< +0| foo(a, b); + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argumentList.actual3.scope b/data/fixtures/scopes/csharp/argumentList.actual3.scope new file mode 100644 index 0000000000..dcf3825591 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.actual3.scope @@ -0,0 +1,24 @@ +foo( + a, + b +); +--- + +[Content] = +[Removal] = 0:4-3:0 + > +0| foo( +1| a, +2| b +3| ); + < + +[Domain] = 0:0-3:1 + >---- +0| foo( +1| a, +2| b +3| ); + -< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/csharp/argumentList.formal.constructor.scope b/data/fixtures/scopes/csharp/argumentList.formal.constructor.scope new file mode 100644 index 0000000000..c7f415a0c5 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.formal.constructor.scope @@ -0,0 +1,15 @@ +class MyClass { + MyClass() {} +} +--- + +[Content] = +[Removal] = 1:12-1:12 + >< +1| MyClass() {} + +[Domain] = 1:4-1:16 + >------------< +1| MyClass() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/csharp/argumentList.formal.constructor2.scope b/data/fixtures/scopes/csharp/argumentList.formal.constructor2.scope new file mode 100644 index 0000000000..a7cd679f0f --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.formal.constructor2.scope @@ -0,0 +1,15 @@ +class MyClass { + MyClass(int a, int b) {} +} +--- + +[Content] = +[Removal] = 1:12-1:24 + >------------< +1| MyClass(int a, int b) {} + +[Domain] = 1:4-1:28 + >------------------------< +1| MyClass(int a, int b) {} + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argumentList.formal.lambda.scope b/data/fixtures/scopes/csharp/argumentList.formal.lambda.scope new file mode 100644 index 0000000000..03e31d209d --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.formal.lambda.scope @@ -0,0 +1,13 @@ +() => {}; +--- + +[Content] = +[Removal] = 0:1-0:1 + >< +0| () => {}; + +[Domain] = 0:0-0:8 + >--------< +0| () => {}; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/csharp/argumentList.formal.lambda2.scope b/data/fixtures/scopes/csharp/argumentList.formal.lambda2.scope new file mode 100644 index 0000000000..15ab235883 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.formal.lambda2.scope @@ -0,0 +1,13 @@ +(a, b) => {}; +--- + +[Content] = +[Removal] = 0:1-0:5 + >----< +0| (a, b) => {}; + +[Domain] = 0:0-0:12 + >------------< +0| (a, b) => {}; + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argumentList.formal.method.scope b/data/fixtures/scopes/csharp/argumentList.formal.method.scope new file mode 100644 index 0000000000..47572da9e3 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.formal.method.scope @@ -0,0 +1,15 @@ +class MyClass { + void foo() {} +} +--- + +[Content] = +[Removal] = 1:13-1:13 + >< +1| void foo() {} + +[Domain] = 1:4-1:17 + >-------------< +1| void foo() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/csharp/argumentList.formal.method2.scope b/data/fixtures/scopes/csharp/argumentList.formal.method2.scope new file mode 100644 index 0000000000..254cf01189 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.formal.method2.scope @@ -0,0 +1,15 @@ +class MyClass { + void foo(int a, int b) {} +} +--- + +[Content] = +[Removal] = 1:13-1:25 + >------------< +1| void foo(int a, int b) {} + +[Domain] = 1:4-1:29 + >-------------------------< +1| void foo(int a, int b) {} + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argumentList.formal.scope b/data/fixtures/scopes/csharp/argumentList.formal.scope new file mode 100644 index 0000000000..9d4dd443f0 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.formal.scope @@ -0,0 +1,13 @@ +void foo() {} +--- + +[Content] = +[Removal] = 0:9-0:9 + >< +0| void foo() {} + +[Domain] = 0:0-0:13 + >-------------< +0| void foo() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/csharp/argumentList.formal2.scope b/data/fixtures/scopes/csharp/argumentList.formal2.scope new file mode 100644 index 0000000000..d5220fc1a1 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.formal2.scope @@ -0,0 +1,13 @@ +void foo(a, b) {} +--- + +[Content] = +[Removal] = 0:9-0:13 + >----< +0| void foo(a, b) {} + +[Domain] = 0:0-0:17 + >-----------------< +0| void foo(a, b) {} + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/csharp/argumentList.formal3.scope b/data/fixtures/scopes/csharp/argumentList.formal3.scope new file mode 100644 index 0000000000..500c0ba6b2 --- /dev/null +++ b/data/fixtures/scopes/csharp/argumentList.formal3.scope @@ -0,0 +1,24 @@ +void foo( + a, + b +) {} +--- + +[Content] = +[Removal] = 0:9-3:0 + > +0| void foo( +1| a, +2| b +3| ) {} + < + +[Domain] = 0:0-3:4 + >--------- +0| void foo( +1| a, +2| b +3| ) {} + ----< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/csharp/attribute.scope b/data/fixtures/scopes/csharp/attribute.scope new file mode 100644 index 0000000000..ed3d256a14 --- /dev/null +++ b/data/fixtures/scopes/csharp/attribute.scope @@ -0,0 +1,11 @@ +[Obsolete("Deprecated")] +void foo() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:1-0:23 + >----------------------< +0| [Obsolete("Deprecated")] + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/branch.if.iteration.scope b/data/fixtures/scopes/csharp/branch.if.iteration.scope new file mode 100644 index 0000000000..afbad9b639 --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.if.iteration.scope @@ -0,0 +1,12 @@ +if () {} +else if () {} +else { } +--- + +[Range] = +[Domain] = 0:0-2:8 + >-------- +0| if () {} +1| else if () {} +2| else { } + --------< diff --git a/data/fixtures/scopes/csharp/branch.if.scope b/data/fixtures/scopes/csharp/branch.if.scope new file mode 100644 index 0000000000..a45d366bad --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.if.scope @@ -0,0 +1,45 @@ +if (true) {} +else if (false) {} +else { } +--- + +[#1 Content] = +[#1 Domain] = 0:0-0:12 + >------------< +0| if (true) {} + +[#1 Removal] = 0:0-1:5 + >------------ +0| if (true) {} +1| else if (false) {} + -----< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:0-1:19 + >-------------------< +1| else if (false) {} + +[#2 Removal] = 1:0-2:0 + >------------------- +1| else if (false) {} +2| else { } + < + +[#2 Insertion delimiter] = "\n" + + +[#3 Content] = +[#3 Domain] = 2:0-2:8 + >--------< +2| else { } + +[#3 Removal] = 1:19-2:8 + > +1| else if (false) {} +2| else { } + --------< + +[#3 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.loop.scope b/data/fixtures/scopes/csharp/branch.loop.scope new file mode 100644 index 0000000000..993264e193 --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.loop.scope @@ -0,0 +1,10 @@ +while (true) { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:16 + >----------------< +0| while (true) { } + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.loop2.scope b/data/fixtures/scopes/csharp/branch.loop2.scope new file mode 100644 index 0000000000..de7560026d --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.loop2.scope @@ -0,0 +1,10 @@ +do { } while (true); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:20 + >--------------------< +0| do { } while (true); + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.loop3.scope b/data/fixtures/scopes/csharp/branch.loop3.scope new file mode 100644 index 0000000000..2d18232ba5 --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.loop3.scope @@ -0,0 +1,10 @@ +for (int i = 0; i < size; ++i) { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:34 + >----------------------------------< +0| for (int i = 0; i < size; ++i) { } + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.loop4.scope b/data/fixtures/scopes/csharp/branch.loop4.scope new file mode 100644 index 0000000000..8ccc856579 --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.loop4.scope @@ -0,0 +1,10 @@ +foreach (int v in values) { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:29 + >-----------------------------< +0| foreach (int v in values) { } + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.switchCase.iteration.scope b/data/fixtures/scopes/csharp/branch.switchCase.iteration.scope new file mode 100644 index 0000000000..1cd720756f --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.switchCase.iteration.scope @@ -0,0 +1,18 @@ +switch (value) { + case 1: + break; + default: + break; +} +--- + +[Range] = +[Domain] = 0:16-5:0 + > +0| switch (value) { +1| case 1: +2| break; +3| default: +4| break; +5| } + < diff --git a/data/fixtures/scopes/csharp/branch.switchCase.scope b/data/fixtures/scopes/csharp/branch.switchCase.scope new file mode 100644 index 0000000000..7313cc9d2e --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.switchCase.scope @@ -0,0 +1,48 @@ +switch (value) { + case 1: + break; + default: + break; +} +--- + +[#1 Content] = +[#1 Domain] = 1:4-2:14 + >------- +1| case 1: +2| break; + --------------< + +[#1 Removal] = 1:0-3:0 + >----------- +1| case 1: +2| break; +3| default: + < + +[#1 Leading delimiter] = 1:0-1:4 + >----< +1| case 1: + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 3:4-4:14 + >-------- +3| default: +4| break; + --------------< + +[#2 Removal] = 3:0-5:0 + >------------ +3| default: +4| break; +5| } + < + +[#2 Leading delimiter] = 3:0-3:4 + >----< +3| default: + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.ternary.scope b/data/fixtures/scopes/csharp/branch.ternary.scope new file mode 100644 index 0000000000..d96d24ff5b --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.ternary.scope @@ -0,0 +1,37 @@ +value ? 1 : 2; +--- + +[#1 Content] = +[#1 Domain] = 0:8-0:9 + >-< +0| value ? 1 : 2; + +[#1 Removal] = 0:8-0:10 + >--< +0| value ? 1 : 2; + +[#1 Leading delimiter] = 0:7-0:8 + >-< +0| value ? 1 : 2; + +[#1 Trailing delimiter] = 0:9-0:10 + >-< +0| value ? 1 : 2; + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 0:12-0:13 + >-< +0| value ? 1 : 2; + +[#2 Removal] = 0:11-0:13 + >--< +0| value ? 1 : 2; + +[#2 Leading delimiter] = 0:11-0:12 + >-< +0| value ? 1 : 2; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.try.iteration.scope b/data/fixtures/scopes/csharp/branch.try.iteration.scope new file mode 100644 index 0000000000..a43428f5c2 --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.try.iteration.scope @@ -0,0 +1,12 @@ +try { } +catch(Exception ex) { } +finally { } +--- + +[Range] = +[Domain] = 0:0-2:11 + >------- +0| try { } +1| catch(Exception ex) { } +2| finally { } + -----------< diff --git a/data/fixtures/scopes/csharp/branch.try.scope b/data/fixtures/scopes/csharp/branch.try.scope new file mode 100644 index 0000000000..ad2cebdcb2 --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.try.scope @@ -0,0 +1,45 @@ +try { } +catch(Exception ex) { } +finally { } +--- + +[#1 Content] = +[#1 Domain] = 0:0-0:7 + >-------< +0| try { } + +[#1 Removal] = 0:0-1:0 + >------- +0| try { } +1| catch(Exception ex) { } + < + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:0-1:23 + >-----------------------< +1| catch(Exception ex) { } + +[#2 Removal] = 1:0-2:0 + >----------------------- +1| catch(Exception ex) { } +2| finally { } + < + +[#2 Insertion delimiter] = "\n" + + +[#3 Content] = +[#3 Domain] = 2:0-2:11 + >-----------< +2| finally { } + +[#3 Removal] = 1:23-2:11 + > +1| catch(Exception ex) { } +2| finally { } + -----------< + +[#3 Insertion delimiter] = "\n" diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index 26b424df70..29754f67fa 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -1,8 +1,7 @@ import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types"; import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types"; -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel; +const { supported, notApplicable } = ScopeSupportFacetLevel; export const csharpScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, @@ -11,6 +10,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { map: supported, list: supported, disqualifyDelimiter: supported, + attribute: supported, class: supported, "class.iteration.document": supported, @@ -35,6 +35,15 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "functionName.method": supported, "functionName.method.iteration.class": supported, + "branch.if": supported, + "branch.if.iteration": supported, + "branch.try": supported, + "branch.try.iteration": supported, + "branch.switchCase": supported, + "branch.switchCase.iteration": supported, + "branch.ternary": supported, + "branch.loop": supported, + "condition.for": supported, "condition.while": supported, "condition.doWhile": supported, @@ -62,10 +71,41 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "key.mapPair": supported, "key.mapPair.iteration": supported, + "argumentList.actual": supported, + "argumentList.actual.constructor": supported, + "argumentList.actual.method": supported, + "argumentList.formal": supported, + "argumentList.formal.lambda": supported, + "argumentList.formal.constructor": supported, + "argumentList.formal.method": supported, + "argument.actual": supported, "argument.actual.iteration": supported, + "argument.actual.constructor": supported, + "argument.actual.constructor.iteration": supported, + "argument.actual.method": supported, + "argument.actual.method.iteration": supported, "argument.formal": supported, "argument.formal.iteration": supported, + "argument.formal.constructor": supported, + "argument.formal.constructor.iteration": supported, + "argument.formal.method": supported, + "argument.formal.method.iteration": supported, + + // Not applicable + "interior.element": notApplicable, + "key.attribute": notApplicable, + "section.iteration.document": notApplicable, + "section.iteration.parent": notApplicable, + "textFragment.element": notApplicable, + command: notApplicable, + element: notApplicable, + endTag: notApplicable, + environment: notApplicable, + notebookCell: notApplicable, regularExpression: notApplicable, + section: notApplicable, + startTag: notApplicable, + tags: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index 0730be6242..43d3c062cd 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -282,6 +282,18 @@ export const scopeSupportFacetInfos: Record< isIteration: true, }, + "argumentList.actual": { + description: "A list of arguments in a function call", + scopeType: "argumentList", + }, + "argumentList.actual.method": { + description: "A list of arguments in a class method call", + scopeType: "argumentList", + }, + "argumentList.actual.constructor": { + description: "A list of arguments in a constructor call", + scopeType: "argumentList", + }, "argumentList.formal": { description: "A list of parameters in a function declaration", scopeType: "argumentList", diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index b1847c6ff6..514c8d9794 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -72,6 +72,9 @@ export const scopeSupportFacets = [ "argument.formal.lambda", "argument.formal.lambda.iteration", + "argumentList.actual", + "argumentList.actual.method", + "argumentList.actual.constructor", "argumentList.formal", "argumentList.formal.method", "argumentList.formal.constructor", diff --git a/queries/cpp.scm b/queries/cpp.scm index fda7a702ca..6cecaf55be 100644 --- a/queries/cpp.scm +++ b/queries/cpp.scm @@ -43,6 +43,8 @@ ) @_.domain (lambda_expression) @anonymousFunction + +;;!! [[attribute]] (attribute_declaration) @attribute ;; > curl https://raw.githubusercontent.com/tree-sitter/tree-sitter-cpp/master/src/node-types.json | jq '[.[] | select(.type == "_type_specifier") | .subtypes[].type]' diff --git a/queries/csharp.scm b/queries/csharp.scm index 7c8253c993..ceb1bf913d 100644 --- a/queries/csharp.scm +++ b/queries/csharp.scm @@ -50,6 +50,77 @@ (if_statement) @ifStatement +;;!! if () {} +;;! ^^^^^^^^ +( + (if_statement + condition: (_) @condition + consequence: (_) @branch.end.endOf @branch.removal.end.endOf + alternative: (_)? @branch.removal.end.startOf + ) @branch.start.startOf @branch.removal.start.startOf @condition.domain + (#not-parent-type? @condition.domain "if_statement") +) + +;;!! else if () {} +;;! ^^^^^^^^^^^^^ +(if_statement + "else" @branch.start.startOf @condition.domain.start.startOf + (if_statement + condition: (_) @condition + consequence: (_) @branch.end.endOf @condition.domain.end.endOf + ) +) + +;;!! else {} +;;! ^^^^^^^ +(if_statement + "else" @branch.start + alternative: (block) @branch.end +) + +;;!! if () {} else if () {} else {} +;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +( + (if_statement) @branch.iteration + (#not-parent-type? @branch.iteration "if_statement") +) + +;;!! try () {} +;;! ^^^^^^^^^ +(try_statement + body: (_) @branch.end.endOf +) @branch.start.startOf + +;;!! catch () {} +;;! ^^^^^^^^^^^ +(catch_clause) @branch + +;;!! finally {} +;;! ^^^^^^^^^^ +(finally_clause) @branch + +;;!! try () {} catch () {} finally {} +;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +(try_statement) @branch.iteration + +[ + (for_statement) + (for_each_statement) + (while_statement) + (do_statement) +] @branch + +;;!! true ? 0 : 1; +;;! ^^^^ +;;! ^ ^ +(conditional_expression + condition: (_) @condition + consequence: (_) @branch +) @condition.domain +(conditional_expression + alternative: (_) @branch +) @condition.domain + (class_declaration name: (identifier) @className ) @class @_.domain @@ -75,10 +146,13 @@ (string_literal) @string @textFragment (#child-range! @textFragment 0 -1 true true) ) + (comment) @comment @textFragment (lambda_expression) @anonymousFunction +(attribute) @attribute + [ (delegate_declaration name: (_) @functionName @@ -119,6 +193,7 @@ (switch_statement (tuple_expression) @private.switchStatementSubject ) @_.domain + (switch_statement value: (_) @private.switchStatementSubject ) @_.domain @@ -130,11 +205,13 @@ . (_) @condition ) @_.domain + (do_statement "while" . (_) @condition ) @_.domain + (switch_section (case_switch_label . @@ -142,10 +219,12 @@ ) ) @_.domain +(switch_section) @branch + (switch_statement body: (switch_body - "{" @condition.iteration.start.endOf - "}" @condition.iteration.end.startOf + "{" @branch.iteration.start.endOf @condition.iteration.start.endOf + "}" @branch.iteration.end.startOf @condition.iteration.end.startOf ) ) @@ -235,10 +314,19 @@ type: (_) @type ) @_.domain -;;!! def foo(name) {} -;;! ^^^^ +;;!! int value = 5 +;;! ^ +(parameter + name: (_) @value.leading.endOf + (equals_value_clause + (_) @value + ) +) @_.domain + +;; !! foo(a, b) +;; ! ^ ^ ( - (parameter_list + (argument_list (_)? @_.leading.endOf . (_) @argumentOrParameter @@ -249,10 +337,20 @@ (#single-or-multi-line-delimiter! @argumentOrParameter @_dummy ", " ",\n") ) -;;!! foo("bar") -;;! ^^^^^ -( +;; !! foo(a, b) +;; ! ^^^^ +(_ (argument_list + "(" @argumentList.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.end.startOf @argumentOrParameter.iteration.end.startOf + ) @_dummy + (#empty-single-multi-delimiter! @argumentList.start.endOf @_dummy "" ", " ",\n") +) @argumentList.domain @argumentOrParameter.iteration.domain + +;; !! void foo(int a, int b) +;; ! ^^^^^ ^^^^^ +( + (parameter_list (_)? @_.leading.endOf . (_) @argumentOrParameter @@ -263,34 +361,21 @@ (#single-or-multi-line-delimiter! @argumentOrParameter @_dummy ", " ",\n") ) -;;!! int value = 5 -;;! ^ -(parameter - name: (_) @value.leading.endOf - (equals_value_clause - (_) @value - ) -) @_.domain - +;; !! void foo(int a, int b) +;; ! ^^^^^^^^^^^^ (_ (parameter_list - "(" @argumentOrParameter.iteration.start.endOf - ")" @argumentOrParameter.iteration.end.startOf - ) -) @argumentOrParameter.iteration.domain + "(" @argumentList.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.end.startOf @argumentOrParameter.iteration.end.startOf + ) @_dummy + (#empty-single-multi-delimiter! @argumentList.start.endOf @_dummy "" ", " ",\n") +) @argumentList.domain @argumentOrParameter.iteration.domain (parameter_list "(" @name.iteration.start.endOf @value.iteration.start.endOf @type.iteration.start.endOf ")" @name.iteration.end.startOf @value.iteration.end.startOf @type.iteration.end.startOf ) -(_ - (argument_list - "(" @argumentOrParameter.iteration.start.endOf - ")" @argumentOrParameter.iteration.end.startOf - ) -) @argumentOrParameter.iteration.domain - ;; Treat interior of all bodies as iteration scopes for `name`, eg ;;!! void foo() { } ;;! ***