diff --git a/data/fixtures/scopes/javascript.core/branch.loop.scope b/data/fixtures/scopes/javascript.core/branch.loop.scope new file mode 100644 index 0000000000..2309add85a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/branch.loop.scope @@ -0,0 +1,10 @@ +for (let i = 0; i < size; ++i) { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:34 + >----------------------------------< +0| for (let i = 0; i < size; ++i) { } + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/branch.loop2.scope b/data/fixtures/scopes/javascript.core/branch.loop2.scope new file mode 100644 index 0000000000..23da216aa5 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/branch.loop2.scope @@ -0,0 +1,10 @@ +for (const v of values) { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:27 + >---------------------------< +0| for (const v of values) { } + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/branch.loop3.scope b/data/fixtures/scopes/javascript.core/branch.loop3.scope new file mode 100644 index 0000000000..5beb4d4731 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/branch.loop3.scope @@ -0,0 +1,10 @@ +while(true) { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:15 + >---------------< +0| while(true) { } + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/branch.loop4.scope b/data/fixtures/scopes/javascript.core/branch.loop4.scope new file mode 100644 index 0000000000..25f6d347bf --- /dev/null +++ b/data/fixtures/scopes/javascript.core/branch.loop4.scope @@ -0,0 +1,10 @@ +do { } while(true); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:19 + >-------------------< +0| do { } while(true); + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/class.iteration.document.scope b/data/fixtures/scopes/javascript.core/class.iteration.document.scope new file mode 100644 index 0000000000..4d43b4a22a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/class.iteration.document.scope @@ -0,0 +1,8 @@ + +class MyClass { } +--- + +[Range] = +[Domain] = 1:0-1:17 + >-----------------< +1| class MyClass { } diff --git a/data/fixtures/scopes/javascript.core/class.scope b/data/fixtures/scopes/javascript.core/class.scope index 9b0eef7978..e6a25b8f55 100644 --- a/data/fixtures/scopes/javascript.core/class.scope +++ b/data/fixtures/scopes/javascript.core/class.scope @@ -1,15 +1,10 @@ -class MyClass { - -} +class MyClass { } --- [Content] = [Removal] = -[Domain] = 0:0-2:1 - >--------------- -0| class MyClass { -1| -2| } - -< +[Domain] = 0:0-0:17 + >-----------------< +0| class MyClass { } [Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/javascript.core/class2.scope b/data/fixtures/scopes/javascript.core/class2.scope new file mode 100644 index 0000000000..cb0026603b --- /dev/null +++ b/data/fixtures/scopes/javascript.core/class2.scope @@ -0,0 +1,10 @@ +export default class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:32 + >--------------------------------< +0| export default class MyClass { } + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/javascript.core/class3.scope b/data/fixtures/scopes/javascript.core/class3.scope new file mode 100644 index 0000000000..aa5deaa1e1 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/class3.scope @@ -0,0 +1,10 @@ +export class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:24 + >------------------------< +0| export class MyClass { } + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/javascript.core/className.iteration.document.scope b/data/fixtures/scopes/javascript.core/className.iteration.document.scope new file mode 100644 index 0000000000..4d43b4a22a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/className.iteration.document.scope @@ -0,0 +1,8 @@ + +class MyClass { } +--- + +[Range] = +[Domain] = 1:0-1:17 + >-----------------< +1| class MyClass { } diff --git a/data/fixtures/scopes/javascript.core/collectionItem.unenclosed.iteration.scope b/data/fixtures/scopes/javascript.core/collectionItem.unenclosed.iteration.scope new file mode 100644 index 0000000000..a38a824b04 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/collectionItem.unenclosed.iteration.scope @@ -0,0 +1,10 @@ +let foo, bar; +--- + +[Range] = 0:4-0:12 + >--------< +0| let foo, bar; + +[Domain] = 0:0-0:13 + >-------------< +0| let foo, bar; diff --git a/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope b/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope index 648d870dd9..6f6128c677 100644 --- a/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope +++ b/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope @@ -3,10 +3,19 @@ class MyClass { } --- -[Range] = -[Domain] = 0:0-2:1 +[#1 Range] = +[#1 Domain] = 0:0-2:1 >--------------- 0| class MyClass { 1| myFunk() { } 2| } -< + + +[#2 Range] = +[#2 Domain] = 0:15-2:0 + > +0| class MyClass { +1| myFunk() { } +2| } + < diff --git a/data/fixtures/scopes/javascript.core/name.argument.formal.constructor.iteration.scope b/data/fixtures/scopes/javascript.core/name.argument.formal.constructor.iteration.scope index f0580a308c..00821cfe98 100644 --- a/data/fixtures/scopes/javascript.core/name.argument.formal.constructor.iteration.scope +++ b/data/fixtures/scopes/javascript.core/name.argument.formal.constructor.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:13-1:23 - >----------< +[#3 Domain] = 1:14-1:22 + >--------< 1| constructor(aaa, bbb) { } diff --git a/data/fixtures/scopes/javascript.core/name.argument.formal.iteration.scope b/data/fixtures/scopes/javascript.core/name.argument.formal.iteration.scope index 5102ca8933..73848e31b8 100644 --- a/data/fixtures/scopes/javascript.core/name.argument.formal.iteration.scope +++ b/data/fixtures/scopes/javascript.core/name.argument.formal.iteration.scope @@ -8,8 +8,8 @@ function myFunk(aaa, bbb) { } [#2 Range] = -[#2 Domain] = 0:15-0:25 - >----------< +[#2 Domain] = 0:16-0:24 + >--------< 0| function myFunk(aaa, bbb) { } diff --git a/data/fixtures/scopes/javascript.core/name.argument.formal.method.iteration.scope b/data/fixtures/scopes/javascript.core/name.argument.formal.method.iteration.scope index 1fc255002e..4291e12396 100644 --- a/data/fixtures/scopes/javascript.core/name.argument.formal.method.iteration.scope +++ b/data/fixtures/scopes/javascript.core/name.argument.formal.method.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:8-1:18 - >----------< +[#3 Domain] = 1:9-1:17 + >--------< 1| myFunk(aaa, bbb) { } diff --git a/data/fixtures/scopes/javascript.core/name.iteration.block.scope b/data/fixtures/scopes/javascript.core/name.iteration.block.scope new file mode 100644 index 0000000000..e1eb393319 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/name.iteration.block.scope @@ -0,0 +1,33 @@ +class MyClass { + myFunk() { } +} +--- + +[#1 Range] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| myFunk() { } +2| } + -< + + +[#2 Range] = +[#2 Domain] = 0:15-2:0 + > +0| class MyClass { +1| myFunk() { } +2| } + < + + +[#3 Range] = +[#3 Domain] = 1:11-1:11 + >< +1| myFunk() { } + + +[#4 Range] = +[#4 Domain] = 1:14-1:15 + >-< +1| myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/name.iteration.block2.scope b/data/fixtures/scopes/javascript.core/name.iteration.block2.scope new file mode 100644 index 0000000000..3cac5d8be0 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/name.iteration.block2.scope @@ -0,0 +1,19 @@ +function myFunk() { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:21 + >---------------------< +0| function myFunk() { } + + +[#2 Range] = +[#2 Domain] = 0:16-0:16 + >< +0| function myFunk() { } + + +[#3 Range] = +[#3 Domain] = 0:19-0:20 + >-< +0| function myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/name.iteration.block4.scope b/data/fixtures/scopes/javascript.core/name.iteration.block4.scope new file mode 100644 index 0000000000..e38a055e01 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/name.iteration.block4.scope @@ -0,0 +1,13 @@ +while (true) { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:16 + >----------------< +0| while (true) { } + + +[#2 Range] = +[#2 Domain] = 0:14-0:15 + >-< +0| while (true) { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope b/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope index 648d870dd9..6f6128c677 100644 --- a/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope +++ b/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope @@ -3,10 +3,19 @@ class MyClass { } --- -[Range] = -[Domain] = 0:0-2:1 +[#1 Range] = +[#1 Domain] = 0:0-2:1 >--------------- 0| class MyClass { 1| myFunk() { } 2| } -< + + +[#2 Range] = +[#2 Domain] = 0:15-2:0 + > +0| class MyClass { +1| myFunk() { } +2| } + < diff --git a/data/fixtures/scopes/javascript.core/type.class.scope b/data/fixtures/scopes/javascript.core/type.class.scope new file mode 100644 index 0000000000..696dd5c641 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/type.class.scope @@ -0,0 +1,10 @@ +class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:17 + >-----------------< +0| class MyClass { } + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/value.argument.formal.constructor.iteration.scope b/data/fixtures/scopes/javascript.core/value.argument.formal.constructor.iteration.scope index 88ee3edd50..9b4a8f20b3 100644 --- a/data/fixtures/scopes/javascript.core/value.argument.formal.constructor.iteration.scope +++ b/data/fixtures/scopes/javascript.core/value.argument.formal.constructor.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:13-1:31 - >------------------< +[#3 Domain] = 1:14-1:30 + >----------------< 1| constructor(aaa = 0, bbb = 1) { } diff --git a/data/fixtures/scopes/javascript.core/value.argument.formal.iteration.scope b/data/fixtures/scopes/javascript.core/value.argument.formal.iteration.scope index 7f7efb4795..695b1da909 100644 --- a/data/fixtures/scopes/javascript.core/value.argument.formal.iteration.scope +++ b/data/fixtures/scopes/javascript.core/value.argument.formal.iteration.scope @@ -8,8 +8,8 @@ function myFunk(aaa = 0, bbb = 1) { } [#2 Range] = -[#2 Domain] = 0:15-0:33 - >------------------< +[#2 Domain] = 0:16-0:32 + >----------------< 0| function myFunk(aaa = 0, bbb = 1) { } diff --git a/data/fixtures/scopes/javascript.core/value.argument.formal.method.iteration.scope b/data/fixtures/scopes/javascript.core/value.argument.formal.method.iteration.scope index 894ada642a..c6fe878286 100644 --- a/data/fixtures/scopes/javascript.core/value.argument.formal.method.iteration.scope +++ b/data/fixtures/scopes/javascript.core/value.argument.formal.method.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:8-1:26 - >------------------< +[#3 Domain] = 1:9-1:25 + >----------------< 1| myFunk(aaa = 0, bbb = 1) { } diff --git a/data/fixtures/scopes/typescript.core/class.scope b/data/fixtures/scopes/typescript.core/class.scope new file mode 100644 index 0000000000..c68e199ef9 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/class.scope @@ -0,0 +1,10 @@ +abstract class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:26 + >--------------------------< +0| abstract class MyClass { } + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/typescript.core/class2.scope b/data/fixtures/scopes/typescript.core/class2.scope new file mode 100644 index 0000000000..5b46f476c7 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/class2.scope @@ -0,0 +1,10 @@ +export default abstract class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:41 + >-----------------------------------------< +0| export default abstract class MyClass { } + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/typescript.core/class3.scope b/data/fixtures/scopes/typescript.core/class3.scope new file mode 100644 index 0000000000..104ca4a34f --- /dev/null +++ b/data/fixtures/scopes/typescript.core/class3.scope @@ -0,0 +1,10 @@ +export abstract class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:33 + >---------------------------------< +0| export abstract class MyClass { } + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.iteration.scope b/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.iteration.scope index 5f18a0f3fe..ee1db1a57c 100644 --- a/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.iteration.scope +++ b/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:13-1:28 - >---------------< +[#3 Domain] = 1:14-1:27 + >-------------< 1| constructor(value: number) { } diff --git a/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.scope b/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.scope index af2d709f74..105bedcb56 100644 --- a/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.scope +++ b/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.scope @@ -3,20 +3,32 @@ class MyClass { } --- -[Content] = 1:21-1:27 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| constructor(value: number) { } +2| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:21-1:27 >------< 1| constructor(value: number) { } -[Removal] = 1:19-1:27 +[#2 Removal] = 1:19-1:27 >--------< 1| constructor(value: number) { } -[Leading delimiter] = 1:19-1:21 +[#2 Leading delimiter] = 1:19-1:21 >--< 1| constructor(value: number) { } -[Domain] = 1:14-1:27 +[#2 Domain] = 1:14-1:27 >-------------< 1| constructor(value: number) { } -[Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/type.argument.formal.iteration.scope b/data/fixtures/scopes/typescript.core/type.argument.formal.iteration.scope index fda6c7495f..92ab7d8a14 100644 --- a/data/fixtures/scopes/typescript.core/type.argument.formal.iteration.scope +++ b/data/fixtures/scopes/typescript.core/type.argument.formal.iteration.scope @@ -8,8 +8,8 @@ function myFunk(value: number) { } [#2 Range] = -[#2 Domain] = 0:15-0:30 - >---------------< +[#2 Domain] = 0:16-0:29 + >-------------< 0| function myFunk(value: number) { } diff --git a/data/fixtures/scopes/typescript.core/type.argument.formal.method.iteration.scope b/data/fixtures/scopes/typescript.core/type.argument.formal.method.iteration.scope index 08ac6944fb..37197136f8 100644 --- a/data/fixtures/scopes/typescript.core/type.argument.formal.method.iteration.scope +++ b/data/fixtures/scopes/typescript.core/type.argument.formal.method.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:8-1:23 - >---------------< +[#3 Domain] = 1:9-1:22 + >-------------< 1| myFunk(value: number) { } diff --git a/data/fixtures/scopes/typescript.core/type.argument.formal.method.scope b/data/fixtures/scopes/typescript.core/type.argument.formal.method.scope index e81e0e5d59..417343e4f3 100644 --- a/data/fixtures/scopes/typescript.core/type.argument.formal.method.scope +++ b/data/fixtures/scopes/typescript.core/type.argument.formal.method.scope @@ -3,20 +3,32 @@ class MyClass { } --- -[Content] = 1:16-1:22 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| myFunk(value: number) { } +2| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:16-1:22 >------< 1| myFunk(value: number) { } -[Removal] = 1:14-1:22 +[#2 Removal] = 1:14-1:22 >--------< 1| myFunk(value: number) { } -[Leading delimiter] = 1:14-1:16 +[#2 Leading delimiter] = 1:14-1:16 >--< 1| myFunk(value: number) { } -[Domain] = 1:9-1:22 +[#2 Domain] = 1:9-1:22 >-------------< 1| myFunk(value: number) { } -[Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/type.class.scope b/data/fixtures/scopes/typescript.core/type.class.scope new file mode 100644 index 0000000000..3ccc5da772 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/type.class.scope @@ -0,0 +1,10 @@ +abstract class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:26 + >--------------------------< +0| abstract class MyClass { } + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/type.field.iteration.scope b/data/fixtures/scopes/typescript.core/type.field.iteration.scope new file mode 100644 index 0000000000..a9bd7ec26f --- /dev/null +++ b/data/fixtures/scopes/typescript.core/type.field.iteration.scope @@ -0,0 +1,13 @@ +class MyClass { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:17 + >-----------------< +0| class MyClass { } + + +[#2 Range] = +[#2 Domain] = 0:15-0:16 + >-< +0| class MyClass { } diff --git a/data/fixtures/scopes/typescript.core/type.field.scope b/data/fixtures/scopes/typescript.core/type.field.scope index e2ec66651e..76b55f00ea 100644 --- a/data/fixtures/scopes/typescript.core/type.field.scope +++ b/data/fixtures/scopes/typescript.core/type.field.scope @@ -7,96 +7,112 @@ class Aaa { } --- -[#1 Content] = 1:10-1:16 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-6:1 + >----------- +0| class Aaa { +1| bbb!: string = undefined; +2| ccc: string = undefined; +3| private eee!: string = undefined; +4| eee: string; +5| fff!: string; +6| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:10-1:16 >------< 1| bbb!: string = undefined; -[#1 Removal] = 1:7-1:16 +[#2 Removal] = 1:7-1:16 >---------< 1| bbb!: string = undefined; -[#1 Leading delimiter] = 1:7-1:10 +[#2 Leading delimiter] = 1:7-1:10 >---< 1| bbb!: string = undefined; -[#1 Domain] = 1:4-1:29 +[#2 Domain] = 1:4-1:29 >-------------------------< 1| bbb!: string = undefined; -[#1 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#2 Content] = 2:9-2:15 +[#3 Content] = 2:9-2:15 >------< 2| ccc: string = undefined; -[#2 Removal] = 2:7-2:15 +[#3 Removal] = 2:7-2:15 >--------< 2| ccc: string = undefined; -[#2 Leading delimiter] = 2:7-2:9 +[#3 Leading delimiter] = 2:7-2:9 >--< 2| ccc: string = undefined; -[#2 Domain] = 2:4-2:28 +[#3 Domain] = 2:4-2:28 >------------------------< 2| ccc: string = undefined; -[#2 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " -[#3 Content] = 3:18-3:24 +[#4 Content] = 3:18-3:24 >------< 3| private eee!: string = undefined; -[#3 Removal] = 3:15-3:24 +[#4 Removal] = 3:15-3:24 >---------< 3| private eee!: string = undefined; -[#3 Leading delimiter] = 3:15-3:18 +[#4 Leading delimiter] = 3:15-3:18 >---< 3| private eee!: string = undefined; -[#3 Domain] = 3:4-3:37 +[#4 Domain] = 3:4-3:37 >---------------------------------< 3| private eee!: string = undefined; -[#3 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " -[#4 Content] = 4:9-4:15 +[#5 Content] = 4:9-4:15 >------< 4| eee: string; -[#4 Removal] = 4:7-4:15 +[#5 Removal] = 4:7-4:15 >--------< 4| eee: string; -[#4 Leading delimiter] = 4:7-4:9 +[#5 Leading delimiter] = 4:7-4:9 >--< 4| eee: string; -[#4 Domain] = 4:4-4:16 +[#5 Domain] = 4:4-4:16 >------------< 4| eee: string; -[#4 Insertion delimiter] = " " +[#5 Insertion delimiter] = " " -[#5 Content] = 5:10-5:16 +[#6 Content] = 5:10-5:16 >------< 5| fff!: string; -[#5 Removal] = 5:7-5:16 +[#6 Removal] = 5:7-5:16 >---------< 5| fff!: string; -[#5 Leading delimiter] = 5:7-5:10 +[#6 Leading delimiter] = 5:7-5:10 >---< 5| fff!: string; -[#5 Domain] = 5:4-5:17 +[#6 Domain] = 5:4-5:17 >-------------< 5| fff!: string; -[#5 Insertion delimiter] = " " +[#6 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/type.typeArgument.iteration.scope b/data/fixtures/scopes/typescript.core/type.typeArgument.iteration.scope new file mode 100644 index 0000000000..11833db77c --- /dev/null +++ b/data/fixtures/scopes/typescript.core/type.typeArgument.iteration.scope @@ -0,0 +1,13 @@ +let value: Map; +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:31 + >-------------------------------< +0| let value: Map; + + +[#2 Range] = +[#2 Domain] = 0:15-0:29 + >--------------< +0| let value: Map; diff --git a/data/fixtures/scopes/typescript.core/type.typeArgument.scope b/data/fixtures/scopes/typescript.core/type.typeArgument.scope new file mode 100644 index 0000000000..af00e8f116 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/type.typeArgument.scope @@ -0,0 +1,45 @@ +let value: Map; +--- + +[#1 Content] = 0:11-0:30 + >-------------------< +0| let value: Map; + +[#1 Removal] = 0:9-0:30 + >---------------------< +0| let value: Map; + +[#1 Leading delimiter] = 0:10-0:11 + >-< +0| let value: Map; + +[#1 Domain] = 0:0-0:31 + >-------------------------------< +0| let value: Map; + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 0:15-0:21 + >------< +0| let value: Map; + +[#2 Insertion delimiter] = " " + + +[#3 Content] = +[#3 Domain] = 0:23-0:29 + >------< +0| let value: Map; + +[#3 Removal] = 0:22-0:29 + >-------< +0| let value: Map; + +[#3 Leading delimiter] = 0:22-0:23 + >-< +0| let value: Map; + +[#3 Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index 5bce8eed13..636f717e98 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -14,6 +14,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { pairDelimiter: supported, "collectionItem.unenclosed": supported, + "collectionItem.unenclosed.iteration": supported, "textFragment.string.singleLine": supported, "textFragment.string.multiLine": supported, @@ -28,7 +29,10 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "statement.class": supported, class: supported, + "class.iteration.document": supported, + className: supported, + "className.iteration.document": supported, anonymousFunction: supported, @@ -75,6 +79,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "branch.switchCase": supported, "branch.switchCase.iteration": supported, "branch.ternary": supported, + "branch.loop": supported, "condition.if": supported, "condition.while": supported, @@ -101,6 +106,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "name.class": supported, "name.field": supported, "name.iteration.document": supported, + "name.iteration.block": supported, "key.mapPair": supported, "key.mapPair.iteration": supported, @@ -122,24 +128,9 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "value.field": supported, "value.yield": supported, - // Unsupported - - "collectionItem.unenclosed.iteration": unsupported, - "branch.loop": unsupported, - "namedFunction.iteration.block": unsupported, - "functionName.iteration.block": unsupported, - - "class.iteration.block": unsupported, - "class.iteration.document": unsupported, - "className.iteration.block": unsupported, - "className.iteration.document": unsupported, - - "name.iteration.block": unsupported, - "name.resource": unsupported, - "name.resource.iteration": unsupported, + "type.class": supported, - "value.resource": unsupported, - "value.resource.iteration": unsupported, + // Unsupported "interior.class": unsupported, "interior.function": unsupported, @@ -149,19 +140,29 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "interior.switchCase": unsupported, "interior.ternary": unsupported, "interior.try": unsupported, - "interior.resource": unsupported, // Not applicable + "class.iteration.block": notApplicable, + "className.iteration.block": notApplicable, + "functionName.iteration.block": notApplicable, "interior.cell": notApplicable, "interior.command": notApplicable, + "interior.resource": notApplicable, "name.argument.actual.iteration": notApplicable, "name.argument.actual": notApplicable, - "value.argument.actual": notApplicable, - "value.argument.actual.iteration": notApplicable, + "name.resource.iteration": notApplicable, + "name.resource": notApplicable, + "namedFunction.iteration.block": notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, "textFragment.element": notApplicable, + "type.resource.iteration": notApplicable, + "type.resource": notApplicable, + "value.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.resource.iteration": notApplicable, + "value.resource": notApplicable, command: notApplicable, environment: notApplicable, notebookCell: notApplicable, @@ -194,7 +195,6 @@ export const javascriptScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method": notApplicable, "type.argument.formal": notApplicable, "type.cast": notApplicable, - "type.class": notApplicable, "type.enum": notApplicable, "type.field.iteration": notApplicable, "type.field": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/typescript.ts b/packages/common/src/scopeSupportFacets/typescript.ts index 9e259a71b1..58001edb3c 100644 --- a/packages/common/src/scopeSupportFacets/typescript.ts +++ b/packages/common/src/scopeSupportFacets/typescript.ts @@ -2,7 +2,7 @@ import { javascriptCoreScopeSupport } from "./javascript"; import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types"; import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types"; -const { supported } = ScopeSupportFacetLevel; +const { supported, notApplicable } = ScopeSupportFacetLevel; export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { ...javascriptCoreScopeSupport, @@ -16,10 +16,25 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { "type.alias": supported, "type.cast": supported, "type.field": supported, + "type.field.iteration": supported, "type.interface": supported, "type.enum": supported, "type.return": supported, "type.variable": supported, + "type.typeArgument": supported, + "type.typeArgument.iteration": supported, "value.typeAlias": supported, + + // Not applicable + + element: notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + attribute: notApplicable, + "key.attribute": notApplicable, + "value.attribute": notApplicable, + "type.foreach": notApplicable, + "interior.element": notApplicable, }; diff --git a/queries/java.scm b/queries/java.scm index 7650d05ee1..10de4ea448 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -495,6 +495,7 @@ ">" @type.iteration.end.startOf . ) + ;;!! foo(name: string) {} ;;! ^^^^^^^^^^^^ ( diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index d4ce227e94..189642047d 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -286,6 +286,13 @@ (#insertion-delimiter! @collectionItem ", ") ) +(lexical_declaration + . + (_) @collectionItem.iteration.start.startOf + (_) @collectionItem.iteration.end.endOf + . +) @collectionItem.iteration.domain + (expression_statement [ ;; name: @@ -415,10 +422,7 @@ right: (_) @value ) @_.domain -[ - (program) - (formal_parameters) -] @name.iteration @value.iteration @type.iteration +(program) @name.iteration @value.iteration @type.iteration ;; Treat interior of all bodies as iteration scopes for `name`, eg ;;!! function foo() { } @@ -547,7 +551,7 @@ (class name: (_) @className ) - ] @class @_.domain + ] @class @type @_.domain (#not-parent-type? @class export_statement) ) @@ -562,7 +566,9 @@ name: (_) @className ) ] -) @class @_.domain +) @class @type @_.domain + +(program) @class.iteration @className.iteration ;;!! true ? 0 : 1; ;;! ^^^^ @@ -678,6 +684,13 @@ ;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (try_statement) @branch.iteration +[ + (for_statement) + (for_in_statement) + (while_statement) + (do_statement) +] @branch + ;;!! { value: 0 } ;;! ^^^^^ ;;! xxxxxxx @@ -769,6 +782,11 @@ ) ) @argumentOrParameter.iteration.domain +(formal_parameters + "(" @name.iteration.start.endOf @value.iteration.start.endOf @type.iteration.start.endOf + ")" @name.iteration.end.startOf @value.iteration.end.startOf @type.iteration.end.startOf +) + (arguments "(" @argumentOrParameter.iteration.start.endOf ")" @argumentOrParameter.iteration.end.startOf diff --git a/queries/javascript.function.scm b/queries/javascript.function.scm index 71d32e00f3..1253d4979d 100644 --- a/queries/javascript.function.scm +++ b/queries/javascript.function.scm @@ -166,6 +166,13 @@ ) ] @namedFunction.iteration @functionName.iteration +(class_body + . + "{" @namedFunction.iteration.start.endOf @functionName.iteration.start.endOf + "}" @namedFunction.iteration.end.startOf @functionName.iteration.end.startOf + . +) + ;;!! { funk: function() { } } ;;! ^^^^ (pair diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index fa655fe672..382572ac0d 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -335,7 +335,7 @@ ( (abstract_class_declaration name: (_) @className - ) @class @_.domain + ) @class @type @_.domain (#not-parent-type? @class export_statement) ) @@ -345,7 +345,7 @@ (abstract_class_declaration name: (_) @className ) -) @class @_.domain +) @class @type @_.domain ;;!! class MyClass {} ;;! ^^^^^^^ @@ -405,3 +405,33 @@ (function_type "=>" @disqualifyDelimiter ) + +;;!! class Aaa { } +;;! ^ +(class_body + . + "{" @type.iteration.start.endOf + "}" @type.iteration.end.startOf + . +) + +;;!! Map +;;! ^^^^^^ ^^^^^^ +( + (type_arguments + (_) @type + ) @_dummy + (#not-parent-type? @_dummy type_assertion) +) + +;;!! Map +;;! ^^^^^^^^^^^^^^ +( + (type_arguments + . + "<" @type.iteration.start.endOf + ">" @type.iteration.end.startOf + . + ) @_dummy + (#not-parent-type? @_dummy type_assertion) +)