diff --git a/data/fixtures/scopes/c/argument.actual.iteration.scope b/data/fixtures/scopes/c/argument.actual.iteration.scope new file mode 100644 index 0000000000..c6b7e07196 --- /dev/null +++ b/data/fixtures/scopes/c/argument.actual.iteration.scope @@ -0,0 +1,10 @@ +foo(aaa, bbb); +--- + +[Range] = 0:4-0:12 + >--------< +0| foo(aaa, bbb); + +[Domain] = 0:0-0:13 + >-------------< +0| foo(aaa, bbb); diff --git a/data/fixtures/scopes/c/argument.actual.method.iteration.scope b/data/fixtures/scopes/c/argument.actual.method.iteration.scope new file mode 100644 index 0000000000..b4fa962af8 --- /dev/null +++ b/data/fixtures/scopes/c/argument.actual.method.iteration.scope @@ -0,0 +1,10 @@ +foo.bar(aaa, bbb); +--- + +[Range] = 0:8-0:16 + >--------< +0| foo.bar(aaa, bbb); + +[Domain] = 0:0-0:17 + >-----------------< +0| foo.bar(aaa, bbb); diff --git a/data/fixtures/scopes/c/argument.actual.method.scope b/data/fixtures/scopes/c/argument.actual.method.scope new file mode 100644 index 0000000000..46548a2c6c --- /dev/null +++ b/data/fixtures/scopes/c/argument.actual.method.scope @@ -0,0 +1,33 @@ +foo.bar(aaa, bbb); +--- + +[#1 Content] = +[#1 Domain] = 0:8-0:11 + >---< +0| foo.bar(aaa, bbb); + +[#1 Removal] = 0:8-0:13 + >-----< +0| foo.bar(aaa, bbb); + +[#1 Trailing delimiter] = 0:11-0:13 + >--< +0| foo.bar(aaa, bbb); + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 0:13-0:16 + >---< +0| foo.bar(aaa, bbb); + +[#2 Removal] = 0:11-0:16 + >-----< +0| foo.bar(aaa, bbb); + +[#2 Leading delimiter] = 0:11-0:13 + >--< +0| foo.bar(aaa, bbb); + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/c/argument.actual.method2.scope b/data/fixtures/scopes/c/argument.actual.method2.scope new file mode 100644 index 0000000000..f75aaa48de --- /dev/null +++ b/data/fixtures/scopes/c/argument.actual.method2.scope @@ -0,0 +1,44 @@ +foo.bar( + aaa, + bbb +); +--- + +[#1 Content] = +[#1 Domain] = 1:4-1:7 + >---< +1| aaa, + +[#1 Removal] = 1:4-2:4 + >---- +1| aaa, +2| bbb + ----< + +[#1 Trailing delimiter] = 1:7-2:4 + >- +1| aaa, +2| bbb + ----< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 2:4-2:7 + >---< +2| bbb + +[#2 Removal] = 1:7-2:7 + >- +1| aaa, +2| bbb + -------< + +[#2 Leading delimiter] = 1:7-2:4 + >- +1| aaa, +2| bbb + ----< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/c/argument.actual.scope b/data/fixtures/scopes/c/argument.actual.scope new file mode 100644 index 0000000000..2e62d177c3 --- /dev/null +++ b/data/fixtures/scopes/c/argument.actual.scope @@ -0,0 +1,33 @@ +foo(aaa, bbb); +--- + +[#1 Content] = +[#1 Domain] = 0:4-0:7 + >---< +0| foo(aaa, bbb); + +[#1 Removal] = 0:4-0:9 + >-----< +0| foo(aaa, bbb); + +[#1 Trailing delimiter] = 0:7-0:9 + >--< +0| foo(aaa, bbb); + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 0:9-0:12 + >---< +0| foo(aaa, bbb); + +[#2 Removal] = 0:7-0:12 + >-----< +0| foo(aaa, bbb); + +[#2 Leading delimiter] = 0:7-0:9 + >--< +0| foo(aaa, bbb); + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/c/argument.actual2.scope b/data/fixtures/scopes/c/argument.actual2.scope new file mode 100644 index 0000000000..6f7ea31f22 --- /dev/null +++ b/data/fixtures/scopes/c/argument.actual2.scope @@ -0,0 +1,44 @@ +foo( + aaa, + bbb +); +--- + +[#1 Content] = +[#1 Domain] = 1:4-1:7 + >---< +1| aaa, + +[#1 Removal] = 1:4-2:4 + >---- +1| aaa, +2| bbb + ----< + +[#1 Trailing delimiter] = 1:7-2:4 + >- +1| aaa, +2| bbb + ----< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 2:4-2:7 + >---< +2| bbb + +[#2 Removal] = 1:7-2:7 + >- +1| aaa, +2| bbb + -------< + +[#2 Leading delimiter] = 1:7-2:4 + >- +1| aaa, +2| bbb + ----< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/c/argument.formal.iteration.scope b/data/fixtures/scopes/c/argument.formal.iteration.scope new file mode 100644 index 0000000000..a59fd8e9cc --- /dev/null +++ b/data/fixtures/scopes/c/argument.formal.iteration.scope @@ -0,0 +1,10 @@ +void foo(int aaa, int bbb) {} +--- + +[Range] = 0:9-0:25 + >----------------< +0| void foo(int aaa, int bbb) {} + +[Domain] = 0:0-0:29 + >-----------------------------< +0| void foo(int aaa, int bbb) {} diff --git a/data/fixtures/scopes/c/argument.formal.scope b/data/fixtures/scopes/c/argument.formal.scope new file mode 100644 index 0000000000..b0be8672be --- /dev/null +++ b/data/fixtures/scopes/c/argument.formal.scope @@ -0,0 +1,33 @@ +void foo(int aaa, int bbb) {} +--- + +[#1 Content] = +[#1 Domain] = 0:9-0:16 + >-------< +0| void foo(int aaa, int bbb) {} + +[#1 Removal] = 0:9-0:18 + >---------< +0| void foo(int aaa, int bbb) {} + +[#1 Trailing delimiter] = 0:16-0:18 + >--< +0| void foo(int aaa, int bbb) {} + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 0:18-0:25 + >-------< +0| void foo(int aaa, int bbb) {} + +[#2 Removal] = 0:16-0:25 + >---------< +0| void foo(int aaa, int bbb) {} + +[#2 Leading delimiter] = 0:16-0:18 + >--< +0| void foo(int aaa, int bbb) {} + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/c/argument.formal2.scope b/data/fixtures/scopes/c/argument.formal2.scope new file mode 100644 index 0000000000..ce1dcbb8fa --- /dev/null +++ b/data/fixtures/scopes/c/argument.formal2.scope @@ -0,0 +1,44 @@ +void foo( + int aaa, + int bbb +) {} +--- + +[#1 Content] = +[#1 Domain] = 1:4-1:11 + >-------< +1| int aaa, + +[#1 Removal] = 1:4-2:4 + >-------- +1| int aaa, +2| int bbb + ----< + +[#1 Trailing delimiter] = 1:11-2:4 + >- +1| int aaa, +2| int bbb + ----< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 2:4-2:11 + >-------< +2| int bbb + +[#2 Removal] = 1:11-2:11 + >- +1| int aaa, +2| int bbb + -----------< + +[#2 Leading delimiter] = 1:11-2:4 + >- +1| int aaa, +2| int bbb + ----< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/c/functionCall.scope b/data/fixtures/scopes/c/functionCall.scope new file mode 100644 index 0000000000..633f02ca5e --- /dev/null +++ b/data/fixtures/scopes/c/functionCall.scope @@ -0,0 +1,10 @@ +foo(); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:5 + >-----< +0| foo(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/functionCallee.scope b/data/fixtures/scopes/c/functionCallee.scope new file mode 100644 index 0000000000..3071a48ae9 --- /dev/null +++ b/data/fixtures/scopes/c/functionCallee.scope @@ -0,0 +1,13 @@ +foo(); +--- + +[Content] = +[Removal] = 0:0-0:3 + >---< +0| foo(); + +[Domain] = 0:0-0:5 + >-----< +0| foo(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/list.scope b/data/fixtures/scopes/c/list.scope new file mode 100644 index 0000000000..98c308ef04 --- /dev/null +++ b/data/fixtures/scopes/c/list.scope @@ -0,0 +1,17 @@ +int foo[3] = {a, 2, 3}; +--- + +[Content] = +[Domain] = 0:13-0:22 + >---------< +0| int foo[3] = {a, 2, 3}; + +[Removal] = 0:12-0:22 + >----------< +0| int foo[3] = {a, 2, 3}; + +[Leading delimiter] = 0:12-0:13 + >-< +0| int foo[3] = {a, 2, 3}; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/statement.scope b/data/fixtures/scopes/c/statement.scope new file mode 100644 index 0000000000..fc31001584 --- /dev/null +++ b/data/fixtures/scopes/c/statement.scope @@ -0,0 +1,10 @@ +int foo = 2; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:12 + >------------< +0| int foo = 2; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/type.argument.formal.scope b/data/fixtures/scopes/c/type.argument.formal.scope new file mode 100644 index 0000000000..ab37958d33 --- /dev/null +++ b/data/fixtures/scopes/c/type.argument.formal.scope @@ -0,0 +1,39 @@ +void foo(int aaa) {} +--- + +[#1 Content] = 0:0-0:4 + >----< +0| void foo(int aaa) {} + +[#1 Removal] = 0:0-0:5 + >-----< +0| void foo(int aaa) {} + +[#1 Trailing delimiter] = 0:4-0:5 + >-< +0| void foo(int aaa) {} + +[#1 Domain] = 0:0-0:20 + >--------------------< +0| void foo(int aaa) {} + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 0:9-0:12 + >---< +0| void foo(int aaa) {} + +[#2 Removal] = 0:9-0:13 + >----< +0| void foo(int aaa) {} + +[#2 Trailing delimiter] = 0:12-0:13 + >-< +0| void foo(int aaa) {} + +[#2 Domain] = 0:9-0:16 + >-------< +0| void foo(int aaa) {} + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/type.cast.scope b/data/fixtures/scopes/c/type.cast.scope new file mode 100644 index 0000000000..74cd6e837c --- /dev/null +++ b/data/fixtures/scopes/c/type.cast.scope @@ -0,0 +1,16 @@ +(int)5.5; +--- + +[Content] = 0:1-0:4 + >---< +0| (int)5.5; + +[Removal] = 0:0-0:5 + >-----< +0| (int)5.5; + +[Domain] = 0:0-0:8 + >--------< +0| (int)5.5; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/type.enum.scope b/data/fixtures/scopes/c/type.enum.scope new file mode 100644 index 0000000000..1f8f12c28d --- /dev/null +++ b/data/fixtures/scopes/c/type.enum.scope @@ -0,0 +1,10 @@ +enum Foo { aaa, bbb }; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:22 + >----------------------< +0| enum Foo { aaa, bbb }; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/type.return.scope b/data/fixtures/scopes/c/type.return.scope new file mode 100644 index 0000000000..153e08a800 --- /dev/null +++ b/data/fixtures/scopes/c/type.return.scope @@ -0,0 +1,20 @@ +int foo() {} +--- + +[Content] = 0:0-0:3 + >---< +0| int foo() {} + +[Removal] = 0:0-0:4 + >----< +0| int foo() {} + +[Trailing delimiter] = 0:3-0:4 + >-< +0| int foo() {} + +[Domain] = 0:0-0:12 + >------------< +0| int foo() {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/type.variable.scope b/data/fixtures/scopes/c/type.variable.scope new file mode 100644 index 0000000000..eae60523e1 --- /dev/null +++ b/data/fixtures/scopes/c/type.variable.scope @@ -0,0 +1,20 @@ +int foo = 2; +--- + +[Content] = 0:0-0:3 + >---< +0| int foo = 2; + +[Removal] = 0:0-0:4 + >----< +0| int foo = 2; + +[Trailing delimiter] = 0:3-0:4 + >-< +0| int foo = 2; + +[Domain] = 0:0-0:12 + >------------< +0| int foo = 2; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/anonymousFunction.scope b/data/fixtures/scopes/cpp/anonymousFunction.scope new file mode 100644 index 0000000000..1a47bd00a1 --- /dev/null +++ b/data/fixtures/scopes/cpp/anonymousFunction.scope @@ -0,0 +1,15 @@ +[]() { + return 2; +}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:1 + >------ +0| []() { +1| return 2; +2| }; + -< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/cpp/attribute.scope b/data/fixtures/scopes/cpp/attribute.scope new file mode 100644 index 0000000000..5259414aa5 --- /dev/null +++ b/data/fixtures/scopes/cpp/attribute.scope @@ -0,0 +1,10 @@ +[[attribute]] +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:13 + >-------------< +0| [[attribute]] + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/functionName.constructor.scope b/data/fixtures/scopes/cpp/functionName.constructor.scope new file mode 100644 index 0000000000..1c3ece5c32 --- /dev/null +++ b/data/fixtures/scopes/cpp/functionName.constructor.scope @@ -0,0 +1,19 @@ +class MyClass { + MyClass() {} +} +--- + +[Content] = +[Removal] = 1:4-1:11 + >-------< +1| MyClass() {} + +[Leading delimiter] = 1:0-1:4 + >----< +1| MyClass() {} + +[Domain] = 1:4-1:16 + >------------< +1| MyClass() {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/functionName.constructor2.scope b/data/fixtures/scopes/cpp/functionName.constructor2.scope new file mode 100644 index 0000000000..7702b7757d --- /dev/null +++ b/data/fixtures/scopes/cpp/functionName.constructor2.scope @@ -0,0 +1,19 @@ +class MyClass { + ~MyClass() {} +} +--- + +[Content] = +[Removal] = 1:4-1:12 + >--------< +1| ~MyClass() {} + +[Leading delimiter] = 1:0-1:4 + >----< +1| ~MyClass() {} + +[Domain] = 1:4-1:17 + >-------------< +1| ~MyClass() {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/functionName.method.scope b/data/fixtures/scopes/cpp/functionName.method.scope new file mode 100644 index 0000000000..b05dacf718 --- /dev/null +++ b/data/fixtures/scopes/cpp/functionName.method.scope @@ -0,0 +1,19 @@ +class MyClass { + void foo() {} +} +--- + +[Content] = +[Removal] = 1:9-1:12 + >---< +1| void foo() {} + +[Leading delimiter] = 1:8-1:9 + >-< +1| void foo() {} + +[Domain] = 1:4-1:17 + >-------------< +1| void foo() {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/name.argument.formal.constructor.iteration.scope b/data/fixtures/scopes/cpp/name.argument.formal.constructor.iteration.scope new file mode 100644 index 0000000000..d75a3ce2e3 --- /dev/null +++ b/data/fixtures/scopes/cpp/name.argument.formal.constructor.iteration.scope @@ -0,0 +1,9 @@ +class MyClass { + MyClass(int aaa, int bbb = 2) {} +} +--- + +[Range] = +[Domain] = 1:12-1:32 + >--------------------< +1| MyClass(int aaa, int bbb = 2) {} diff --git a/data/fixtures/scopes/cpp/name.argument.formal.constructor.scope b/data/fixtures/scopes/cpp/name.argument.formal.constructor.scope new file mode 100644 index 0000000000..04a522de54 --- /dev/null +++ b/data/fixtures/scopes/cpp/name.argument.formal.constructor.scope @@ -0,0 +1,87 @@ +class MyClass { + MyClass(int aaa, int bbb = 2) {} +} +--- + +[#1 Content] = 0:6-0:13 + >-------< +0| class MyClass { + +[#1 Removal] = 0:6-0:14 + >--------< +0| class MyClass { + +[#1 Leading delimiter] = 0:5-0:6 + >-< +0| class MyClass { + +[#1 Trailing delimiter] = 0:13-0:14 + >-< +0| class MyClass { + +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| MyClass(int aaa, int bbb = 2) {} +2| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 1:4-1:11 + >-------< +1| MyClass(int aaa, int bbb = 2) {} + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| MyClass(int aaa, int bbb = 2) {} + +[#2 Domain] = 1:4-1:36 + >--------------------------------< +1| MyClass(int aaa, int bbb = 2) {} + +[#2 Insertion delimiter] = " " + + +[#3 Content] = 1:16-1:19 + >---< +1| MyClass(int aaa, int bbb = 2) {} + +[#3 Removal] = 1:15-1:19 + >----< +1| MyClass(int aaa, int bbb = 2) {} + +[#3 Leading delimiter] = 1:15-1:16 + >-< +1| MyClass(int aaa, int bbb = 2) {} + +[#3 Domain] = 1:12-1:19 + >-------< +1| MyClass(int aaa, int bbb = 2) {} + +[#3 Insertion delimiter] = " " + + +[#4 Content] = 1:25-1:28 + >---< +1| MyClass(int aaa, int bbb = 2) {} + +[#4 Removal] = 1:25-1:29 + >----< +1| MyClass(int aaa, int bbb = 2) {} + +[#4 Leading delimiter] = 1:24-1:25 + >-< +1| MyClass(int aaa, int bbb = 2) {} + +[#4 Trailing delimiter] = 1:28-1:29 + >-< +1| MyClass(int aaa, int bbb = 2) {} + +[#4 Domain] = 1:21-1:32 + >-----------< +1| MyClass(int aaa, int bbb = 2) {} + +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/name.argument.formal.method.iteration.scope b/data/fixtures/scopes/cpp/name.argument.formal.method.iteration.scope new file mode 100644 index 0000000000..ee053b4452 --- /dev/null +++ b/data/fixtures/scopes/cpp/name.argument.formal.method.iteration.scope @@ -0,0 +1,9 @@ +class MyClass { + void foo(int aaa, int bbb = 2) {} +} +--- + +[Range] = +[Domain] = 1:13-1:33 + >--------------------< +1| void foo(int aaa, int bbb = 2) {} diff --git a/data/fixtures/scopes/cpp/name.argument.formal.method.scope b/data/fixtures/scopes/cpp/name.argument.formal.method.scope new file mode 100644 index 0000000000..260708002c --- /dev/null +++ b/data/fixtures/scopes/cpp/name.argument.formal.method.scope @@ -0,0 +1,87 @@ +class MyClass { + void foo(int aaa, int bbb = 2) {} +} +--- + +[#1 Content] = 0:6-0:13 + >-------< +0| class MyClass { + +[#1 Removal] = 0:6-0:14 + >--------< +0| class MyClass { + +[#1 Leading delimiter] = 0:5-0:6 + >-< +0| class MyClass { + +[#1 Trailing delimiter] = 0:13-0:14 + >-< +0| class MyClass { + +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| void foo(int aaa, int bbb = 2) {} +2| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 1:9-1:12 + >---< +1| void foo(int aaa, int bbb = 2) {} + +[#2 Leading delimiter] = 1:8-1:9 + >-< +1| void foo(int aaa, int bbb = 2) {} + +[#2 Domain] = 1:4-1:37 + >---------------------------------< +1| void foo(int aaa, int bbb = 2) {} + +[#2 Insertion delimiter] = " " + + +[#3 Content] = 1:17-1:20 + >---< +1| void foo(int aaa, int bbb = 2) {} + +[#3 Removal] = 1:16-1:20 + >----< +1| void foo(int aaa, int bbb = 2) {} + +[#3 Leading delimiter] = 1:16-1:17 + >-< +1| void foo(int aaa, int bbb = 2) {} + +[#3 Domain] = 1:13-1:20 + >-------< +1| void foo(int aaa, int bbb = 2) {} + +[#3 Insertion delimiter] = " " + + +[#4 Content] = 1:26-1:29 + >---< +1| void foo(int aaa, int bbb = 2) {} + +[#4 Removal] = 1:26-1:30 + >----< +1| void foo(int aaa, int bbb = 2) {} + +[#4 Leading delimiter] = 1:25-1:26 + >-< +1| void foo(int aaa, int bbb = 2) {} + +[#4 Trailing delimiter] = 1:29-1:30 + >-< +1| void foo(int aaa, int bbb = 2) {} + +[#4 Domain] = 1:22-1:33 + >-----------< +1| void foo(int aaa, int bbb = 2) {} + +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/namedFunction.constructor.scope b/data/fixtures/scopes/cpp/namedFunction.constructor.scope new file mode 100644 index 0000000000..eef4f536f6 --- /dev/null +++ b/data/fixtures/scopes/cpp/namedFunction.constructor.scope @@ -0,0 +1,21 @@ +class MyClass { + MyClass() {} +} +--- + +[Content] = +[Domain] = 1:4-1:16 + >------------< +1| MyClass() {} + +[Removal] = 1:0-2:0 + >---------------- +1| MyClass() {} +2| } + < + +[Leading delimiter] = 1:0-1:4 + >----< +1| MyClass() {} + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/cpp/namedFunction.constructor2.scope b/data/fixtures/scopes/cpp/namedFunction.constructor2.scope new file mode 100644 index 0000000000..3fb6ef8eb2 --- /dev/null +++ b/data/fixtures/scopes/cpp/namedFunction.constructor2.scope @@ -0,0 +1,21 @@ +class MyClass { + ~MyClass() {} +} +--- + +[Content] = +[Domain] = 1:4-1:17 + >-------------< +1| ~MyClass() {} + +[Removal] = 1:0-2:0 + >----------------- +1| ~MyClass() {} +2| } + < + +[Leading delimiter] = 1:0-1:4 + >----< +1| ~MyClass() {} + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/cpp/namedFunction.method.scope b/data/fixtures/scopes/cpp/namedFunction.method.scope new file mode 100644 index 0000000000..e19549b047 --- /dev/null +++ b/data/fixtures/scopes/cpp/namedFunction.method.scope @@ -0,0 +1,21 @@ +class MyClass { + void foo() {} +} +--- + +[Content] = +[Domain] = 1:4-1:17 + >-------------< +1| void foo() {} + +[Removal] = 1:0-2:0 + >----------------- +1| void foo() {} +2| } + < + +[Leading delimiter] = 1:0-1:4 + >----< +1| void foo() {} + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/cpp/type.argument.formal.constructor.scope b/data/fixtures/scopes/cpp/type.argument.formal.constructor.scope new file mode 100644 index 0000000000..9238e483b2 --- /dev/null +++ b/data/fixtures/scopes/cpp/type.argument.formal.constructor.scope @@ -0,0 +1,57 @@ +class MyClass { + MyClass(int aaa, int bbb = 2) {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| MyClass(int aaa, int bbb = 2) {} +2| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:12-1:15 + >---< +1| MyClass(int aaa, int bbb = 2) {} + +[#2 Removal] = 1:12-1:16 + >----< +1| MyClass(int aaa, int bbb = 2) {} + +[#2 Trailing delimiter] = 1:15-1:16 + >-< +1| MyClass(int aaa, int bbb = 2) {} + +[#2 Domain] = 1:12-1:19 + >-------< +1| MyClass(int aaa, int bbb = 2) {} + +[#2 Insertion delimiter] = " " + + +[#3 Content] = 1:21-1:24 + >---< +1| MyClass(int aaa, int bbb = 2) {} + +[#3 Removal] = 1:21-1:25 + >----< +1| MyClass(int aaa, int bbb = 2) {} + +[#3 Leading delimiter] = 1:20-1:21 + >-< +1| MyClass(int aaa, int bbb = 2) {} + +[#3 Trailing delimiter] = 1:24-1:25 + >-< +1| MyClass(int aaa, int bbb = 2) {} + +[#3 Domain] = 1:21-1:32 + >-----------< +1| MyClass(int aaa, int bbb = 2) {} + +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/type.argument.formal.method.scope b/data/fixtures/scopes/cpp/type.argument.formal.method.scope new file mode 100644 index 0000000000..7de0f8c8b0 --- /dev/null +++ b/data/fixtures/scopes/cpp/type.argument.formal.method.scope @@ -0,0 +1,80 @@ +class MyClass { + void foo(int aaa, int bbb = 2) {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| void foo(int aaa, int bbb = 2) {} +2| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:4-1:8 + >----< +1| void foo(int aaa, int bbb = 2) {} + +[#2 Removal] = 1:4-1:9 + >-----< +1| void foo(int aaa, int bbb = 2) {} + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| void foo(int aaa, int bbb = 2) {} + +[#2 Trailing delimiter] = 1:8-1:9 + >-< +1| void foo(int aaa, int bbb = 2) {} + +[#2 Domain] = 1:4-1:37 + >---------------------------------< +1| void foo(int aaa, int bbb = 2) {} + +[#2 Insertion delimiter] = " " + + +[#3 Content] = 1:13-1:16 + >---< +1| void foo(int aaa, int bbb = 2) {} + +[#3 Removal] = 1:13-1:17 + >----< +1| void foo(int aaa, int bbb = 2) {} + +[#3 Trailing delimiter] = 1:16-1:17 + >-< +1| void foo(int aaa, int bbb = 2) {} + +[#3 Domain] = 1:13-1:20 + >-------< +1| void foo(int aaa, int bbb = 2) {} + +[#3 Insertion delimiter] = " " + + +[#4 Content] = 1:22-1:25 + >---< +1| void foo(int aaa, int bbb = 2) {} + +[#4 Removal] = 1:22-1:26 + >----< +1| void foo(int aaa, int bbb = 2) {} + +[#4 Leading delimiter] = 1:21-1:22 + >-< +1| void foo(int aaa, int bbb = 2) {} + +[#4 Trailing delimiter] = 1:25-1:26 + >-< +1| void foo(int aaa, int bbb = 2) {} + +[#4 Domain] = 1:22-1:33 + >-----------< +1| void foo(int aaa, int bbb = 2) {} + +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/type.foreach.scope b/data/fixtures/scopes/cpp/type.foreach.scope new file mode 100644 index 0000000000..f264ea50dd --- /dev/null +++ b/data/fixtures/scopes/cpp/type.foreach.scope @@ -0,0 +1,20 @@ +for (int v: values) {} +--- + +[Content] = 0:5-0:8 + >---< +0| for (int v: values) {} + +[Removal] = 0:5-0:9 + >----< +0| for (int v: values) {} + +[Trailing delimiter] = 0:8-0:9 + >-< +0| for (int v: values) {} + +[Domain] = 0:0-0:22 + >----------------------< +0| for (int v: values) {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/value.argument.formal.constructor.iteration.scope b/data/fixtures/scopes/cpp/value.argument.formal.constructor.iteration.scope new file mode 100644 index 0000000000..d75a3ce2e3 --- /dev/null +++ b/data/fixtures/scopes/cpp/value.argument.formal.constructor.iteration.scope @@ -0,0 +1,9 @@ +class MyClass { + MyClass(int aaa, int bbb = 2) {} +} +--- + +[Range] = +[Domain] = 1:12-1:32 + >--------------------< +1| MyClass(int aaa, int bbb = 2) {} diff --git a/data/fixtures/scopes/cpp/value.argument.formal.constructor.scope b/data/fixtures/scopes/cpp/value.argument.formal.constructor.scope new file mode 100644 index 0000000000..e08f4f16db --- /dev/null +++ b/data/fixtures/scopes/cpp/value.argument.formal.constructor.scope @@ -0,0 +1,22 @@ +class MyClass { + MyClass(int aaa, int bbb = 2) {} +} +--- + +[Content] = 1:31-1:32 + >-< +1| MyClass(int aaa, int bbb = 2) {} + +[Removal] = 1:28-1:32 + >----< +1| MyClass(int aaa, int bbb = 2) {} + +[Leading delimiter] = 1:28-1:31 + >---< +1| MyClass(int aaa, int bbb = 2) {} + +[Domain] = 1:21-1:32 + >-----------< +1| MyClass(int aaa, int bbb = 2) {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/value.argument.formal.method.iteration.scope b/data/fixtures/scopes/cpp/value.argument.formal.method.iteration.scope new file mode 100644 index 0000000000..ee053b4452 --- /dev/null +++ b/data/fixtures/scopes/cpp/value.argument.formal.method.iteration.scope @@ -0,0 +1,9 @@ +class MyClass { + void foo(int aaa, int bbb = 2) {} +} +--- + +[Range] = +[Domain] = 1:13-1:33 + >--------------------< +1| void foo(int aaa, int bbb = 2) {} diff --git a/data/fixtures/scopes/cpp/value.argument.formal.method.scope b/data/fixtures/scopes/cpp/value.argument.formal.method.scope new file mode 100644 index 0000000000..c9bceab2b3 --- /dev/null +++ b/data/fixtures/scopes/cpp/value.argument.formal.method.scope @@ -0,0 +1,22 @@ +class MyClass { + void foo(int aaa, int bbb = 2) {} +} +--- + +[Content] = 1:32-1:33 + >-< +1| void foo(int aaa, int bbb = 2) {} + +[Removal] = 1:29-1:33 + >----< +1| void foo(int aaa, int bbb = 2) {} + +[Leading delimiter] = 1:29-1:32 + >---< +1| void foo(int aaa, int bbb = 2) {} + +[Domain] = 1:22-1:33 + >-----------< +1| void foo(int aaa, int bbb = 2) {} + +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/c.ts b/packages/common/src/scopeSupportFacets/c.ts index d12a0f4240..e5e219b912 100644 --- a/packages/common/src/scopeSupportFacets/c.ts +++ b/packages/common/src/scopeSupportFacets/c.ts @@ -1,12 +1,26 @@ 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; -export const cScopeSupport: LanguageScopeSupportFacetMap = { +export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { + list: supported, ifStatement: supported, - disqualifyDelimiter: supported, + statement: supported, + "statement.class": supported, + class: supported, + className: supported, + namedFunction: supported, + + functionName: supported, + functionCall: supported, + functionCallee: supported, + "argument.actual": supported, + "argument.actual.iteration": supported, + "argument.actual.method": supported, + "argument.actual.method.iteration": supported, + "argument.formal": supported, + "argument.formal.iteration": supported, "comment.line": supported, "comment.block": supported, @@ -14,28 +28,233 @@ export const cScopeSupport: LanguageScopeSupportFacetMap = { "textFragment.comment.line": supported, "textFragment.comment.block": supported, "textFragment.string.singleLine": supported, + disqualifyDelimiter: supported, - class: supported, - className: supported, - - namedFunction: supported, + "name.assignment": supported, + "name.variable": supported, "name.function": supported, "name.class": supported, "name.field": supported, - functionName: supported, - "name.argument.formal": supported, "name.argument.formal.iteration": supported, - "name.variable": supported, - "value.variable": supported, - "name.assignment": supported, "value.assignment": supported, + "value.variable": supported, - "statement.class": supported, - - "type.class": supported, + "type.variable": supported, + "type.argument.formal": supported, "type.field": supported, + "type.enum": supported, + "type.cast": supported, + "type.class": supported, + "type.return": supported, + + // Unsupported + + switchStatementSubject: unsupported, + fieldAccess: unsupported, + + "argumentList.actual.empty": unsupported, + "argumentList.actual.singleLine": unsupported, + "argumentList.actual.multiLine": unsupported, + "argumentList.formal.empty": unsupported, + "argumentList.formal.singleLine": unsupported, + "argumentList.formal.multiLine": unsupported, + + "statement.iteration.document": unsupported, + "statement.iteration.block": unsupported, + + "class.iteration.document": unsupported, + "className.iteration.document": unsupported, + + "functionName.iteration.document": unsupported, + "namedFunction.iteration.document": unsupported, + "interior.class": unsupported, + "interior.function": unsupported, + "interior.if": unsupported, + "interior.try": unsupported, + "interior.switchCase": unsupported, + "interior.ternary": unsupported, + "interior.loop": unsupported, + + "branch.if": unsupported, + "branch.if.iteration": unsupported, + "branch.try": unsupported, + "branch.try.iteration": unsupported, + "branch.switchCase": unsupported, + "branch.switchCase.iteration": unsupported, + "branch.ternary": unsupported, + "branch.loop": unsupported, + + "condition.if": unsupported, + "condition.while": unsupported, + "condition.doWhile": unsupported, + "condition.for": unsupported, + "condition.ternary": unsupported, + "condition.switchCase": unsupported, + "condition.switchCase.iteration": unsupported, + + "collectionItem.unenclosed": unsupported, + "collectionItem.unenclosed.iteration": unsupported, + + "name.iteration.block": unsupported, + "name.iteration.document": unsupported, + + "value.return": unsupported, + "value.field": unsupported, + + "type.field.iteration": unsupported, + "type.argument.formal.iteration": unsupported, + + // Not applicable (C and C++) + + // Element and tags + element: notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + "interior.element": notApplicable, + "textFragment.element": notApplicable, + + // Resource syntax + "interior.resource": notApplicable, + "type.resource": notApplicable, + "type.resource.iteration": notApplicable, + "name.resource": notApplicable, + "name.resource.iteration": notApplicable, + "value.resource": notApplicable, + "value.resource.iteration": notApplicable, + + // Map literal + map: notApplicable, + "key.mapPair": notApplicable, + "key.mapPair.iteration": notApplicable, + "value.mapPair": notApplicable, + "value.mapPair.iteration": notApplicable, + + // Keyword argument + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, + + // Multiline string + "string.multiLine": notApplicable, + "textFragment.string.multiLine": notApplicable, + + // Section + section: notApplicable, + "section.iteration.document": notApplicable, + "section.iteration.parent": notApplicable, + + // Pattern destructing + "name.assignment.pattern": notApplicable, + "name.variable.pattern": notApplicable, + "value.variable.pattern": notApplicable, + + // Command + command: notApplicable, + "interior.command": notApplicable, + + // Type alias + "type.alias": notApplicable, + "value.typeAlias": notApplicable, + + // Notebook cell + notebookCell: notApplicable, + "interior.cell": notApplicable, + + // Nested class + "class.iteration.block": notApplicable, + "className.iteration.block": notApplicable, + + // Miscellaneous + "key.attribute": notApplicable, + "type.interface": notApplicable, + "value.attribute": notApplicable, + "value.yield": notApplicable, + environment: notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, +}; + +export const cScopeSupport: LanguageScopeSupportFacetMap = { + ...cCoreScopeSupport, + + // Not applicable for C, but supported for C++ + // These are defined here because we don't want C++ to import them and + // accidentally forget to add support for them. + + attribute: notApplicable, + + // Lambda + "argument.formal.lambda.iteration": notApplicable, + "argument.formal.lambda": notApplicable, + "argumentList.formal.lambda.empty": notApplicable, + "argumentList.formal.lambda.multiLine": notApplicable, + "argumentList.formal.lambda.singleLine": notApplicable, + "interior.lambda": notApplicable, + "value.return.lambda": notApplicable, + anonymousFunction: notApplicable, + + // Constructor + "argument.actual.constructor.iteration": notApplicable, + "argument.actual.constructor": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argument.formal.constructor": notApplicable, + "argumentList.actual.constructor.empty": notApplicable, + "argumentList.actual.constructor.multiLine": notApplicable, + "argumentList.actual.constructor.singleLine": notApplicable, + "argumentList.formal.constructor.empty": notApplicable, + "argumentList.formal.constructor.multiLine": notApplicable, + "argumentList.formal.constructor.singleLine": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, + "functionName.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.constructor": notApplicable, + "namedFunction.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "type.argument.formal.constructor": notApplicable, + "value.argument.formal.constructor.iteration": notApplicable, + "value.argument.formal.constructor": notApplicable, + + // Method + "argument.formal.method.iteration": notApplicable, + "argument.formal.method": notApplicable, + "argumentList.actual.method.empty": notApplicable, + "argumentList.actual.method.multiLine": notApplicable, + "argumentList.actual.method.singleLine": notApplicable, + "argumentList.formal.method.empty": notApplicable, + "argumentList.formal.method.multiLine": notApplicable, + "argumentList.formal.method.singleLine": notApplicable, + "functionName.method.iteration.class": notApplicable, + "functionName.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.argument.formal.method": notApplicable, + "name.method": notApplicable, + "namedFunction.method.iteration.class": notApplicable, + "namedFunction.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "type.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + "value.argument.formal.method": notApplicable, + + // Foreach + "name.foreach": notApplicable, + "type.foreach": notApplicable, + "value.foreach": notApplicable, + + // Default argument value "value.argument.formal": notApplicable, "value.argument.formal.iteration": notApplicable, + + // Generic type + "type.typeArgument": notApplicable, + "type.typeArgument.iteration": notApplicable, + + // Nested function + "functionName.iteration.block": notApplicable, + "namedFunction.iteration.block": notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/cpp.ts b/packages/common/src/scopeSupportFacets/cpp.ts index 7954a53a85..37c9a07484 100644 --- a/packages/common/src/scopeSupportFacets/cpp.ts +++ b/packages/common/src/scopeSupportFacets/cpp.ts @@ -1,13 +1,81 @@ -import { cScopeSupport } from "./c"; +import { cCoreScopeSupport } from "./c"; 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, unsupported } = ScopeSupportFacetLevel; export const cppScopeSupport: LanguageScopeSupportFacetMap = { - ...cScopeSupport, + ...cCoreScopeSupport, + "functionName.constructor": supported, + "functionName.method": supported, + + "namedFunction.method": supported, + "namedFunction.constructor": supported, + + attribute: supported, + anonymousFunction: supported, "value.argument.formal": supported, "value.argument.formal.iteration": supported, + "value.argument.formal.method": supported, + "value.argument.formal.method.iteration": supported, + "value.argument.formal.constructor": supported, + "value.argument.formal.constructor.iteration": supported, + "name.argument.formal.method": supported, + "name.argument.formal.method.iteration": supported, + "name.argument.formal.constructor": supported, + "name.argument.formal.constructor.iteration": supported, + + "type.argument.formal.method": supported, + "type.argument.formal.constructor": supported, + "type.foreach": supported, + + // Unsupported + + "argument.actual.constructor": unsupported, + "argument.actual.constructor.iteration": unsupported, + "argument.formal.method": unsupported, + "argument.formal.method.iteration": unsupported, + "argument.formal.constructor": unsupported, + "argument.formal.constructor.iteration": unsupported, + "argument.formal.lambda": unsupported, + "argument.formal.lambda.iteration": unsupported, + + "argumentList.actual.method.empty": unsupported, + "argumentList.actual.method.singleLine": unsupported, + "argumentList.actual.method.multiLine": unsupported, + "argumentList.actual.constructor.empty": unsupported, + "argumentList.actual.constructor.singleLine": unsupported, + "argumentList.actual.constructor.multiLine": unsupported, + "argumentList.formal.constructor.empty": unsupported, + "argumentList.formal.constructor.singleLine": unsupported, + "argumentList.formal.constructor.multiLine": unsupported, + "argumentList.formal.lambda.empty": unsupported, + "argumentList.formal.lambda.singleLine": unsupported, + "argumentList.formal.lambda.multiLine": unsupported, + "argumentList.formal.method.empty": unsupported, + "argumentList.formal.method.singleLine": unsupported, + "argumentList.formal.method.multiLine": unsupported, + + "functionName.iteration.block": unsupported, + "functionName.method.iteration.class": unsupported, + + "functionCall.constructor": unsupported, + "functionCallee.constructor": unsupported, + + "name.constructor": unsupported, + "name.foreach": unsupported, + "name.method": unsupported, + "namedFunction.iteration.block": unsupported, + "namedFunction.method.iteration.class": unsupported, + + "value.foreach": unsupported, + "value.return.lambda": unsupported, + + "type.typeArgument": unsupported, + "type.typeArgument.iteration": unsupported, + "type.argument.formal.method.iteration": unsupported, + "type.argument.formal.constructor.iteration": unsupported, + + "interior.lambda": unsupported, }; diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index 8da6177320..50f8d452ef 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -710,7 +710,7 @@ export const scopeSupportFacetInfos: Record< isIteration: true, }, "value.argument.actual": { - description: "The value of a argument in a function call", + description: "The value of a (keyword) argument in a function call", scopeType: "value", }, "value.argument.actual.iteration": { diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.ts index da10b200f4..540e936975 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.ts @@ -43,7 +43,7 @@ export function checkCaptureStartEnd( void showError( messages, "TreeSitterQuery.checkCaptures.badOrder", - `Start capture must be before end capture: ${captures}`, + `Start capture must be before end capture: ${captures.map((c) => c.name)}`, ); shownError = true; } diff --git a/queries/c.scm b/queries/c.scm index ddbacf5f4c..813eae8bb7 100644 --- a/queries/c.scm +++ b/queries/c.scm @@ -195,9 +195,17 @@ (_ type: (_) @type ) @_.domain - (#not-type? @_.domain "type_definition") + (#not-type? @_.domain type_definition type_descriptor cast_expression) ) +;;!! (int)5.5; +;;! ^^^ +(cast_expression + "(" @type.removal.start + type: (_) @type + ")" @type.removal.end +) @_.domain + ;;!! void foo(int value) {} ;;! ^^^^^ (parameter_declaration