diff --git a/data/fixtures/scopes/c/interior/interior.class5.scope b/data/fixtures/scopes/c/interior/interior.class5.scope deleted file mode 100644 index 6a02da0db7..0000000000 --- a/data/fixtures/scopes/c/interior/interior.class5.scope +++ /dev/null @@ -1,31 +0,0 @@ -enum ccc { ddd, eee }; ---- - -[#1 Content] = 0:11-0:19 - >--------< -0| enum ccc { ddd, eee }; - -[#1 Removal] = 0:10-0:20 - >----------< -0| enum ccc { ddd, eee }; - -[#1 Domain] = 0:0-0:22 - >----------------------< -0| enum ccc { ddd, eee }; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 0:11-0:19 - >--------< -0| enum ccc { ddd, eee }; - -[#2 Removal] = 0:10-0:20 - >----------< -0| enum ccc { ddd, eee }; - -[#2 Domain] = 0:9-0:21 - >------------< -0| enum ccc { ddd, eee }; - -[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.class6.scope b/data/fixtures/scopes/c/interior/interior.class6.scope deleted file mode 100644 index e350fb3791..0000000000 --- a/data/fixtures/scopes/c/interior/interior.class6.scope +++ /dev/null @@ -1,31 +0,0 @@ -typedef enum { jjj, kkk } lll; ---- - -[#1 Content] = 0:15-0:23 - >--------< -0| typedef enum { jjj, kkk } lll; - -[#1 Removal] = 0:14-0:24 - >----------< -0| typedef enum { jjj, kkk } lll; - -[#1 Domain] = 0:0-0:30 - >------------------------------< -0| typedef enum { jjj, kkk } lll; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 0:15-0:23 - >--------< -0| typedef enum { jjj, kkk } lll; - -[#2 Removal] = 0:14-0:24 - >----------< -0| typedef enum { jjj, kkk } lll; - -[#2 Domain] = 0:13-0:25 - >------------< -0| typedef enum { jjj, kkk } lll; - -[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.enum.scope b/data/fixtures/scopes/c/interior/interior.enum.scope new file mode 100644 index 0000000000..235154efaf --- /dev/null +++ b/data/fixtures/scopes/c/interior/interior.enum.scope @@ -0,0 +1,25 @@ +enum Foo { }; +--- + +[#1 Content] = +[#1 Removal] = 0:10-0:11 + >-< +0| enum Foo { }; + +[#1 Domain] = 0:0-0:13 + >-------------< +0| enum Foo { }; + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 0:10-0:11 + >-< +0| enum Foo { }; + +[#2 Domain] = 0:9-0:12 + >---< +0| enum Foo { }; + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.enum2.scope b/data/fixtures/scopes/c/interior/interior.enum2.scope new file mode 100644 index 0000000000..d939ad36f1 --- /dev/null +++ b/data/fixtures/scopes/c/interior/interior.enum2.scope @@ -0,0 +1,25 @@ +typedef enum { } Foo; +--- + +[#1 Content] = +[#1 Removal] = 0:14-0:15 + >-< +0| typedef enum { } Foo; + +[#1 Domain] = 0:0-0:21 + >---------------------< +0| typedef enum { } Foo; + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 0:14-0:15 + >-< +0| typedef enum { } Foo; + +[#2 Domain] = 0:13-0:16 + >---< +0| typedef enum { } Foo; + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/name/name.enum.scope b/data/fixtures/scopes/c/name/name.enum.scope new file mode 100644 index 0000000000..cde4791988 --- /dev/null +++ b/data/fixtures/scopes/c/name/name.enum.scope @@ -0,0 +1,24 @@ +enum Foo {}; +--- + +[Content] = 0:5-0:8 + >---< +0| enum Foo {}; + +[Removal] = 0:5-0:9 + >----< +0| enum Foo {}; + +[Leading delimiter] = 0:4-0:5 + >-< +0| enum Foo {}; + +[Trailing delimiter] = 0:8-0:9 + >-< +0| enum Foo {}; + +[Domain] = 0:0-0:12 + >------------< +0| enum Foo {}; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/name/name.enum2.scope b/data/fixtures/scopes/c/name/name.enum2.scope new file mode 100644 index 0000000000..bc6aa501ba --- /dev/null +++ b/data/fixtures/scopes/c/name/name.enum2.scope @@ -0,0 +1,20 @@ +typedef enum {} Foo; +--- + +[Content] = 0:16-0:19 + >---< +0| typedef enum {} Foo; + +[Removal] = 0:15-0:19 + >----< +0| typedef enum {} Foo; + +[Leading delimiter] = 0:15-0:16 + >-< +0| typedef enum {} Foo; + +[Domain] = 0:0-0:20 + >--------------------< +0| typedef enum {} Foo; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/name/name.field.enum.scope b/data/fixtures/scopes/c/name/name.field.enum.scope new file mode 100644 index 0000000000..be33789056 --- /dev/null +++ b/data/fixtures/scopes/c/name/name.field.enum.scope @@ -0,0 +1,97 @@ +enum Foo { + bar = 0, + baz = 1, + bongo +} +--- + +[#1 Content] = 0:5-0:8 + >---< +0| enum Foo { + +[#1 Removal] = 0:5-0:9 + >----< +0| enum Foo { + +[#1 Leading delimiter] = 0:4-0:5 + >-< +0| enum Foo { + +[#1 Trailing delimiter] = 0:8-0:9 + >-< +0| enum Foo { + +[#1 Domain] = 0:0-4:1 + >---------- +0| enum Foo { +1| bar = 0, +2| baz = 1, +3| bongo +4| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:4-1:7 + >---< +1| bar = 0, + +[#2 Removal] = 1:4-1:8 + >----< +1| bar = 0, + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| bar = 0, + +[#2 Trailing delimiter] = 1:7-1:8 + >-< +1| bar = 0, + +[#2 Domain] = 1:4-1:11 + >-------< +1| bar = 0, + +[#2 Insertion delimiter] = " " + + +[#3 Content] = 2:4-2:7 + >---< +2| baz = 1, + +[#3 Removal] = 2:4-2:8 + >----< +2| baz = 1, + +[#3 Leading delimiter] = 2:0-2:4 + >----< +2| baz = 1, + +[#3 Trailing delimiter] = 2:7-2:8 + >-< +2| baz = 1, + +[#3 Domain] = 2:4-2:11 + >-------< +2| baz = 1, + +[#3 Insertion delimiter] = " " + + +[#4 Content] = +[#4 Domain] = 3:4-3:9 + >-----< +3| bongo + +[#4 Removal] = 3:0-4:0 + >--------- +3| bongo +4| } + < + +[#4 Leading delimiter] = 3:0-3:4 + >----< +3| bongo + +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/name/name.iteration.enum.scope b/data/fixtures/scopes/c/name/name.iteration.enum.scope new file mode 100644 index 0000000000..d8bda96971 --- /dev/null +++ b/data/fixtures/scopes/c/name/name.iteration.enum.scope @@ -0,0 +1,13 @@ +enum Foo { }; +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:13 + >-------------< +0| enum Foo { }; + + +[#2 Range] = +[#2 Domain] = 0:10-0:11 + >-< +0| enum Foo { }; diff --git a/data/fixtures/scopes/c/statement.enum.scope b/data/fixtures/scopes/c/statement.enum.scope new file mode 100644 index 0000000000..860aedbb22 --- /dev/null +++ b/data/fixtures/scopes/c/statement.enum.scope @@ -0,0 +1,10 @@ +enum Foo {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:12 + >------------< +0| enum Foo {}; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/type/type.class.scope b/data/fixtures/scopes/c/type/type.class.scope index 60c5a84c99..6b654dd43e 100644 --- a/data/fixtures/scopes/c/type/type.class.scope +++ b/data/fixtures/scopes/c/type/type.class.scope @@ -1,91 +1,10 @@ -struct aaa {}; -union bbb {}; -enum ccc {}; - -typedef struct {} ggg; -typedef union {} iii; -typedef enum {} lll; +struct Foo {}; --- -[#1 Content] = -[#1 Domain] = 0:0-0:14 +[Content] = +[Removal] = +[Domain] = 0:0-0:14 >--------------< -0| struct aaa {}; - -[#1 Removal] = 0:0-1:0 - >-------------- -0| struct aaa {}; -1| union bbb {}; - < - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Domain] = 1:0-1:13 - >-------------< -1| union bbb {}; - -[#2 Removal] = 1:0-2:0 - >------------- -1| union bbb {}; -2| enum ccc {}; - < - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Domain] = 2:0-2:12 - >------------< -2| enum ccc {}; - -[#3 Removal] = 2:0-3:0 - >------------ -2| enum ccc {}; -3| - < - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Domain] = 4:0-4:22 - >----------------------< -4| typedef struct {} ggg; - -[#4 Removal] = 4:0-5:0 - >---------------------- -4| typedef struct {} ggg; -5| typedef union {} iii; - < - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Domain] = 5:0-5:21 - >---------------------< -5| typedef union {} iii; - -[#5 Removal] = 5:0-6:0 - >--------------------- -5| typedef union {} iii; -6| typedef enum {} lll; - < - -[#5 Insertion delimiter] = " " - - -[#6 Content] = -[#6 Domain] = 6:0-6:20 - >--------------------< -6| typedef enum {} lll; - -[#6 Removal] = 5:21-6:20 - > -5| typedef union {} iii; -6| typedef enum {} lll; - --------------------< +0| struct Foo {}; -[#6 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/type/type.class2.scope b/data/fixtures/scopes/c/type/type.class2.scope new file mode 100644 index 0000000000..6165487b6b --- /dev/null +++ b/data/fixtures/scopes/c/type/type.class2.scope @@ -0,0 +1,10 @@ +typedef struct {} Foo; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:22 + >----------------------< +0| typedef struct {} Foo; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/type/type.class3.scope b/data/fixtures/scopes/c/type/type.class3.scope new file mode 100644 index 0000000000..64e3b5e572 --- /dev/null +++ b/data/fixtures/scopes/c/type/type.class3.scope @@ -0,0 +1,10 @@ +union Foo {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:13 + >-------------< +0| union Foo {}; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/type/type.class4.scope b/data/fixtures/scopes/c/type/type.class4.scope new file mode 100644 index 0000000000..24e2606554 --- /dev/null +++ b/data/fixtures/scopes/c/type/type.class4.scope @@ -0,0 +1,10 @@ +typedef union {} Foo; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:21 + >---------------------< +0| typedef union {} Foo; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/type/type.enum.scope b/data/fixtures/scopes/c/type/type.enum.scope index 1f8f12c28d..74e9c622d8 100644 --- a/data/fixtures/scopes/c/type/type.enum.scope +++ b/data/fixtures/scopes/c/type/type.enum.scope @@ -1,10 +1,10 @@ -enum Foo { aaa, bbb }; +enum Foo {}; --- [Content] = [Removal] = -[Domain] = 0:0-0:22 - >----------------------< -0| enum Foo { aaa, bbb }; +[Domain] = 0:0-0:12 + >------------< +0| enum Foo {}; [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/type/type.enum2.scope b/data/fixtures/scopes/c/type/type.enum2.scope new file mode 100644 index 0000000000..b393cd8950 --- /dev/null +++ b/data/fixtures/scopes/c/type/type.enum2.scope @@ -0,0 +1,10 @@ +typedef enum {} Foo; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:20 + >--------------------< +0| typedef enum {} Foo; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/value/value.field.enum.scope b/data/fixtures/scopes/c/value/value.field.enum.scope new file mode 100644 index 0000000000..882ede0854 --- /dev/null +++ b/data/fixtures/scopes/c/value/value.field.enum.scope @@ -0,0 +1,43 @@ +enum Foo { + bar = 0, + baz = 1, + bongo +} +--- + +[#1 Content] = 1:10-1:11 + >-< +1| bar = 0, + +[#1 Removal] = 1:7-1:11 + >----< +1| bar = 0, + +[#1 Leading delimiter] = 1:7-1:10 + >---< +1| bar = 0, + +[#1 Domain] = 1:4-1:11 + >-------< +1| bar = 0, + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 2:10-2:11 + >-< +2| baz = 1, + +[#2 Removal] = 2:7-2:11 + >----< +2| baz = 1, + +[#2 Leading delimiter] = 2:7-2:10 + >---< +2| baz = 1, + +[#2 Domain] = 2:4-2:11 + >-------< +2| baz = 1, + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/value/value.iteration.enum.scope b/data/fixtures/scopes/c/value/value.iteration.enum.scope new file mode 100644 index 0000000000..d8bda96971 --- /dev/null +++ b/data/fixtures/scopes/c/value/value.iteration.enum.scope @@ -0,0 +1,13 @@ +enum Foo { }; +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:13 + >-------------< +0| enum Foo { }; + + +[#2 Range] = +[#2 Domain] = 0:10-0:11 + >-< +0| enum Foo { }; diff --git a/data/fixtures/scopes/cpp/className.scope b/data/fixtures/scopes/cpp/className.scope index fddfa0c4ab..d7fe067187 100644 --- a/data/fixtures/scopes/cpp/className.scope +++ b/data/fixtures/scopes/cpp/className.scope @@ -1,48 +1,24 @@ -class aaa { int bbb; }; -enum class ccc { ddd, eee }; +class Foo {}; --- -[#1 Content] = 0:6-0:9 +[Content] = 0:6-0:9 >---< -0| class aaa { int bbb; }; +0| class Foo {}; -[#1 Removal] = 0:6-0:10 +[Removal] = 0:6-0:10 >----< -0| class aaa { int bbb; }; +0| class Foo {}; -[#1 Leading delimiter] = 0:5-0:6 +[Leading delimiter] = 0:5-0:6 >-< -0| class aaa { int bbb; }; +0| class Foo {}; -[#1 Trailing delimiter] = 0:9-0:10 +[Trailing delimiter] = 0:9-0:10 >-< -0| class aaa { int bbb; }; +0| class Foo {}; -[#1 Domain] = 0:0-0:23 - >-----------------------< -0| class aaa { int bbb; }; +[Domain] = 0:0-0:13 + >-------------< +0| class Foo {}; -[#1 Insertion delimiter] = " " - - -[#2 Content] = 1:11-1:14 - >---< -1| enum class ccc { ddd, eee }; - -[#2 Removal] = 1:11-1:15 - >----< -1| enum class ccc { ddd, eee }; - -[#2 Leading delimiter] = 1:10-1:11 - >-< -1| enum class ccc { ddd, eee }; - -[#2 Trailing delimiter] = 1:14-1:15 - >-< -1| enum class ccc { ddd, eee }; - -[#2 Domain] = 1:0-1:28 - >----------------------------< -1| enum class ccc { ddd, eee }; - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.enum.scope b/data/fixtures/scopes/cpp/interior/interior.enum.scope new file mode 100644 index 0000000000..efbe2da153 --- /dev/null +++ b/data/fixtures/scopes/cpp/interior/interior.enum.scope @@ -0,0 +1,25 @@ +enum class Foo { }; +--- + +[#1 Content] = +[#1 Removal] = 0:16-0:17 + >-< +0| enum class Foo { }; + +[#1 Domain] = 0:0-0:19 + >-------------------< +0| enum class Foo { }; + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 0:16-0:17 + >-< +0| enum class Foo { }; + +[#2 Domain] = 0:15-0:18 + >---< +0| enum class Foo { }; + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/name/name.enum.scope b/data/fixtures/scopes/cpp/name/name.enum.scope new file mode 100644 index 0000000000..c6442bcc97 --- /dev/null +++ b/data/fixtures/scopes/cpp/name/name.enum.scope @@ -0,0 +1,24 @@ +enum class Foo {}; +--- + +[Content] = 0:11-0:14 + >---< +0| enum class Foo {}; + +[Removal] = 0:11-0:15 + >----< +0| enum class Foo {}; + +[Leading delimiter] = 0:10-0:11 + >-< +0| enum class Foo {}; + +[Trailing delimiter] = 0:14-0:15 + >-< +0| enum class Foo {}; + +[Domain] = 0:0-0:18 + >------------------< +0| enum class Foo {}; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/name/name.field.enum.scope b/data/fixtures/scopes/cpp/name/name.field.enum.scope new file mode 100644 index 0000000000..6fc638a279 --- /dev/null +++ b/data/fixtures/scopes/cpp/name/name.field.enum.scope @@ -0,0 +1,97 @@ +enum class Foo { + bar = 0, + baz = 1, + bongo +} +--- + +[#1 Content] = 0:11-0:14 + >---< +0| enum class Foo { + +[#1 Removal] = 0:11-0:15 + >----< +0| enum class Foo { + +[#1 Leading delimiter] = 0:10-0:11 + >-< +0| enum class Foo { + +[#1 Trailing delimiter] = 0:14-0:15 + >-< +0| enum class Foo { + +[#1 Domain] = 0:0-4:1 + >---------------- +0| enum class Foo { +1| bar = 0, +2| baz = 1, +3| bongo +4| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:4-1:7 + >---< +1| bar = 0, + +[#2 Removal] = 1:4-1:8 + >----< +1| bar = 0, + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| bar = 0, + +[#2 Trailing delimiter] = 1:7-1:8 + >-< +1| bar = 0, + +[#2 Domain] = 1:4-1:11 + >-------< +1| bar = 0, + +[#2 Insertion delimiter] = " " + + +[#3 Content] = 2:4-2:7 + >---< +2| baz = 1, + +[#3 Removal] = 2:4-2:8 + >----< +2| baz = 1, + +[#3 Leading delimiter] = 2:0-2:4 + >----< +2| baz = 1, + +[#3 Trailing delimiter] = 2:7-2:8 + >-< +2| baz = 1, + +[#3 Domain] = 2:4-2:11 + >-------< +2| baz = 1, + +[#3 Insertion delimiter] = " " + + +[#4 Content] = +[#4 Domain] = 3:4-3:9 + >-----< +3| bongo + +[#4 Removal] = 3:0-4:0 + >--------- +3| bongo +4| } + < + +[#4 Leading delimiter] = 3:0-3:4 + >----< +3| bongo + +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/name/name.iteration.enum.scope b/data/fixtures/scopes/cpp/name/name.iteration.enum.scope new file mode 100644 index 0000000000..39c9e55f47 --- /dev/null +++ b/data/fixtures/scopes/cpp/name/name.iteration.enum.scope @@ -0,0 +1,13 @@ +enum class Foo { }; +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:19 + >-------------------< +0| enum class Foo { }; + + +[#2 Range] = +[#2 Domain] = 0:16-0:17 + >-< +0| enum class Foo { }; diff --git a/data/fixtures/scopes/cpp/statement.class2.scope b/data/fixtures/scopes/cpp/statement.enum.scope similarity index 100% rename from data/fixtures/scopes/cpp/statement.class2.scope rename to data/fixtures/scopes/cpp/statement.enum.scope diff --git a/data/fixtures/scopes/cpp/type/type.class.scope b/data/fixtures/scopes/cpp/type/type.class.scope index c8bcfb07c9..273d790481 100644 --- a/data/fixtures/scopes/cpp/type/type.class.scope +++ b/data/fixtures/scopes/cpp/type/type.class.scope @@ -1,53 +1,10 @@ -class aaa { int bbb; }; -enum class ccc { ddd, eee }; +class Foo {}; --- -[#1 Content] = -[#1 Domain] = 0:0-0:23 - >-----------------------< -0| class aaa { int bbb; }; +[Content] = +[Removal] = +[Domain] = 0:0-0:13 + >-------------< +0| class Foo {}; -[#1 Removal] = 0:0-1:0 - >----------------------- -0| class aaa { int bbb; }; -1| enum class ccc { ddd, eee }; - < - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 0:12-0:15 - >---< -0| class aaa { int bbb; }; - -[#2 Removal] = 0:12-0:16 - >----< -0| class aaa { int bbb; }; - -[#2 Leading delimiter] = 0:11-0:12 - >-< -0| class aaa { int bbb; }; - -[#2 Trailing delimiter] = 0:15-0:16 - >-< -0| class aaa { int bbb; }; - -[#2 Domain] = 0:12-0:20 - >--------< -0| class aaa { int bbb; }; - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Domain] = 1:0-1:28 - >----------------------------< -1| enum class ccc { ddd, eee }; - -[#3 Removal] = 0:23-1:28 - > -0| class aaa { int bbb; }; -1| enum class ccc { ddd, eee }; - ----------------------------< - -[#3 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/class2.scope b/data/fixtures/scopes/cpp/type/type.enum.scope similarity index 78% rename from data/fixtures/scopes/cpp/class2.scope rename to data/fixtures/scopes/cpp/type/type.enum.scope index 90124d73e3..a8bf40ef04 100644 --- a/data/fixtures/scopes/cpp/class2.scope +++ b/data/fixtures/scopes/cpp/type/type.enum.scope @@ -7,4 +7,4 @@ enum class Foo {}; >------------------< 0| enum class Foo {}; -[Insertion delimiter] = "\n\n" +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/value/value.field.enum.scope b/data/fixtures/scopes/cpp/value/value.field.enum.scope new file mode 100644 index 0000000000..673b090eac --- /dev/null +++ b/data/fixtures/scopes/cpp/value/value.field.enum.scope @@ -0,0 +1,43 @@ +enum class Foo { + bar = 0, + baz = 1, + bongo +} +--- + +[#1 Content] = 1:10-1:11 + >-< +1| bar = 0, + +[#1 Removal] = 1:7-1:11 + >----< +1| bar = 0, + +[#1 Leading delimiter] = 1:7-1:10 + >---< +1| bar = 0, + +[#1 Domain] = 1:4-1:11 + >-------< +1| bar = 0, + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 2:10-2:11 + >-< +2| baz = 1, + +[#2 Removal] = 2:7-2:11 + >----< +2| baz = 1, + +[#2 Leading delimiter] = 2:7-2:10 + >---< +2| baz = 1, + +[#2 Domain] = 2:4-2:11 + >-------< +2| baz = 1, + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/value/value.iteration.enum.scope b/data/fixtures/scopes/cpp/value/value.iteration.enum.scope new file mode 100644 index 0000000000..39c9e55f47 --- /dev/null +++ b/data/fixtures/scopes/cpp/value/value.iteration.enum.scope @@ -0,0 +1,13 @@ +enum class Foo { }; +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:19 + >-------------------< +0| enum class Foo { }; + + +[#2 Range] = +[#2 Domain] = 0:16-0:17 + >-< +0| enum class Foo { }; diff --git a/data/fixtures/scopes/csharp/interior/interior.enum.scope b/data/fixtures/scopes/csharp/interior/interior.enum.scope new file mode 100644 index 0000000000..a5274985e7 --- /dev/null +++ b/data/fixtures/scopes/csharp/interior/interior.enum.scope @@ -0,0 +1,25 @@ +enum Foo { } +--- + +[#1 Content] = +[#1 Removal] = 0:10-0:11 + >-< +0| enum Foo { } + +[#1 Domain] = 0:0-0:12 + >------------< +0| enum Foo { } + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 0:10-0:11 + >-< +0| enum Foo { } + +[#2 Domain] = 0:9-0:12 + >---< +0| enum Foo { } + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/name/name.enum.scope b/data/fixtures/scopes/csharp/name/name.enum.scope new file mode 100644 index 0000000000..09d2849071 --- /dev/null +++ b/data/fixtures/scopes/csharp/name/name.enum.scope @@ -0,0 +1,24 @@ +enum Foo {} +--- + +[Content] = 0:5-0:8 + >---< +0| enum Foo {} + +[Removal] = 0:5-0:9 + >----< +0| enum Foo {} + +[Leading delimiter] = 0:4-0:5 + >-< +0| enum Foo {} + +[Trailing delimiter] = 0:8-0:9 + >-< +0| enum Foo {} + +[Domain] = 0:0-0:11 + >-----------< +0| enum Foo {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/name/name.field.enum.scope b/data/fixtures/scopes/csharp/name/name.field.enum.scope new file mode 100644 index 0000000000..be33789056 --- /dev/null +++ b/data/fixtures/scopes/csharp/name/name.field.enum.scope @@ -0,0 +1,97 @@ +enum Foo { + bar = 0, + baz = 1, + bongo +} +--- + +[#1 Content] = 0:5-0:8 + >---< +0| enum Foo { + +[#1 Removal] = 0:5-0:9 + >----< +0| enum Foo { + +[#1 Leading delimiter] = 0:4-0:5 + >-< +0| enum Foo { + +[#1 Trailing delimiter] = 0:8-0:9 + >-< +0| enum Foo { + +[#1 Domain] = 0:0-4:1 + >---------- +0| enum Foo { +1| bar = 0, +2| baz = 1, +3| bongo +4| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:4-1:7 + >---< +1| bar = 0, + +[#2 Removal] = 1:4-1:8 + >----< +1| bar = 0, + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| bar = 0, + +[#2 Trailing delimiter] = 1:7-1:8 + >-< +1| bar = 0, + +[#2 Domain] = 1:4-1:11 + >-------< +1| bar = 0, + +[#2 Insertion delimiter] = " " + + +[#3 Content] = 2:4-2:7 + >---< +2| baz = 1, + +[#3 Removal] = 2:4-2:8 + >----< +2| baz = 1, + +[#3 Leading delimiter] = 2:0-2:4 + >----< +2| baz = 1, + +[#3 Trailing delimiter] = 2:7-2:8 + >-< +2| baz = 1, + +[#3 Domain] = 2:4-2:11 + >-------< +2| baz = 1, + +[#3 Insertion delimiter] = " " + + +[#4 Content] = +[#4 Domain] = 3:4-3:9 + >-----< +3| bongo + +[#4 Removal] = 3:0-4:0 + >--------- +3| bongo +4| } + < + +[#4 Leading delimiter] = 3:0-3:4 + >----< +3| bongo + +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/name/name.iteration.enum.scope b/data/fixtures/scopes/csharp/name/name.iteration.enum.scope new file mode 100644 index 0000000000..984f21de91 --- /dev/null +++ b/data/fixtures/scopes/csharp/name/name.iteration.enum.scope @@ -0,0 +1,13 @@ +enum Foo { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:12 + >------------< +0| enum Foo { } + + +[#2 Range] = +[#2 Domain] = 0:10-0:11 + >-< +0| enum Foo { } diff --git a/data/fixtures/scopes/csharp/statement/statement.enum.scope b/data/fixtures/scopes/csharp/statement/statement.enum.scope new file mode 100644 index 0000000000..88dd9cd028 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.enum.scope @@ -0,0 +1,10 @@ +enum Foo {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:11 + >-----------< +0| enum Foo {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/value/value.field.enum.scope b/data/fixtures/scopes/csharp/value/value.field.enum.scope new file mode 100644 index 0000000000..882ede0854 --- /dev/null +++ b/data/fixtures/scopes/csharp/value/value.field.enum.scope @@ -0,0 +1,43 @@ +enum Foo { + bar = 0, + baz = 1, + bongo +} +--- + +[#1 Content] = 1:10-1:11 + >-< +1| bar = 0, + +[#1 Removal] = 1:7-1:11 + >----< +1| bar = 0, + +[#1 Leading delimiter] = 1:7-1:10 + >---< +1| bar = 0, + +[#1 Domain] = 1:4-1:11 + >-------< +1| bar = 0, + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 2:10-2:11 + >-< +2| baz = 1, + +[#2 Removal] = 2:7-2:11 + >----< +2| baz = 1, + +[#2 Leading delimiter] = 2:7-2:10 + >---< +2| baz = 1, + +[#2 Domain] = 2:4-2:11 + >-------< +2| baz = 1, + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/value/value.iteration.enum.scope b/data/fixtures/scopes/csharp/value/value.iteration.enum.scope new file mode 100644 index 0000000000..984f21de91 --- /dev/null +++ b/data/fixtures/scopes/csharp/value/value.iteration.enum.scope @@ -0,0 +1,13 @@ +enum Foo { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:12 + >------------< +0| enum Foo { } + + +[#2 Range] = +[#2 Domain] = 0:10-0:11 + >-< +0| enum Foo { } diff --git a/data/fixtures/scopes/java/interior/interior.enum.scope b/data/fixtures/scopes/java/interior/interior.enum.scope new file mode 100644 index 0000000000..3f2fdbd802 --- /dev/null +++ b/data/fixtures/scopes/java/interior/interior.enum.scope @@ -0,0 +1,25 @@ +public enum Foo { } +--- + +[#1 Content] = +[#1 Removal] = 0:17-0:18 + >-< +0| public enum Foo { } + +[#1 Domain] = 0:0-0:19 + >-------------------< +0| public enum Foo { } + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 0:17-0:18 + >-< +0| public enum Foo { } + +[#2 Domain] = 0:16-0:19 + >---< +0| public enum Foo { } + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/name/name.enum.scope b/data/fixtures/scopes/java/name/name.enum.scope new file mode 100644 index 0000000000..1b6164784d --- /dev/null +++ b/data/fixtures/scopes/java/name/name.enum.scope @@ -0,0 +1,24 @@ +public enum Foo {} +--- + +[Content] = 0:12-0:15 + >---< +0| public enum Foo {} + +[Removal] = 0:12-0:16 + >----< +0| public enum Foo {} + +[Leading delimiter] = 0:11-0:12 + >-< +0| public enum Foo {} + +[Trailing delimiter] = 0:15-0:16 + >-< +0| public enum Foo {} + +[Domain] = 0:0-0:18 + >------------------< +0| public enum Foo {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/name/name.field.enum.scope b/data/fixtures/scopes/java/name/name.field.enum.scope new file mode 100644 index 0000000000..d40f9e2933 --- /dev/null +++ b/data/fixtures/scopes/java/name/name.field.enum.scope @@ -0,0 +1,63 @@ +public enum Foo { + bar, + baz; +} +--- + +[#1 Content] = 0:12-0:15 + >---< +0| public enum Foo { + +[#1 Removal] = 0:12-0:16 + >----< +0| public enum Foo { + +[#1 Leading delimiter] = 0:11-0:12 + >-< +0| public enum Foo { + +[#1 Trailing delimiter] = 0:15-0:16 + >-< +0| public enum Foo { + +[#1 Domain] = 0:0-3:1 + >----------------- +0| public enum Foo { +1| bar, +2| baz; +3| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Domain] = 1:4-1:7 + >---< +1| bar, + +[#2 Removal] = 1:0-1:7 + >-------< +1| bar, + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| bar, + +[#2 Insertion delimiter] = " " + + +[#3 Content] = +[#3 Domain] = 2:4-2:7 + >---< +2| baz; + +[#3 Removal] = 2:0-2:7 + >-------< +2| baz; + +[#3 Leading delimiter] = 2:0-2:4 + >----< +2| baz; + +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/name/name.iteration.enum.scope b/data/fixtures/scopes/java/name/name.iteration.enum.scope new file mode 100644 index 0000000000..2ee79432fa --- /dev/null +++ b/data/fixtures/scopes/java/name/name.iteration.enum.scope @@ -0,0 +1,13 @@ +public enum Foo { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:19 + >-------------------< +0| public enum Foo { } + + +[#2 Range] = +[#2 Domain] = 0:17-0:18 + >-< +0| public enum Foo { } diff --git a/data/fixtures/scopes/java/statement/statement.enum.scope b/data/fixtures/scopes/java/statement/statement.enum.scope new file mode 100644 index 0000000000..6b95327386 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.enum.scope @@ -0,0 +1,10 @@ +public enum Foo {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:18 + >------------------< +0| public enum Foo {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/type/type.enum.scope b/data/fixtures/scopes/java/type/type.enum.scope index eb9f6ef6c5..85ccb1cdde 100644 --- a/data/fixtures/scopes/java/type/type.enum.scope +++ b/data/fixtures/scopes/java/type/type.enum.scope @@ -1,15 +1,10 @@ -public enum Value { - A; -} +public enum Foo {} --- [Content] = [Removal] = -[Domain] = 0:0-2:1 - >------------------- -0| public enum Value { -1| A; -2| } - -< +[Domain] = 0:0-0:18 + >------------------< +0| public enum Foo {} [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/interior.enum.scope b/data/fixtures/scopes/typescript.core/interior.enum.scope new file mode 100644 index 0000000000..a5274985e7 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/interior.enum.scope @@ -0,0 +1,25 @@ +enum Foo { } +--- + +[#1 Content] = +[#1 Removal] = 0:10-0:11 + >-< +0| enum Foo { } + +[#1 Domain] = 0:0-0:12 + >------------< +0| enum Foo { } + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 0:10-0:11 + >-< +0| enum Foo { } + +[#2 Domain] = 0:9-0:12 + >---< +0| enum Foo { } + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/name/name.enum.scope b/data/fixtures/scopes/typescript.core/name/name.enum.scope new file mode 100644 index 0000000000..09d2849071 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/name/name.enum.scope @@ -0,0 +1,24 @@ +enum Foo {} +--- + +[Content] = 0:5-0:8 + >---< +0| enum Foo {} + +[Removal] = 0:5-0:9 + >----< +0| enum Foo {} + +[Leading delimiter] = 0:4-0:5 + >-< +0| enum Foo {} + +[Trailing delimiter] = 0:8-0:9 + >-< +0| enum Foo {} + +[Domain] = 0:0-0:11 + >-----------< +0| enum Foo {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/name/name.field.enum.scope b/data/fixtures/scopes/typescript.core/name/name.field.enum.scope new file mode 100644 index 0000000000..e0fdaa48df --- /dev/null +++ b/data/fixtures/scopes/typescript.core/name/name.field.enum.scope @@ -0,0 +1,97 @@ +enum Foo { + bar = "-", + baz = 0, + bongo +} +--- + +[#1 Content] = 0:5-0:8 + >---< +0| enum Foo { + +[#1 Removal] = 0:5-0:9 + >----< +0| enum Foo { + +[#1 Leading delimiter] = 0:4-0:5 + >-< +0| enum Foo { + +[#1 Trailing delimiter] = 0:8-0:9 + >-< +0| enum Foo { + +[#1 Domain] = 0:0-4:1 + >---------- +0| enum Foo { +1| bar = "-", +2| baz = 0, +3| bongo +4| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:4-1:7 + >---< +1| bar = "-", + +[#2 Removal] = 1:4-1:8 + >----< +1| bar = "-", + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| bar = "-", + +[#2 Trailing delimiter] = 1:7-1:8 + >-< +1| bar = "-", + +[#2 Domain] = 1:4-1:13 + >---------< +1| bar = "-", + +[#2 Insertion delimiter] = " " + + +[#3 Content] = 2:4-2:7 + >---< +2| baz = 0, + +[#3 Removal] = 2:4-2:8 + >----< +2| baz = 0, + +[#3 Leading delimiter] = 2:0-2:4 + >----< +2| baz = 0, + +[#3 Trailing delimiter] = 2:7-2:8 + >-< +2| baz = 0, + +[#3 Domain] = 2:4-2:11 + >-------< +2| baz = 0, + +[#3 Insertion delimiter] = " " + + +[#4 Content] = +[#4 Domain] = 3:4-3:9 + >-----< +3| bongo + +[#4 Removal] = 3:0-4:0 + >--------- +3| bongo +4| } + < + +[#4 Leading delimiter] = 3:0-3:4 + >----< +3| bongo + +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/name/name.iteration.enum.scope b/data/fixtures/scopes/typescript.core/name/name.iteration.enum.scope new file mode 100644 index 0000000000..984f21de91 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/name/name.iteration.enum.scope @@ -0,0 +1,13 @@ +enum Foo { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:12 + >------------< +0| enum Foo { } + + +[#2 Range] = +[#2 Domain] = 0:10-0:11 + >-< +0| enum Foo { } diff --git a/data/fixtures/scopes/typescript.core/statement/statement.enum.scope b/data/fixtures/scopes/typescript.core/statement/statement.enum.scope new file mode 100644 index 0000000000..88dd9cd028 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/statement/statement.enum.scope @@ -0,0 +1,10 @@ +enum Foo {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:11 + >-----------< +0| enum Foo {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/typescript.core/statement.field.interface.scope b/data/fixtures/scopes/typescript.core/statement/statement.field.interface.scope similarity index 100% rename from data/fixtures/scopes/typescript.core/statement.field.interface.scope rename to data/fixtures/scopes/typescript.core/statement/statement.field.interface.scope diff --git a/data/fixtures/scopes/typescript.core/statement.interface.scope b/data/fixtures/scopes/typescript.core/statement/statement.interface.scope similarity index 100% rename from data/fixtures/scopes/typescript.core/statement.interface.scope rename to data/fixtures/scopes/typescript.core/statement/statement.interface.scope diff --git a/data/fixtures/scopes/typescript.core/statement.iteration.interface.scope b/data/fixtures/scopes/typescript.core/statement/statement.iteration.interface.scope similarity index 100% rename from data/fixtures/scopes/typescript.core/statement.iteration.interface.scope rename to data/fixtures/scopes/typescript.core/statement/statement.iteration.interface.scope diff --git a/data/fixtures/scopes/typescript.core/statement.scope b/data/fixtures/scopes/typescript.core/statement/statement.scope similarity index 100% rename from data/fixtures/scopes/typescript.core/statement.scope rename to data/fixtures/scopes/typescript.core/statement/statement.scope diff --git a/data/fixtures/scopes/typescript.core/value/value.field.enum.scope b/data/fixtures/scopes/typescript.core/value/value.field.enum.scope new file mode 100644 index 0000000000..e9b28b0b42 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/value/value.field.enum.scope @@ -0,0 +1,43 @@ +enum Foo { + bar = "-", + baz = 0, + bongo +} +--- + +[#1 Content] = 1:10-1:13 + >---< +1| bar = "-", + +[#1 Removal] = 1:7-1:13 + >------< +1| bar = "-", + +[#1 Leading delimiter] = 1:7-1:10 + >---< +1| bar = "-", + +[#1 Domain] = 1:4-1:13 + >---------< +1| bar = "-", + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 2:10-2:11 + >-< +2| baz = 0, + +[#2 Removal] = 2:7-2:11 + >----< +2| baz = 0, + +[#2 Leading delimiter] = 2:7-2:10 + >---< +2| baz = 0, + +[#2 Domain] = 2:4-2:11 + >-------< +2| baz = 0, + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/value/value.iteration.enum.scope b/data/fixtures/scopes/typescript.core/value/value.iteration.enum.scope new file mode 100644 index 0000000000..984f21de91 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/value/value.iteration.enum.scope @@ -0,0 +1,13 @@ +enum Foo { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:12 + >------------< +0| enum Foo { } + + +[#2 Range] = +[#2 Domain] = 0:10-0:11 + >-< +0| enum Foo { } diff --git a/data/scopeSupportFacetInfos.md b/data/scopeSupportFacetInfos.md index b24e051327..11c7a0097b 100644 --- a/data/scopeSupportFacetInfos.md +++ b/data/scopeSupportFacetInfos.md @@ -181,6 +181,7 @@ - `interior.constructor` The body of a constructor declaration - `interior.doWhile` The body of a do-while loop - `interior.element` The interior/children of a XML element +- `interior.enum` The body of an enum - `interior.for` The body of a for loop - `interior.foreach` The body of a for-each loop - `interior.function` The body of a function declaration @@ -233,14 +234,17 @@ - `name.class` Name of a class - `name.command` LHS of a command, eg Talon spoken command or bash - `name.constructor` Name of a constructor +- `name.enum` Name of an enum - `name.field.class` Name (LHS) of a field in a class -- `name.field.interface` Name (LHS) of a field in a interface +- `name.field.enum` Name (LHS) of a field in an enum +- `name.field.interface` Name (LHS) of a field in an interface - `name.foreach` Iteration variable name in a for each loop - `name.function` Name of a function - `name.interface` Name of a interface - `name.iteration.block` Iteration scope for names: statement blocks (body of functions/if-statements/for-loops/etc). - `name.iteration.class` Iteration scope for names: class bodies. - `name.iteration.document` Iteration scope for names: the entire document including leading and trailing empty lines. +- `name.iteration.enum` Iteration scope for names: enum bodies. - `name.iteration.interface` Iteration scope for names: interface bodies. - `name.method` Name of a class method - `name.namespace` Name of a namespace @@ -300,9 +304,10 @@ - `statement` A statement, eg assignment, for loop, etc - `statement.class` A class declaration +- `statement.enum` An enum declaration - `statement.field.class` A field declaration in a class - `statement.field.interface` A field declaration in a interface -- `statement.interface` A interface declaration +- `statement.interface` An interface declaration - `statement.iteration.block` Iteration scope for statements: statement blocks (body of functions/if-statements/for-loops/etc). - `statement.iteration.class` Iteration scope for statements: class bodies. - `statement.iteration.document` Iteration scope for statements: the entire document including leading and trailing empty lines. @@ -388,10 +393,12 @@ - `value.attribute` Value (RHS) of an attribute eg in a xml element - `value.command` Value (RHS) of an command, eg Talon spoken command - `value.field.class` Value (RHS) of a field in a class +- `value.field.enum` Value (RHS) of a field in an enum - `value.foreach` Iterable in a for each loop - `value.iteration.block` Iteration scope for values: statement blocks (body of functions/if-statements/for-loops/etc). - `value.iteration.class` Iteration scope for values: class bodies. - `value.iteration.document` Iteration scope for values: the entire document including leading and trailing empty lines. +- `value.iteration.enum` Iteration scope for values: enum bodies. - `value.mapPair` Value (RHS) of a key-value pair in a map - `value.mapPair.iteration` Iteration scope for values of key-value pairs in a map: should be between the braces. - `value.resource` Value of a 'with' / 'use' / 'using' statement diff --git a/packages/common/src/scopeSupportFacets/c.ts b/packages/common/src/scopeSupportFacets/c.ts index a84356ae4c..cbf3eacbc9 100644 --- a/packages/common/src/scopeSupportFacets/c.ts +++ b/packages/common/src/scopeSupportFacets/c.ts @@ -11,6 +11,7 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, statement: supported, "statement.class": supported, + "statement.enum": supported, "statement.field.class": supported, "statement.iteration.document": supported, "statement.iteration.class": supported, @@ -80,18 +81,23 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { "name.variable": supported, "name.function": supported, "name.class": supported, + "name.enum": supported, "name.field.class": supported, + "name.field.enum": supported, "name.argument.formal": supported, "name.argument.formal.iteration": supported, "name.iteration.block": supported, "name.iteration.class": supported, + "name.iteration.enum": supported, "name.iteration.document": supported, "value.assignment": supported, "value.variable": supported, "value.return": supported, + "value.field.enum": supported, "value.iteration.block": supported, "value.iteration.class": supported, + "value.iteration.enum": supported, "value.iteration.document": supported, "type.variable": supported, @@ -107,6 +113,7 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { "type.iteration.document": supported, "interior.class": supported, + "interior.enum": supported, "interior.function": supported, "interior.if": supported, "interior.switch": supported, diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index 6aa13c810f..66f8e7d755 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -68,9 +68,11 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "name.assignment": supported, "name.class": supported, "name.interface": supported, + "name.enum": supported, "name.constructor": supported, "name.field.class": supported, "name.field.interface": supported, + "name.field.enum": supported, "name.foreach": supported, "name.function": supported, "name.method": supported, @@ -78,6 +80,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "name.iteration.block": supported, "name.iteration.class": supported, "name.iteration.interface": supported, + "name.iteration.enum": supported, "name.iteration.document": supported, "value.argument.formal.constructor": supported, @@ -88,6 +91,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "value.argument.formal": supported, "value.assignment": supported, "value.field.class": supported, + "value.field.enum": supported, "value.foreach": supported, "value.mapPair": supported, "value.mapPair.iteration": supported, @@ -97,6 +101,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "value.yield": supported, "value.iteration.block": supported, "value.iteration.class": supported, + "value.iteration.enum": supported, "value.iteration.document": supported, "type.argument.formal": supported, @@ -109,10 +114,10 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "type.cast": supported, "type.class": supported, "type.interface": supported, + "type.enum": supported, "type.foreach": supported, "type.field.class": supported, "type.field.interface": supported, - "type.enum": supported, "type.return": supported, "type.variable": supported, "type.typeArgument": supported, @@ -175,6 +180,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { statement: supported, "statement.class": supported, "statement.interface": supported, + "statement.enum": supported, "statement.field.class": supported, "statement.field.interface": supported, "statement.iteration.block": supported, @@ -192,6 +198,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "interior.class": supported, "interior.interface": supported, + "interior.enum": supported, "interior.function": supported, "interior.constructor": supported, "interior.method": supported, diff --git a/packages/common/src/scopeSupportFacets/css.ts b/packages/common/src/scopeSupportFacets/css.ts index 6f4982c402..9ad8979b81 100644 --- a/packages/common/src/scopeSupportFacets/css.ts +++ b/packages/common/src/scopeSupportFacets/css.ts @@ -76,6 +76,16 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "type.iteration.interface": notApplicable, "interior.interface": notApplicable, + // Enum + "statement.enum": notApplicable, + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, + // Command command: notApplicable, "name.command": notApplicable, @@ -225,7 +235,6 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method": notApplicable, "type.argument.formal": notApplicable, "type.cast": notApplicable, - "type.enum": notApplicable, "type.foreach": notApplicable, "type.resource": notApplicable, "type.resource.iteration": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/html.ts b/packages/common/src/scopeSupportFacets/html.ts index 15bb5887b3..f862c7a638 100644 --- a/packages/common/src/scopeSupportFacets/html.ts +++ b/packages/common/src/scopeSupportFacets/html.ts @@ -54,6 +54,16 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { "type.field.interface": notApplicable, "type.iteration.interface": notApplicable, + // Enum + "statement.enum": notApplicable, + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, + // Command command: notApplicable, "name.command": notApplicable, @@ -195,7 +205,6 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method": notApplicable, "type.argument.formal": notApplicable, "type.cast": notApplicable, - "type.enum": notApplicable, "type.foreach": notApplicable, "type.resource": notApplicable, "type.resource.iteration": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/java.ts b/packages/common/src/scopeSupportFacets/java.ts index d17de03b76..2847dc5b71 100644 --- a/packages/common/src/scopeSupportFacets/java.ts +++ b/packages/common/src/scopeSupportFacets/java.ts @@ -98,6 +98,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { statement: supported, "statement.class": supported, "statement.interface": supported, + "statement.enum": supported, "statement.field.class": supported, "statement.field.interface": supported, "statement.iteration.block": supported, @@ -121,15 +122,18 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "name.assignment": supported, "name.class": supported, "name.interface": supported, + "name.enum": supported, "name.constructor": supported, "name.field.class": supported, "name.field.interface": supported, + "name.field.enum": supported, "name.foreach": supported, "name.method": supported, "name.variable": supported, "name.iteration.document": supported, "name.iteration.class": supported, "name.iteration.interface": supported, + "name.iteration.enum": supported, "name.iteration.block": supported, "name.resource": supported, @@ -168,6 +172,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "interior.class": supported, "interior.interface": supported, + "interior.enum": supported, "interior.constructor": supported, "interior.method": supported, "interior.if": supported, @@ -279,6 +284,10 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "branch.loop": notApplicable, "branch.loop.iteration": notApplicable, + // Values in enum + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + // Miscellaneous "value.yield": notApplicable, pairDelimiter: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index b3fe83df3d..8beed33e2a 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -270,17 +270,13 @@ export const javascriptScopeSupport: LanguageScopeSupportFacetMap = { "type.cast": notApplicable, "type.class": notApplicable, "type.field.class": notApplicable, - "type.field.interface": notApplicable, "type.foreach": notApplicable, - "type.interface": notApplicable, - "type.enum": notApplicable, "type.return": notApplicable, "type.variable": notApplicable, "type.typeArgument": notApplicable, "type.typeArgument.iteration": notApplicable, "type.iteration.block": notApplicable, "type.iteration.class": notApplicable, - "type.iteration.interface": notApplicable, "type.iteration.document": notApplicable, "value.typeAlias": notApplicable, @@ -288,8 +284,21 @@ export const javascriptScopeSupport: LanguageScopeSupportFacetMap = { "statement.interface": notApplicable, "statement.field.interface": notApplicable, "statement.iteration.interface": notApplicable, - "interior.interface": notApplicable, "name.interface": notApplicable, "name.field.interface": notApplicable, "name.iteration.interface": notApplicable, + "type.interface": notApplicable, + "type.field.interface": notApplicable, + "type.iteration.interface": notApplicable, + "interior.interface": notApplicable, + + // Enum + "statement.enum": notApplicable, + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/json.ts b/packages/common/src/scopeSupportFacets/json.ts index e4f54cb6c1..4bc3bf84d8 100644 --- a/packages/common/src/scopeSupportFacets/json.ts +++ b/packages/common/src/scopeSupportFacets/json.ts @@ -57,6 +57,16 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "type.field.interface": notApplicable, "type.iteration.interface": notApplicable, + // Enum + "statement.enum": notApplicable, + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, + // Command command: notApplicable, "name.command": notApplicable, @@ -217,7 +227,6 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method": notApplicable, "type.argument.formal.method.iteration": notApplicable, "type.cast": notApplicable, - "type.enum": notApplicable, "type.foreach": notApplicable, "type.variable": notApplicable, "type.return": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/markdown.ts b/packages/common/src/scopeSupportFacets/markdown.ts index 7c59b2f481..9c176bf4ce 100644 --- a/packages/common/src/scopeSupportFacets/markdown.ts +++ b/packages/common/src/scopeSupportFacets/markdown.ts @@ -53,6 +53,16 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "type.field.interface": notApplicable, "type.iteration.interface": notApplicable, + // Enum + "statement.enum": notApplicable, + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, + // Command command: notApplicable, "name.command": notApplicable, @@ -214,7 +224,6 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method": notApplicable, "type.argument.formal.method.iteration": notApplicable, "type.cast": notApplicable, - "type.enum": notApplicable, "type.foreach": notApplicable, "type.variable": notApplicable, "type.return": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index c8aa06d40a..817bf6a72c 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -247,7 +247,6 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { // Type. Python have some types, but not these. "type.alias": notApplicable, "type.cast": notApplicable, - "type.enum": notApplicable, "type.foreach": notApplicable, "type.interface": notApplicable, "type.field.interface": notApplicable, @@ -256,6 +255,16 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { "type.resource": notApplicable, "value.typeAlias": notApplicable, + // Enum. The way python does enums is via class inheritance, and not as a separate keyword/syntax. + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, + "statement.enum": notApplicable, + // Notebook cell notebookCell: notApplicable, "interior.cell": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/scm.ts b/packages/common/src/scopeSupportFacets/scm.ts index 60c0930a14..f52c962edf 100644 --- a/packages/common/src/scopeSupportFacets/scm.ts +++ b/packages/common/src/scopeSupportFacets/scm.ts @@ -59,6 +59,16 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "type.field.interface": notApplicable, "type.iteration.interface": notApplicable, + // Enum + "statement.enum": notApplicable, + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, + // Command command: notApplicable, "name.command": notApplicable, @@ -215,7 +225,6 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method": notApplicable, "type.argument.formal.method.iteration": notApplicable, "type.cast": notApplicable, - "type.enum": notApplicable, "type.foreach": notApplicable, "type.variable": notApplicable, "type.return": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index d3dddc82c9..1bf1e6d8a1 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -57,10 +57,6 @@ export const scopeSupportFacetInfos: Record< description: "A map/dictionary", scopeType: "map", }, - ifStatement: { - description: "An if statement", - scopeType: "ifStatement", - }, regularExpression: { description: "A regular expression", scopeType: "regularExpression", @@ -73,6 +69,10 @@ export const scopeSupportFacetInfos: Record< description: "A field access", scopeType: "private.fieldAccess", }, + ifStatement: { + description: "An if statement", + scopeType: "ifStatement", + }, statement: { description: "A statement, eg assignment, for loop, etc", @@ -83,7 +83,11 @@ export const scopeSupportFacetInfos: Record< scopeType: "statement", }, "statement.interface": { - description: "A interface declaration", + description: "An interface declaration", + scopeType: "statement", + }, + "statement.enum": { + description: "An enum declaration", scopeType: "statement", }, "statement.field.class": { @@ -578,6 +582,10 @@ export const scopeSupportFacetInfos: Record< description: "Name of a interface", scopeType: "name", }, + "name.enum": { + description: "Name of an enum", + scopeType: "name", + }, "name.namespace": { description: "Name of a namespace", scopeType: "name", @@ -587,12 +595,17 @@ export const scopeSupportFacetInfos: Record< scopeType: "name", }, "name.field.interface": { - description: "Name (LHS) of a field in a interface", + description: "Name (LHS) of a field in an interface", + scopeType: "name", + }, + "name.field.enum": { + description: "Name (LHS) of a field in an enum", scopeType: "name", }, "name.iteration.block": blockIter("name", "names"), "name.iteration.class": classIter("name", "names"), "name.iteration.interface": interfaceIter("name", "names"), + "name.iteration.enum": enumIter("name", "names"), "name.iteration.document": documentIter("name", "names"), "name.resource": { description: "Name in a 'with' / 'use' / 'using' statement", @@ -704,12 +717,17 @@ export const scopeSupportFacetInfos: Record< description: "Value (RHS) of a field in a class", scopeType: "value", }, + "value.field.enum": { + description: "Value (RHS) of a field in an enum", + scopeType: "value", + }, "value.yield": { description: "Value of a yield statement", scopeType: "value", }, "value.iteration.block": blockIter("value", "values"), "value.iteration.class": classIter("value", "values"), + "value.iteration.enum": enumIter("value", "values"), "value.iteration.document": documentIter("value", "values"), "value.resource": { description: "Value of a 'with' / 'use' / 'using' statement", @@ -876,6 +894,10 @@ export const scopeSupportFacetInfos: Record< description: "The body of a interface", scopeType: { type: "interior" }, }, + "interior.enum": { + description: "The body of an enum", + scopeType: { type: "interior" }, + }, "interior.function": { description: "The body of a function declaration", scopeType: { type: "interior" }, @@ -984,6 +1006,13 @@ function interfaceIter( return iteration(scopeType, label, "interface bodies"); } +function enumIter( + scopeType: SimpleScopeTypeType, + label: string, +): ScopeSupportFacetInfo { + return iteration(scopeType, label, "enum bodies"); +} + function blockIter( scopeType: SimpleScopeTypeType, label: string, diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index e7b368bd65..7927715212 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -30,6 +30,7 @@ export const scopeSupportFacets = [ "statement", "statement.class", "statement.interface", + "statement.enum", "statement.field.class", "statement.field.interface", "statement.iteration.document", @@ -163,9 +164,11 @@ export const scopeSupportFacets = [ "name.constructor", "name.class", "name.interface", + "name.enum", "name.namespace", "name.field.class", "name.field.interface", + "name.field.enum", "name.resource", "name.resource.iteration", "name.argument.actual", @@ -180,6 +183,7 @@ export const scopeSupportFacets = [ "name.iteration.block", "name.iteration.class", "name.iteration.interface", + "name.iteration.enum", "name.iteration.document", "key.attribute", @@ -197,6 +201,7 @@ export const scopeSupportFacets = [ "value.return", "value.return.lambda", "value.field.class", + "value.field.enum", "value.yield", "value.typeAlias", "value.resource", @@ -211,6 +216,7 @@ export const scopeSupportFacets = [ "value.argument.formal.constructor.iteration", "value.iteration.block", "value.iteration.class", + "value.iteration.enum", "value.iteration.document", "type.variable", @@ -223,6 +229,7 @@ export const scopeSupportFacets = [ "type.cast", "type.class", "type.interface", + "type.enum", "type.resource", "type.resource.iteration", "type.typeArgument", @@ -241,6 +248,7 @@ export const scopeSupportFacets = [ "interior.class", "interior.interface", + "interior.enum", "interior.function", "interior.constructor", "interior.method", diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index 9520bebc23..684ed64497 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -84,6 +84,16 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "type.field.interface": notApplicable, "type.iteration.interface": notApplicable, + // Enum + "statement.enum": notApplicable, + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, + // Try catch "branch.try": notApplicable, "branch.try.iteration": notApplicable, @@ -226,7 +236,6 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method": notApplicable, "type.argument.formal.method.iteration": notApplicable, "type.cast": notApplicable, - "type.enum": notApplicable, "type.foreach": notApplicable, "type.return": notApplicable, "type.variable": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/typescript.ts b/packages/common/src/scopeSupportFacets/typescript.ts index c3af56028d..75cd78dc86 100644 --- a/packages/common/src/scopeSupportFacets/typescript.ts +++ b/packages/common/src/scopeSupportFacets/typescript.ts @@ -30,16 +30,25 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { "type.iteration.interface": supported, "type.iteration.document": supported, - "value.typeAlias": supported, - - "interior.interface": supported, "name.interface": supported, + "name.enum": supported, "name.field.interface": supported, + "name.field.enum": supported, "name.iteration.interface": supported, + "name.iteration.enum": supported, + "statement.interface": supported, + "statement.enum": supported, "statement.field.interface": supported, "statement.iteration.interface": supported, + "value.typeAlias": supported, + "value.field.enum": supported, + "value.iteration.enum": supported, + + "interior.interface": supported, + "interior.enum": supported, + /* NOT APPLICABLE */ // Element and tags diff --git a/packages/common/src/scopeSupportFacets/xml.ts b/packages/common/src/scopeSupportFacets/xml.ts index 738ad62668..e29e6a6d49 100644 --- a/packages/common/src/scopeSupportFacets/xml.ts +++ b/packages/common/src/scopeSupportFacets/xml.ts @@ -54,6 +54,16 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "type.field.interface": notApplicable, "type.iteration.interface": notApplicable, + // Enum + "statement.enum": notApplicable, + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, + // Command command: notApplicable, "name.command": notApplicable, @@ -212,7 +222,6 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method": notApplicable, "type.argument.formal.method.iteration": notApplicable, "type.cast": notApplicable, - "type.enum": notApplicable, "type.foreach": notApplicable, "type.return": notApplicable, "type.variable": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/yaml.ts b/packages/common/src/scopeSupportFacets/yaml.ts index c0cb03f010..014b9fe3bd 100644 --- a/packages/common/src/scopeSupportFacets/yaml.ts +++ b/packages/common/src/scopeSupportFacets/yaml.ts @@ -63,6 +63,16 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "type.field.interface": notApplicable, "type.iteration.interface": notApplicable, + // Enum + "statement.enum": notApplicable, + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, + // Command command: notApplicable, "name.command": notApplicable, @@ -220,7 +230,6 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method": notApplicable, "type.argument.formal.method.iteration": notApplicable, "type.cast": notApplicable, - "type.enum": notApplicable, "type.foreach": notApplicable, "type.variable": notApplicable, "type.return": notApplicable, diff --git a/queries/c.scm b/queries/c.scm index 23c1b17e94..40fabeb171 100644 --- a/queries/c.scm +++ b/queries/c.scm @@ -117,6 +117,19 @@ (#type? @_dummy struct_specifier union_specifier enum_specifier) ) @_.domain @class @type +;;!! enum Foo {} +(enumerator_list + "{" @name.iteration.start.endOf @value.iteration.start.endOf + "}" @name.iteration.end.startOf @value.iteration.end.startOf +) + +;;!! bar = 0 +;;! ^^^ ^ +(enumerator + name: (_) @name @value.leading.endOf + value: (_)? @value +) @_.domain + ;;!! void foo(); (declaration (function_declarator diff --git a/queries/csharp.scm b/queries/csharp.scm index 702e446296..a215f28b18 100644 --- a/queries/csharp.scm +++ b/queries/csharp.scm @@ -492,7 +492,19 @@ ) @_.domain ;;!! enum Foo {} -(enum_declaration) @type +(enum_declaration + body: (_ + "{" @interior.start.endOf @name.iteration.start.endOf @value.iteration.start.endOf + "}" @interior.end.startOf @name.iteration.end.startOf @value.iteration.end.startOf + ) +) @type @interior.domain + +;;!! bar = 0 +;;! ^ +(enum_member_declaration + name: (_) @value.leading.endOf + value: (_) @value +) @_.domain ;; Dictionary values; ;;! ^^^^^^ ^^^ diff --git a/queries/java.scm b/queries/java.scm index e53eb00724..8af0505a18 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -43,7 +43,20 @@ ;;!! enum Foo {} ;;! ^^^^^^^^^^^ -(enum_declaration) @type +;;! ^^^ +(enum_declaration + name: (_) @name + body: (_ + "{" @interior.start.endOf @name.iteration.start.endOf + "}" @interior.end.startOf @name.iteration.end.startOf + ) +) @type @name.domain @interior.domain + +;;!! enum Foo { bar, baz } +;;! ^^^ ^^^ +(enum_constant + name: (_) @name +) @_.domain ;;!! class Foo {} ;;! ^^^^^^^^^^^^ diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index c0a33f73ce..d3c8f33b77 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -63,6 +63,8 @@ ;; We have special cases for these defined elsewhere (#not-type? @_.domain + enum_body + enum_assignment variable_declarator method_signature abstract_method_signature diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index e7aa1fe37b..3752bd2fc9 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -4,7 +4,7 @@ ;; import javascript.core.scm -;;!! class Aaa { bbb(); } +;;!! class Foo { bar(); } ;;! ^^^^^^ (_ (method_signature) @statement.start @@ -12,40 +12,60 @@ ";"? @statement.end ) -;;!! function aaa(bbb = "ddd") {} -;;! ^^^-------- +;;!! function foo(aaa = 0) {} +;;! ^^^---- (required_parameter - (identifier) @_.leading.endOf + (identifier) @value.leading.endOf value: (_) @value !type ) @_.domain -;;!! function aaa(bbb: Ccc = "ddd") {} -;;! ^^^------------- +;;!! function foo(aaa: number = 0) {} +;;! ^^^------------ (required_parameter - type: (_) @_.leading.endOf + type: (_) @value.leading.endOf value: (_) @value ) @_.domain -;;!! function aaa(bbb?: Ccc = "ddd") {} +;;!! function foo(aaa?: Ccc = "ddd") {} ;;! ^^^-------------- (optional_parameter - type: (_) @_.leading.endOf + type: (_) @value.leading.endOf value: (_) @value ) @_.domain -;;!! enum Aaa {} -;;! ^^^^^^^^^^^ -(enum_declaration) @type +;;!! enum Foo { } +;;! ^^^^^^^^^^^^ +;;! ^ +(enum_declaration + (enum_body + "{" @interior.start.endOf @name.iteration.start.endOf @value.iteration.start.endOf + "}" @interior.end.startOf @name.iteration.end.startOf @value.iteration.end.startOf + ) +) @type @interior.domain + +;;!! enum Foo { aaa, bbb } +;;! ^^^ ^^^ +(enum_body + name: (_) @name +) + +;;!! enum Foo { aaa = 0, bbb = 1 } +;;! ^^^ ^^^ +;;! ^ ^ +(enum_assignment + name: (_) @name @value.leading.endOf + value: (_) @value +) @_.domain -;;!! function aaa(bbb: Ccc = "ddd") {} -;;! ^^^------------- +;;!! function foo(aaa: number = 0) {} +;;! ^^^------------ (required_parameter (identifier) @name ) @_.domain -;;!! function aaa(bbb?: Ccc) {} -;;! ^^^------ +;;!! function foo(aaa?: number) {} +;;! ^^^--------- (optional_parameter (identifier) @name ) @_.domain