diff --git a/changelog/2025-04-addedArgumentListScope.md b/changelog/2025-04-addedArgumentListScope.md new file mode 100644 index 0000000000..7c07c1c1a2 --- /dev/null +++ b/changelog/2025-04-addedArgumentListScope.md @@ -0,0 +1,6 @@ +--- +tags: [enhancement] +pullRequest: 2907 +--- + +- Added `"arg list"` scope. The argument list is the entire list of arguments in a declared function. diff --git a/cursorless-talon/src/spoken_forms.json b/cursorless-talon/src/spoken_forms.json index 22d30775dc..cde8bcef99 100644 --- a/cursorless-talon/src/spoken_forms.json +++ b/cursorless-talon/src/spoken_forms.json @@ -125,6 +125,7 @@ "modifier_scope_types.csv": { "scope_type": { "arg": "argumentOrParameter", + "arg list": "argumentList", "attribute": "attribute", "call": "functionCall", "callee": "functionCallee", diff --git a/data/fixtures/scopes/java/argument.formal.constructor2.scope b/data/fixtures/scopes/java/argument.formal.constructor2.scope new file mode 100644 index 0000000000..274cf2d097 --- /dev/null +++ b/data/fixtures/scopes/java/argument.formal.constructor2.scope @@ -0,0 +1,46 @@ +public class MyClass { + public MyClass( + String name, + int age + ) {} +} +--- + +[#1 Content] = +[#1 Domain] = 2:8-2:19 + >-----------< +2| String name, + +[#1 Removal] = 2:8-3:8 + >------------ +2| String name, +3| int age + --------< + +[#1 Trailing delimiter] = 2:19-3:8 + >- +2| String name, +3| int age + --------< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 3:8-3:15 + >-------< +3| int age + +[#2 Removal] = 2:19-3:15 + >- +2| String name, +3| int age + ---------------< + +[#2 Leading delimiter] = 2:19-3:8 + >- +2| String name, +3| int age + --------< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/java/argument.formal.iteration.scope b/data/fixtures/scopes/java/argument.formal.iteration.scope deleted file mode 100644 index 0fb99f6888..0000000000 --- a/data/fixtures/scopes/java/argument.formal.iteration.scope +++ /dev/null @@ -1,12 +0,0 @@ -public class MyClass { - public void myFunk(int value, String name) { } -} ---- - -[Range] = 1:23-1:45 - >----------------------< -1| public void myFunk(int value, String name) { } - -[Domain] = 1:4-1:50 - >----------------------------------------------< -1| public void myFunk(int value, String name) { } diff --git a/data/fixtures/scopes/java/argument.formal.iteration2.scope b/data/fixtures/scopes/java/argument.formal.iteration2.scope deleted file mode 100644 index 86992e9b8c..0000000000 --- a/data/fixtures/scopes/java/argument.formal.iteration2.scope +++ /dev/null @@ -1,12 +0,0 @@ -class MyClass { - MyClass(int value, String name) { } -} ---- - -[Range] = 1:12-1:34 - >----------------------< -1| MyClass(int value, String name) { } - -[Domain] = 1:4-1:39 - >-----------------------------------< -1| MyClass(int value, String name) { } diff --git a/data/fixtures/scopes/java/argument.formal.lambda.iteration.scope b/data/fixtures/scopes/java/argument.formal.lambda.iteration.scope new file mode 100644 index 0000000000..0459cda209 --- /dev/null +++ b/data/fixtures/scopes/java/argument.formal.lambda.iteration.scope @@ -0,0 +1,10 @@ +(aaa, bbb) -> { }; +--- + +[Range] = 0:1-0:9 + >--------< +0| (aaa, bbb) -> { }; + +[Domain] = 0:0-0:17 + >-----------------< +0| (aaa, bbb) -> { }; diff --git a/data/fixtures/scopes/java/argument.formal.lambda.scope b/data/fixtures/scopes/java/argument.formal.lambda.scope new file mode 100644 index 0000000000..01a0159cf9 --- /dev/null +++ b/data/fixtures/scopes/java/argument.formal.lambda.scope @@ -0,0 +1,33 @@ +(aaa, bbb) -> { }; +--- + +[#1 Content] = +[#1 Domain] = 0:1-0:4 + >---< +0| (aaa, bbb) -> { }; + +[#1 Removal] = 0:1-0:6 + >-----< +0| (aaa, bbb) -> { }; + +[#1 Trailing delimiter] = 0:4-0:6 + >--< +0| (aaa, bbb) -> { }; + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 0:6-0:9 + >---< +0| (aaa, bbb) -> { }; + +[#2 Removal] = 0:4-0:9 + >-----< +0| (aaa, bbb) -> { }; + +[#2 Leading delimiter] = 0:4-0:6 + >--< +0| (aaa, bbb) -> { }; + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/java/argument.formal.lambda2.scope b/data/fixtures/scopes/java/argument.formal.lambda2.scope new file mode 100644 index 0000000000..4057c29da4 --- /dev/null +++ b/data/fixtures/scopes/java/argument.formal.lambda2.scope @@ -0,0 +1,44 @@ +( + 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/java/argument.formal.method2.scope b/data/fixtures/scopes/java/argument.formal.method2.scope new file mode 100644 index 0000000000..9251481a17 --- /dev/null +++ b/data/fixtures/scopes/java/argument.formal.method2.scope @@ -0,0 +1,46 @@ +public class MyClass { + public void foo( + String name, + int age + ) {} +} +--- + +[#1 Content] = +[#1 Domain] = 2:8-2:19 + >-----------< +2| String name, + +[#1 Removal] = 2:8-3:8 + >------------ +2| String name, +3| int age + --------< + +[#1 Trailing delimiter] = 2:19-3:8 + >- +2| String name, +3| int age + --------< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 3:8-3:15 + >-------< +3| int age + +[#2 Removal] = 2:19-3:15 + >- +2| String name, +3| int age + ---------------< + +[#2 Leading delimiter] = 2:19-3:8 + >- +2| String name, +3| int age + --------< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/java/argument.formal.scope b/data/fixtures/scopes/java/argument.formal.scope deleted file mode 100644 index 4c05d7734f..0000000000 --- a/data/fixtures/scopes/java/argument.formal.scope +++ /dev/null @@ -1,35 +0,0 @@ -public class MyClass { - public void myFunk(int value, String name) { } -} ---- - -[#1 Content] = -[#1 Domain] = 1:23-1:32 - >---------< -1| public void myFunk(int value, String name) { } - -[#1 Removal] = 1:23-1:34 - >-----------< -1| public void myFunk(int value, String name) { } - -[#1 Trailing delimiter] = 1:32-1:34 - >--< -1| public void myFunk(int value, String name) { } - -[#1 Insertion delimiter] = ", " - - -[#2 Content] = -[#2 Domain] = 1:34-1:45 - >-----------< -1| public void myFunk(int value, String name) { } - -[#2 Removal] = 1:32-1:45 - >-------------< -1| public void myFunk(int value, String name) { } - -[#2 Leading delimiter] = 1:32-1:34 - >--< -1| public void myFunk(int value, String name) { } - -[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/java/argument.formal2.scope b/data/fixtures/scopes/java/argument.formal2.scope deleted file mode 100644 index 1cd135a95e..0000000000 --- a/data/fixtures/scopes/java/argument.formal2.scope +++ /dev/null @@ -1,46 +0,0 @@ -public class MyClass { - public void myFunk( - int value, - String name - ) { } -} ---- - -[#1 Content] = -[#1 Domain] = 2:8-2:17 - >---------< -2| int value, - -[#1 Removal] = 2:8-3:8 - >---------- -2| int value, -3| String name - --------< - -[#1 Trailing delimiter] = 2:17-3:8 - >- -2| int value, -3| String name - --------< - -[#1 Insertion delimiter] = ",\n" - - -[#2 Content] = -[#2 Domain] = 3:8-3:19 - >-----------< -3| String name - -[#2 Removal] = 2:17-3:19 - >- -2| int value, -3| String name - -------------------< - -[#2 Leading delimiter] = 2:17-3:8 - >- -2| int value, -3| String name - --------< - -[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/java/argument.formal3.scope b/data/fixtures/scopes/java/argument.formal3.scope deleted file mode 100644 index 6a257480ac..0000000000 --- a/data/fixtures/scopes/java/argument.formal3.scope +++ /dev/null @@ -1,35 +0,0 @@ -class MyClass { - MyClass(int value, String name) { } -} ---- - -[#1 Content] = -[#1 Domain] = 1:12-1:21 - >---------< -1| MyClass(int value, String name) { } - -[#1 Removal] = 1:12-1:23 - >-----------< -1| MyClass(int value, String name) { } - -[#1 Trailing delimiter] = 1:21-1:23 - >--< -1| MyClass(int value, String name) { } - -[#1 Insertion delimiter] = ", " - - -[#2 Content] = -[#2 Domain] = 1:23-1:34 - >-----------< -1| MyClass(int value, String name) { } - -[#2 Removal] = 1:21-1:34 - >-------------< -1| MyClass(int value, String name) { } - -[#2 Leading delimiter] = 1:21-1:23 - >--< -1| MyClass(int value, String name) { } - -[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/java/argumentList.formal.constructor.scope b/data/fixtures/scopes/java/argumentList.formal.constructor.scope new file mode 100644 index 0000000000..8ecf6205b1 --- /dev/null +++ b/data/fixtures/scopes/java/argumentList.formal.constructor.scope @@ -0,0 +1,15 @@ +public class MyClass { + public MyClass(String name, int age) {} +} +--- + +[Content] = +[Removal] = 1:19-1:39 + >--------------------< +1| public MyClass(String name, int age) {} + +[Domain] = 1:4-1:43 + >---------------------------------------< +1| public MyClass(String name, int age) {} + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/java/argumentList.formal.constructor2.scope b/data/fixtures/scopes/java/argumentList.formal.constructor2.scope new file mode 100644 index 0000000000..835d5eb47e --- /dev/null +++ b/data/fixtures/scopes/java/argumentList.formal.constructor2.scope @@ -0,0 +1,26 @@ +public class MyClass { + public MyClass( + String name, + int age + ) {} +} +--- + +[Content] = +[Removal] = 1:19-4:4 + > +1| public MyClass( +2| String name, +3| int age +4| ) {} + ----< + +[Domain] = 1:4-4:8 + >--------------- +1| public MyClass( +2| String name, +3| int age +4| ) {} + --------< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/java/argumentList.formal.constructor3.scope b/data/fixtures/scopes/java/argumentList.formal.constructor3.scope new file mode 100644 index 0000000000..e91e8c777d --- /dev/null +++ b/data/fixtures/scopes/java/argumentList.formal.constructor3.scope @@ -0,0 +1,15 @@ +public class MyClass { + public MyClass() {} +} +--- + +[Content] = +[Removal] = 1:19-1:19 + >< +1| public MyClass() {} + +[Domain] = 1:4-1:23 + >-------------------< +1| public MyClass() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/java/argumentList.formal.lambda.scope b/data/fixtures/scopes/java/argumentList.formal.lambda.scope new file mode 100644 index 0000000000..adc12d6cb2 --- /dev/null +++ b/data/fixtures/scopes/java/argumentList.formal.lambda.scope @@ -0,0 +1,13 @@ +(aaa, bbb) -> { }; +--- + +[Content] = +[Removal] = 0:1-0:9 + >--------< +0| (aaa, bbb) -> { }; + +[Domain] = 0:0-0:17 + >-----------------< +0| (aaa, bbb) -> { }; + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/java/argumentList.formal.lambda2.scope b/data/fixtures/scopes/java/argumentList.formal.lambda2.scope new file mode 100644 index 0000000000..e6ecc66df1 --- /dev/null +++ b/data/fixtures/scopes/java/argumentList.formal.lambda2.scope @@ -0,0 +1,24 @@ +( + aaa, + bbb +) -> { }; +--- + +[Content] = +[Removal] = 0:1-3:0 + > +0| ( +1| aaa, +2| bbb +3| ) -> { }; + < + +[Domain] = 0:0-3:8 + >- +0| ( +1| aaa, +2| bbb +3| ) -> { }; + --------< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/java/argumentList.formal.lambda3.scope b/data/fixtures/scopes/java/argumentList.formal.lambda3.scope new file mode 100644 index 0000000000..b3aee8883e --- /dev/null +++ b/data/fixtures/scopes/java/argumentList.formal.lambda3.scope @@ -0,0 +1,13 @@ +() -> { }; +--- + +[Content] = +[Removal] = 0:1-0:1 + >< +0| () -> { }; + +[Domain] = 0:0-0:9 + >---------< +0| () -> { }; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/java/argumentList.formal.method.scope b/data/fixtures/scopes/java/argumentList.formal.method.scope new file mode 100644 index 0000000000..4fdc540857 --- /dev/null +++ b/data/fixtures/scopes/java/argumentList.formal.method.scope @@ -0,0 +1,15 @@ +public class MyClass { + public void foo(String name, int age) {} +} +--- + +[Content] = +[Removal] = 1:20-1:40 + >--------------------< +1| public void foo(String name, int age) {} + +[Domain] = 1:4-1:44 + >----------------------------------------< +1| public void foo(String name, int age) {} + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/java/argumentList.formal.method2.scope b/data/fixtures/scopes/java/argumentList.formal.method2.scope new file mode 100644 index 0000000000..5df05519c9 --- /dev/null +++ b/data/fixtures/scopes/java/argumentList.formal.method2.scope @@ -0,0 +1,26 @@ +public class MyClass { + public void foo( + String name, + int age + ) {} +} +--- + +[Content] = +[Removal] = 1:20-4:4 + > +1| public void foo( +2| String name, +3| int age +4| ) {} + ----< + +[Domain] = 1:4-4:8 + >---------------- +1| public void foo( +2| String name, +3| int age +4| ) {} + --------< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/java/argumentList.formal.method3.scope b/data/fixtures/scopes/java/argumentList.formal.method3.scope new file mode 100644 index 0000000000..698e5e2831 --- /dev/null +++ b/data/fixtures/scopes/java/argumentList.formal.method3.scope @@ -0,0 +1,15 @@ +public class MyClass { + public void foo() {} +} +--- + +[Content] = +[Removal] = 1:20-1:20 + >< +1| public void foo() {} + +[Domain] = 1:4-1:24 + >--------------------< +1| public void foo() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argument.formal.lambda.iteration.scope b/data/fixtures/scopes/javascript.core/argument.formal.lambda.iteration.scope new file mode 100644 index 0000000000..7561b7c28a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument.formal.lambda.iteration.scope @@ -0,0 +1,10 @@ +(aaa, bbb) => { } +--- + +[Range] = 0:1-0:9 + >--------< +0| (aaa, bbb) => { } + +[Domain] = 0:0-0:17 + >-----------------< +0| (aaa, bbb) => { } diff --git a/data/fixtures/scopes/javascript.core/argument.formal.lambda.iteration2.scope b/data/fixtures/scopes/javascript.core/argument.formal.lambda.iteration2.scope new file mode 100644 index 0000000000..1151d0840b --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument.formal.lambda.iteration2.scope @@ -0,0 +1,10 @@ +function (aaa, bbb) { } +--- + +[Range] = 0:10-0:18 + >--------< +0| function (aaa, bbb) { } + +[Domain] = 0:0-0:23 + >-----------------------< +0| function (aaa, bbb) { } diff --git a/data/fixtures/scopes/javascript.core/argument.formal.lambda.scope b/data/fixtures/scopes/javascript.core/argument.formal.lambda.scope new file mode 100644 index 0000000000..114ed3561b --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument.formal.lambda.scope @@ -0,0 +1,44 @@ +( + aaa, + bbb +) => { } +--- + +[#1 Content] = +[#1 Domain] = 1:2-1:5 + >---< +1| aaa, + +[#1 Removal] = 1:2-2:2 + >---- +1| aaa, +2| bbb + --< + +[#1 Trailing delimiter] = 1:5-2:2 + >- +1| aaa, +2| bbb + --< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 2:2-2:5 + >---< +2| bbb + +[#2 Removal] = 1:5-2:5 + >- +1| aaa, +2| bbb + -----< + +[#2 Leading delimiter] = 1:5-2:2 + >- +1| aaa, +2| bbb + --< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/javascript.core/argument.formal.lambda2.scope b/data/fixtures/scopes/javascript.core/argument.formal.lambda2.scope new file mode 100644 index 0000000000..1fdc4be718 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument.formal.lambda2.scope @@ -0,0 +1,33 @@ +function (aaa, bbb) { } +--- + +[#1 Content] = +[#1 Domain] = 0:10-0:13 + >---< +0| function (aaa, bbb) { } + +[#1 Removal] = 0:10-0:15 + >-----< +0| function (aaa, bbb) { } + +[#1 Trailing delimiter] = 0:13-0:15 + >--< +0| function (aaa, bbb) { } + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 0:15-0:18 + >---< +0| function (aaa, bbb) { } + +[#2 Removal] = 0:13-0:18 + >-----< +0| function (aaa, bbb) { } + +[#2 Leading delimiter] = 0:13-0:15 + >--< +0| function (aaa, bbb) { } + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/javascript.core/argument.formal.lambda3.scope b/data/fixtures/scopes/javascript.core/argument.formal.lambda3.scope new file mode 100644 index 0000000000..1fdc4be718 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument.formal.lambda3.scope @@ -0,0 +1,33 @@ +function (aaa, bbb) { } +--- + +[#1 Content] = +[#1 Domain] = 0:10-0:13 + >---< +0| function (aaa, bbb) { } + +[#1 Removal] = 0:10-0:15 + >-----< +0| function (aaa, bbb) { } + +[#1 Trailing delimiter] = 0:13-0:15 + >--< +0| function (aaa, bbb) { } + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 0:15-0:18 + >---< +0| function (aaa, bbb) { } + +[#2 Removal] = 0:13-0:18 + >-----< +0| function (aaa, bbb) { } + +[#2 Leading delimiter] = 0:13-0:15 + >--< +0| function (aaa, bbb) { } + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.constructor.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.constructor.scope new file mode 100644 index 0000000000..13a0cbdedd --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.constructor.scope @@ -0,0 +1,15 @@ +class MyClass { + constructor(aaa, bbb) { } +} +--- + +[Content] = +[Removal] = 1:14-1:22 + >--------< +1| constructor(aaa, bbb) { } + +[Domain] = 1:2-1:27 + >-------------------------< +1| constructor(aaa, bbb) { } + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.constructor2.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.constructor2.scope new file mode 100644 index 0000000000..3d87ffa5f0 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.constructor2.scope @@ -0,0 +1,26 @@ +class MyClass { + constructor( + aaa, + bbb + ) { } +} +--- + +[Content] = +[Removal] = 1:14-4:2 + > +1| constructor( +2| aaa, +3| bbb +4| ) { } + --< + +[Domain] = 1:2-4:7 + >------------ +1| constructor( +2| aaa, +3| bbb +4| ) { } + -------< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.constructor3.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.constructor3.scope new file mode 100644 index 0000000000..6ad780ad8d --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.constructor3.scope @@ -0,0 +1,15 @@ +class MyClass { + constructor() { } +} +--- + +[Content] = +[Removal] = 1:14-1:14 + >< +1| constructor() { } + +[Domain] = 1:2-1:19 + >-----------------< +1| constructor() { } + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.lambda.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda.scope new file mode 100644 index 0000000000..30b60eaf01 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda.scope @@ -0,0 +1,13 @@ +(aaa, bbb) => { } +--- + +[Content] = +[Removal] = 0:1-0:9 + >--------< +0| (aaa, bbb) => { } + +[Domain] = 0:0-0:17 + >-----------------< +0| (aaa, bbb) => { } + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.lambda2.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda2.scope new file mode 100644 index 0000000000..b2fae2bb40 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda2.scope @@ -0,0 +1,24 @@ +( + aaa, + bbb +) => { } +--- + +[Content] = +[Removal] = 0:1-3:0 + > +0| ( +1| aaa, +2| bbb +3| ) => { } + < + +[Domain] = 0:0-3:8 + >- +0| ( +1| aaa, +2| bbb +3| ) => { } + --------< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.lambda3.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda3.scope new file mode 100644 index 0000000000..7783f73527 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda3.scope @@ -0,0 +1,13 @@ +() => { } +--- + +[Content] = +[Removal] = 0:1-0:1 + >< +0| () => { } + +[Domain] = 0:0-0:9 + >---------< +0| () => { } + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.lambda4.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda4.scope new file mode 100644 index 0000000000..99b36bc73f --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda4.scope @@ -0,0 +1,13 @@ +function (aaa, bbb) { } +--- + +[Content] = +[Removal] = 0:10-0:18 + >--------< +0| function (aaa, bbb) { } + +[Domain] = 0:0-0:23 + >-----------------------< +0| function (aaa, bbb) { } + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.lambda5.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda5.scope new file mode 100644 index 0000000000..0a389a608a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda5.scope @@ -0,0 +1,24 @@ +function ( + aaa, + bbb +) { } +--- + +[Content] = +[Removal] = 0:10-3:0 + > +0| function ( +1| aaa, +2| bbb +3| ) { } + < + +[Domain] = 0:0-3:5 + >---------- +0| function ( +1| aaa, +2| bbb +3| ) { } + -----< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.lambda6.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda6.scope new file mode 100644 index 0000000000..49ae698c96 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.lambda6.scope @@ -0,0 +1,13 @@ +function () { } +--- + +[Content] = +[Removal] = 0:10-0:10 + >< +0| function () { } + +[Domain] = 0:0-0:15 + >---------------< +0| function () { } + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.method.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.method.scope new file mode 100644 index 0000000000..aeadb987a3 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.method.scope @@ -0,0 +1,15 @@ +class MyClass { + myFunk(aaa, bbb) { } +} +--- + +[Content] = +[Removal] = 1:9-1:17 + >--------< +1| myFunk(aaa, bbb) { } + +[Domain] = 1:2-1:22 + >--------------------< +1| myFunk(aaa, bbb) { } + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.method2.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.method2.scope new file mode 100644 index 0000000000..79e7255d39 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.method2.scope @@ -0,0 +1,26 @@ +class MyClass { + myFunk( + aaa, + bbb + ) { } +} +--- + +[Content] = +[Removal] = 1:9-4:2 + > +1| myFunk( +2| aaa, +3| bbb +4| ) { } + --< + +[Domain] = 1:2-4:7 + >------- +1| myFunk( +2| aaa, +3| bbb +4| ) { } + -------< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.method3.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.method3.scope new file mode 100644 index 0000000000..60d13ae256 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.method3.scope @@ -0,0 +1,15 @@ +class MyClass { + myFunk() { } +} +--- + +[Content] = +[Removal] = 1:9-1:9 + >< +1| myFunk() { } + +[Domain] = 1:2-1:14 + >------------< +1| myFunk() { } + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal.scope b/data/fixtures/scopes/javascript.core/argumentList.formal.scope new file mode 100644 index 0000000000..d86990597e --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal.scope @@ -0,0 +1,13 @@ +function myFunk(aaa, bbb) { } +--- + +[Content] = +[Removal] = 0:16-0:24 + >--------< +0| function myFunk(aaa, bbb) { } + +[Domain] = 0:0-0:29 + >-----------------------------< +0| function myFunk(aaa, bbb) { } + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal2.scope b/data/fixtures/scopes/javascript.core/argumentList.formal2.scope new file mode 100644 index 0000000000..243c69de07 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal2.scope @@ -0,0 +1,24 @@ +function myFunk( + aaa, + bbb +) { } +--- + +[Content] = +[Removal] = 0:16-3:0 + > +0| function myFunk( +1| aaa, +2| bbb +3| ) { } + < + +[Domain] = 0:0-3:5 + >---------------- +0| function myFunk( +1| aaa, +2| bbb +3| ) { } + -----< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/javascript.core/argumentList.formal3.scope b/data/fixtures/scopes/javascript.core/argumentList.formal3.scope new file mode 100644 index 0000000000..a98608fdc3 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList.formal3.scope @@ -0,0 +1,13 @@ +function myFunk() { } +--- + +[Content] = +[Removal] = 0:16-0:16 + >< +0| function myFunk() { } + +[Domain] = 0:0-0:21 + >---------------------< +0| function myFunk() { } + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/python/argument.formal.constructor2.scope b/data/fixtures/scopes/python/argument.formal.constructor2.scope new file mode 100644 index 0000000000..8d77cf5de9 --- /dev/null +++ b/data/fixtures/scopes/python/argument.formal.constructor2.scope @@ -0,0 +1,73 @@ +class Foo: + def __init__( + self, + aaa: str, + bbb: int + ): + pass +--- + +[#1 Content] = +[#1 Domain] = 2:8-2:12 + >----< +2| self, + +[#1 Removal] = 2:8-3:8 + >----- +2| self, +3| aaa: str, + --------< + +[#1 Trailing delimiter] = 2:12-3:8 + >- +2| self, +3| aaa: str, + --------< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 3:8-3:16 + >--------< +3| aaa: str, + +[#2 Removal] = 3:8-4:8 + >--------- +3| aaa: str, +4| bbb: int + --------< + +[#2 Leading delimiter] = 2:12-3:8 + >- +2| self, +3| aaa: str, + --------< + +[#2 Trailing delimiter] = 3:16-4:8 + >- +3| aaa: str, +4| bbb: int + --------< + +[#2 Insertion delimiter] = ",\n" + + +[#3 Content] = +[#3 Domain] = 4:8-4:16 + >--------< +4| bbb: int + +[#3 Removal] = 3:16-4:16 + >- +3| aaa: str, +4| bbb: int + ----------------< + +[#3 Leading delimiter] = 3:16-4:8 + >- +3| aaa: str, +4| bbb: int + --------< + +[#3 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/python/argument.formal.lambda.iteration.scope b/data/fixtures/scopes/python/argument.formal.lambda.iteration.scope new file mode 100644 index 0000000000..e3037349fa --- /dev/null +++ b/data/fixtures/scopes/python/argument.formal.lambda.iteration.scope @@ -0,0 +1,10 @@ +lambda a, b: pass +--- + +[Range] = 0:7-0:11 + >----< +0| lambda a, b: pass + +[Domain] = 0:0-0:17 + >-----------------< +0| lambda a, b: pass diff --git a/data/fixtures/scopes/python/argument.formal.lambda.scope b/data/fixtures/scopes/python/argument.formal.lambda.scope new file mode 100644 index 0000000000..5adf6669e6 --- /dev/null +++ b/data/fixtures/scopes/python/argument.formal.lambda.scope @@ -0,0 +1,33 @@ +lambda a, b: pass +--- + +[#1 Content] = +[#1 Domain] = 0:7-0:8 + >-< +0| lambda a, b: pass + +[#1 Removal] = 0:7-0:10 + >---< +0| lambda a, b: pass + +[#1 Trailing delimiter] = 0:8-0:10 + >--< +0| lambda a, b: pass + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 0:10-0:11 + >-< +0| lambda a, b: pass + +[#2 Removal] = 0:8-0:11 + >---< +0| lambda a, b: pass + +[#2 Leading delimiter] = 0:8-0:10 + >--< +0| lambda a, b: pass + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/python/argument.formal.method2.scope b/data/fixtures/scopes/python/argument.formal.method2.scope new file mode 100644 index 0000000000..886af41601 --- /dev/null +++ b/data/fixtures/scopes/python/argument.formal.method2.scope @@ -0,0 +1,46 @@ +class Foo: + def bar( + aaa: str, + bbb: int + ): + pass +--- + +[#1 Content] = +[#1 Domain] = 2:8-2:16 + >--------< +2| aaa: str, + +[#1 Removal] = 2:8-3:8 + >--------- +2| aaa: str, +3| bbb: int + --------< + +[#1 Trailing delimiter] = 2:16-3:8 + >- +2| aaa: str, +3| bbb: int + --------< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 3:8-3:16 + >--------< +3| bbb: int + +[#2 Removal] = 2:16-3:16 + >- +2| aaa: str, +3| bbb: int + ----------------< + +[#2 Leading delimiter] = 2:16-3:8 + >- +2| aaa: str, +3| bbb: int + --------< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/python/argumentList.formal.constructor.scope b/data/fixtures/scopes/python/argumentList.formal.constructor.scope new file mode 100644 index 0000000000..63d0ad239c --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal.constructor.scope @@ -0,0 +1,17 @@ +class Foo: + def __init__(self, aaa: str, bbb: int): + pass +--- + +[Content] = +[Removal] = 1:17-1:41 + >------------------------< +1| def __init__(self, aaa: str, bbb: int): + +[Domain] = 1:4-2:12 + >--------------------------------------- +1| def __init__(self, aaa: str, bbb: int): +2| pass + ------------< + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/python/argumentList.formal.constructor2.scope b/data/fixtures/scopes/python/argumentList.formal.constructor2.scope new file mode 100644 index 0000000000..35e43de29e --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal.constructor2.scope @@ -0,0 +1,30 @@ +class Foo: + def __init__( + self, + aaa: str, + bbb: int + ): + pass +--- + +[Content] = +[Removal] = 1:17-5:4 + > +1| def __init__( +2| self, +3| aaa: str, +4| bbb: int +5| ): + ----< + +[Domain] = 1:4-6:12 + >------------- +1| def __init__( +2| self, +3| aaa: str, +4| bbb: int +5| ): +6| pass + ------------< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/python/argumentList.formal.constructor3.scope b/data/fixtures/scopes/python/argumentList.formal.constructor3.scope new file mode 100644 index 0000000000..938990a30e --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal.constructor3.scope @@ -0,0 +1,17 @@ +class Foo: + def __init__(): + pass +--- + +[Content] = +[Removal] = 1:17-1:17 + >< +1| def __init__(): + +[Domain] = 1:4-2:12 + >--------------- +1| def __init__(): +2| pass + ------------< + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/python/argumentList.formal.lambda.scope b/data/fixtures/scopes/python/argumentList.formal.lambda.scope new file mode 100644 index 0000000000..d00cbcf3f0 --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal.lambda.scope @@ -0,0 +1,20 @@ +lambda a, b: pass +--- + +[Content] = 0:7-0:11 + >----< +0| lambda a, b: pass + +[Removal] = 0:6-0:11 + >-----< +0| lambda a, b: pass + +[Leading delimiter] = 0:6-0:7 + >-< +0| lambda a, b: pass + +[Domain] = 0:0-0:17 + >-----------------< +0| lambda a, b: pass + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/python/argumentList.formal.lambda2.scope b/data/fixtures/scopes/python/argumentList.formal.lambda2.scope new file mode 100644 index 0000000000..f45a6ee6be --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal.lambda2.scope @@ -0,0 +1,13 @@ +lambda: pass +--- + +[Content] = +[Removal] = 0:6-0:6 + >< +0| lambda: pass + +[Domain] = 0:0-0:12 + >------------< +0| lambda: pass + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/argumentList.formal.method.scope b/data/fixtures/scopes/python/argumentList.formal.method.scope new file mode 100644 index 0000000000..32cb62c3e3 --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal.method.scope @@ -0,0 +1,17 @@ +class Foo: + def bar(aaa: str, bbb: int): + pass +--- + +[Content] = +[Removal] = 1:12-1:30 + >------------------< +1| def bar(aaa: str, bbb: int): + +[Domain] = 1:4-2:12 + >---------------------------- +1| def bar(aaa: str, bbb: int): +2| pass + ------------< + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/python/argumentList.formal.method2.scope b/data/fixtures/scopes/python/argumentList.formal.method2.scope new file mode 100644 index 0000000000..9f9c431dbd --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal.method2.scope @@ -0,0 +1,27 @@ +class Foo: + def bar( + aaa: str, + bbb: int + ): + pass +--- + +[Content] = +[Removal] = 1:12-4:4 + > +1| def bar( +2| aaa: str, +3| bbb: int +4| ): + ----< + +[Domain] = 1:4-5:12 + >-------- +1| def bar( +2| aaa: str, +3| bbb: int +4| ): +5| pass + ------------< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/python/argumentList.formal.method3.scope b/data/fixtures/scopes/python/argumentList.formal.method3.scope new file mode 100644 index 0000000000..6d6fb449e5 --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal.method3.scope @@ -0,0 +1,17 @@ +class Foo: + def bar(): + pass +--- + +[Content] = +[Removal] = 1:12-1:12 + >< +1| def bar(): + +[Domain] = 1:4-2:12 + >---------- +1| def bar(): +2| pass + ------------< + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/python/argumentList.formal.scope b/data/fixtures/scopes/python/argumentList.formal.scope new file mode 100644 index 0000000000..689577d9ac --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal.scope @@ -0,0 +1,16 @@ +def for(name: str, value: int): + pass +--- + +[Content] = +[Removal] = 0:8-0:29 + >---------------------< +0| def for(name: str, value: int): + +[Domain] = 0:0-1:8 + >------------------------------- +0| def for(name: str, value: int): +1| pass + --------< + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/python/argumentList.formal2.scope b/data/fixtures/scopes/python/argumentList.formal2.scope new file mode 100644 index 0000000000..34dce296ee --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal2.scope @@ -0,0 +1,26 @@ +def foo( + aaa, + bbb, +): + pass +--- + +[Content] = +[Removal] = 0:8-3:0 + > +0| def foo( +1| aaa, +2| bbb, +3| ): + < + +[Domain] = 0:0-4:8 + >-------- +0| def foo( +1| aaa, +2| bbb, +3| ): +4| pass + --------< + +[Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/python/argumentList.formal3.scope b/data/fixtures/scopes/python/argumentList.formal3.scope new file mode 100644 index 0000000000..8cc064e417 --- /dev/null +++ b/data/fixtures/scopes/python/argumentList.formal3.scope @@ -0,0 +1,16 @@ +def for(): + pass +--- + +[Content] = +[Removal] = 0:8-0:8 + >< +0| def for(): + +[Domain] = 0:0-1:8 + >---------- +0| def for(): +1| pass + --------< + +[Insertion delimiter] = "" diff --git a/packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json b/packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json index 28e3ea93b1..b2aaceb889 100644 --- a/packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json +++ b/packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json @@ -1196,6 +1196,16 @@ } ] }, + { + "id": "argumentList", + "type": "scopeType", + "variations": [ + { + "spokenForm": "arg list", + "description": "Argument list" + } + ] + }, { "id": "argumentOrParameter", "type": "scopeType", diff --git a/packages/common/src/scopeSupportFacets/css.ts b/packages/common/src/scopeSupportFacets/css.ts index e79d96aeba..fd7d2c7452 100644 --- a/packages/common/src/scopeSupportFacets/css.ts +++ b/packages/common/src/scopeSupportFacets/css.ts @@ -46,6 +46,12 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.method.iteration": notApplicable, "argument.formal.method": notApplicable, "argument.formal": notApplicable, + "argument.formal.lambda": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "argumentList.formal": notApplicable, + "argumentList.formal.method": notApplicable, + "argumentList.formal.constructor": notApplicable, + "argumentList.formal.lambda": notApplicable, attribute: notApplicable, "branch.if.iteration": notApplicable, "branch.if": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/html.ts b/packages/common/src/scopeSupportFacets/html.ts index 47dde0a787..c87104ff68 100644 --- a/packages/common/src/scopeSupportFacets/html.ts +++ b/packages/common/src/scopeSupportFacets/html.ts @@ -32,6 +32,12 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.method.iteration": notApplicable, "argument.formal.method": notApplicable, "argument.formal": notApplicable, + "argument.formal.lambda": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "argumentList.formal": notApplicable, + "argumentList.formal.method": notApplicable, + "argumentList.formal.constructor": notApplicable, + "argumentList.formal.lambda": notApplicable, "branch.if.iteration": notApplicable, "branch.if": notApplicable, "branch.loop": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/java.ts b/packages/common/src/scopeSupportFacets/java.ts index 8440f990d1..e444156853 100644 --- a/packages/common/src/scopeSupportFacets/java.ts +++ b/packages/common/src/scopeSupportFacets/java.ts @@ -15,12 +15,16 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "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, + "argument.formal.lambda": supported, + "argument.formal.lambda.iteration": supported, + + "argumentList.formal.method": supported, + "argumentList.formal.constructor": supported, + "argumentList.formal.lambda": supported, "collectionItem.unenclosed": supported, "collectionItem.unenclosed.iteration": supported, @@ -138,6 +142,11 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { // Not Applicable + "argument.formal": notApplicable, + "argument.formal.iteration": notApplicable, + + "argumentList.formal": notApplicable, + "name.assignment.pattern": notApplicable, "name.argument.actual": notApplicable, "name.argument.actual.iteration": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index 5bce8eed13..d6a6bfe9d1 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -61,6 +61,13 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.method.iteration": supported, "argument.formal.constructor": supported, "argument.formal.constructor.iteration": supported, + "argument.formal.lambda": supported, + "argument.formal.lambda.iteration": supported, + + "argumentList.formal": supported, + "argumentList.formal.method": supported, + "argumentList.formal.constructor": supported, + "argumentList.formal.lambda": supported, "comment.line": supported, "comment.block": supported, diff --git a/packages/common/src/scopeSupportFacets/json.ts b/packages/common/src/scopeSupportFacets/json.ts index 8089ee0f2d..ac62464842 100644 --- a/packages/common/src/scopeSupportFacets/json.ts +++ b/packages/common/src/scopeSupportFacets/json.ts @@ -36,6 +36,12 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.iteration": notApplicable, "argument.formal.method": notApplicable, "argument.formal.method.iteration": notApplicable, + "argument.formal.lambda": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "argumentList.formal": notApplicable, + "argumentList.formal.method": notApplicable, + "argumentList.formal.constructor": notApplicable, + "argumentList.formal.lambda": notApplicable, attribute: notApplicable, "branch.if": notApplicable, "branch.if.iteration": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/markdown.ts b/packages/common/src/scopeSupportFacets/markdown.ts index 4600a7ab4a..c841d94614 100644 --- a/packages/common/src/scopeSupportFacets/markdown.ts +++ b/packages/common/src/scopeSupportFacets/markdown.ts @@ -36,6 +36,12 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.iteration": notApplicable, "argument.formal.method": notApplicable, "argument.formal.method.iteration": notApplicable, + "argument.formal.lambda": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "argumentList.formal": notApplicable, + "argumentList.formal.method": notApplicable, + "argumentList.formal.constructor": notApplicable, + "argumentList.formal.lambda": notApplicable, attribute: notApplicable, "branch.if": notApplicable, "branch.if.iteration": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index 9673bda4e1..19d57982ff 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -73,6 +73,13 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.constructor.iteration": supported, "argument.formal.method": supported, "argument.formal.method.iteration": supported, + "argument.formal.lambda": supported, + "argument.formal.lambda.iteration": supported, + + "argumentList.formal": supported, + "argumentList.formal.method": supported, + "argumentList.formal.constructor": supported, + "argumentList.formal.lambda": supported, "collectionItem.unenclosed": supported, "collectionItem.unenclosed.iteration": supported, diff --git a/packages/common/src/scopeSupportFacets/scm.ts b/packages/common/src/scopeSupportFacets/scm.ts index f5ade133a0..782986963f 100644 --- a/packages/common/src/scopeSupportFacets/scm.ts +++ b/packages/common/src/scopeSupportFacets/scm.ts @@ -29,6 +29,12 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.iteration": notApplicable, "argument.formal.method": notApplicable, "argument.formal.method.iteration": notApplicable, + "argument.formal.lambda": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "argumentList.formal": notApplicable, + "argumentList.formal.method": notApplicable, + "argumentList.formal.constructor": notApplicable, + "argumentList.formal.lambda": notApplicable, attribute: notApplicable, "branch.if": notApplicable, "branch.if.iteration": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index 59eef32b94..0730be6242 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -271,6 +271,33 @@ export const scopeSupportFacetInfos: Record< scopeType: "argumentOrParameter", isIteration: true, }, + "argument.formal.lambda": { + description: "A parameter in a lambda declaration", + scopeType: "argumentOrParameter", + }, + "argument.formal.lambda.iteration": { + description: + "Iteration scope of the formal parameters of a lambda declaration; should be the whole parameter list. The domain should be the entire function.", + scopeType: "argumentOrParameter", + isIteration: true, + }, + + "argumentList.formal": { + description: "A list of parameters in a function declaration", + scopeType: "argumentList", + }, + "argumentList.formal.method": { + description: "A list of parameters in a class method declaration", + scopeType: "argumentList", + }, + "argumentList.formal.constructor": { + description: "A list of parameters in a constructor declaration", + scopeType: "argumentList", + }, + "argumentList.formal.lambda": { + description: "A list of parameters in a lambda declaration", + scopeType: "argumentList", + }, "comment.line": { description: "A line comment", diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index 3941b09149..b1847c6ff6 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -69,6 +69,13 @@ export const scopeSupportFacets = [ "argument.formal.method.iteration", "argument.formal.constructor", "argument.formal.constructor.iteration", + "argument.formal.lambda", + "argument.formal.lambda.iteration", + + "argumentList.formal", + "argumentList.formal.method", + "argumentList.formal.constructor", + "argumentList.formal.lambda", "comment.line", "comment.block", diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index 39ced3b085..8864d4159e 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -43,6 +43,12 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.iteration": notApplicable, "argument.formal.method": notApplicable, "argument.formal.method.iteration": notApplicable, + "argument.formal.lambda": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "argumentList.formal": notApplicable, + "argumentList.formal.method": notApplicable, + "argumentList.formal.constructor": notApplicable, + "argumentList.formal.lambda": notApplicable, attribute: notApplicable, "branch.if": notApplicable, "branch.if.iteration": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/xml.ts b/packages/common/src/scopeSupportFacets/xml.ts index 8f19d84a63..5830eb01aa 100644 --- a/packages/common/src/scopeSupportFacets/xml.ts +++ b/packages/common/src/scopeSupportFacets/xml.ts @@ -33,6 +33,12 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.iteration": notApplicable, "argument.formal.method": notApplicable, "argument.formal.method.iteration": notApplicable, + "argument.formal.lambda": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "argumentList.formal": notApplicable, + "argumentList.formal.method": notApplicable, + "argumentList.formal.constructor": notApplicable, + "argumentList.formal.lambda": notApplicable, "branch.if": notApplicable, "branch.if.iteration": notApplicable, "branch.loop": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/yaml.ts b/packages/common/src/scopeSupportFacets/yaml.ts index d12ba86b94..737fc5b416 100644 --- a/packages/common/src/scopeSupportFacets/yaml.ts +++ b/packages/common/src/scopeSupportFacets/yaml.ts @@ -42,6 +42,12 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.iteration": notApplicable, "argument.formal.method": notApplicable, "argument.formal.method.iteration": notApplicable, + "argument.formal.lambda": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "argumentList.formal": notApplicable, + "argumentList.formal.method": notApplicable, + "argumentList.formal.constructor": notApplicable, + "argumentList.formal.lambda": notApplicable, attribute: notApplicable, "branch.if": notApplicable, "branch.if.iteration": notApplicable, diff --git a/packages/common/src/types/command/PartialTargetDescriptor.types.ts b/packages/common/src/types/command/PartialTargetDescriptor.types.ts index 8ee0a2ed3c..ef59a14e1c 100644 --- a/packages/common/src/types/command/PartialTargetDescriptor.types.ts +++ b/packages/common/src/types/command/PartialTargetDescriptor.types.ts @@ -141,6 +141,7 @@ export type SurroundingPairName = export const simpleScopeTypeTypes = [ "argumentOrParameter", + "argumentList", "anonymousFunction", "attribute", "branch", diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/queryPredicateOperators.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/queryPredicateOperators.ts index bf80bb9be2..80f689c840 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/queryPredicateOperators.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/queryPredicateOperators.ts @@ -318,6 +318,42 @@ class SingleOrMultilineDelimiter extends QueryPredicateOperator { + name = "empty-single-multi-delimiter!" as const; + schema = z.tuple([q.node, q.node, q.string, q.string, q.string]); + + run( + nodeInfo: MutableQueryCapture, + conditionNodeInfo: MutableQueryCapture, + insertionDelimiterEmpty: string, + insertionDelimiterSingleLine: string, + insertionDelimiterMultiline: string, + ) { + const isEmpty = !conditionNodeInfo.node.children.some( + (child) => child.isNamed, + ); + + nodeInfo.insertionDelimiter = isEmpty + ? insertionDelimiterEmpty + : conditionNodeInfo.range.isSingleLine + ? insertionDelimiterSingleLine + : insertionDelimiterMultiline; + + return true; + } +} + export const queryPredicateOperators = [ new Log(), new NotType(), @@ -331,5 +367,6 @@ export const queryPredicateOperators = [ new AllowMultiple(), new InsertionDelimiter(), new SingleOrMultilineDelimiter(), + new EmptySingleMultiDelimiter(), new HasMultipleChildrenOfType(), ]; diff --git a/packages/cursorless-engine/src/scopeProviders/ScopeInfoProvider.ts b/packages/cursorless-engine/src/scopeProviders/ScopeInfoProvider.ts index 4ca19be2c2..5815fc5fc2 100644 --- a/packages/cursorless-engine/src/scopeProviders/ScopeInfoProvider.ts +++ b/packages/cursorless-engine/src/scopeProviders/ScopeInfoProvider.ts @@ -111,6 +111,7 @@ function isLanguageSpecific(scopeType: ScopeType): boolean { switch (scopeType.type) { case "string": case "argumentOrParameter": + case "argumentList": case "anonymousFunction": case "attribute": case "branch": diff --git a/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts b/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts index a790304c57..5cc5e677ee 100644 --- a/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts +++ b/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts @@ -40,6 +40,7 @@ export const defaultSpokenFormMapCore: DefaultSpokenFormMapDefinition = { simpleScopeTypeType: { argumentOrParameter: "arg", + argumentList: "arg list", attribute: "attribute", functionCall: "call", functionCallee: "callee", diff --git a/queries/java.scm b/queries/java.scm index 7650d05ee1..18e4b849c4 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -497,8 +497,8 @@ ) ;;!! foo(name: string) {} ;;! ^^^^^^^^^^^^ -( - (formal_parameters +(_ + parameters: (_ (_)? @_.leading.endOf . (_) @argumentOrParameter @@ -524,11 +524,12 @@ ) (_ - (formal_parameters - "(" @argumentOrParameter.iteration.start.endOf - ")" @argumentOrParameter.iteration.end.startOf - ) -) @argumentOrParameter.iteration.domain + parameters: (_ + "(" @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 (argument_list "(" @argumentOrParameter.iteration.start.endOf diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index d4ce227e94..5e8f312847 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -764,10 +764,11 @@ (_ (formal_parameters - "(" @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 (arguments "(" @argumentOrParameter.iteration.start.endOf diff --git a/queries/python.scm b/queries/python.scm index 396d492949..39bec07d4f 100644 --- a/queries/python.scm +++ b/queries/python.scm @@ -605,8 +605,8 @@ ;;!! def foo(name) {} ;;! ^^^^ -( - (parameters +(_ + parameters: (_ (_)? @_.leading.endOf . (_) @argumentOrParameter @@ -644,12 +644,31 @@ ) ) +;;!! lambda a, b: pass +;;! ^^^^ +(lambda + (lambda_parameters) @argumentList @argumentOrParameter.iteration + (#insertion-delimiter! @argumentList ", ") +) @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! lambda: pass +(lambda + . + "lambda" @argumentList.start.endOf + . + ":" + (#insertion-delimiter! @argumentList.start.endOf " ") +) @argumentList.domain + +;;!! def (a, b): pass +;;! ^^^^ (_ (parameters - "(" @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 (argument_list "(" @argumentOrParameter.iteration.start.endOf @name.iteration.start.endOf @value.iteration.start.endOf