From f0a5c9a1383fc20939bc8bb58278820f57cde7be Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 10:14:15 +0200 Subject: [PATCH 01/18] c --- .../scopes/c/name/name.function.scope | 18 ++-- .../scopes/c/name/name.function2.scope | 18 ++-- .../scopes/c/name/name.function3.scope | 18 ++-- .../scopes/c/name/name.function4.scope | 18 ++-- .../namedFunction.iteration.document.scope | 0 .../c/namedFunction/namedFunction.scope | 10 +++ .../c/namedFunction/namedFunction2.scope | 10 +++ .../c/namedFunction/namedFunction3.scope | 10 +++ .../c/namedFunction/namedFunction4.scope | 10 +++ data/fixtures/scopes/c/namedFunction2.scope | 10 --- .../c/statement/statement.assignment.scope | 10 +++ .../scopes/c/statement/statement.break.scope | 33 +++++++ .../c/statement/statement.continue.scope | 33 +++++++ .../c/statement/statement.doWhile.scope | 10 +++ .../scopes/c/statement/statement.for.scope | 10 +++ .../c/statement/statement.function.scope | 10 +++ .../c/statement/statement.function2.scope | 10 +++ .../c/statement/statement.function3.scope | 10 +++ .../c/statement/statement.function4.scope | 10 +++ .../scopes/c/statement/statement.if.scope | 15 ++++ .../scopes/c/statement/statement.return.scope | 33 +++++++ .../scopes/c/statement/statement.switch.scope | 10 +++ ...atement.scope => statement.variable.scope} | 0 .../scopes/c/statement/statement.while.scope | 10 +++ .../statement/statement.assignment.scope | 10 +++ ...atement.scope => statement.variable.scope} | 0 .../{statement.scope => statement.misc.scope} | 0 .../java/statement/statement.assignment.scope | 10 +++ ...atement.scope => statement.variable.scope} | 0 .../statement/statement.assignment.scope | 10 +++ ...atement.scope => statement.variable.scope} | 0 .../statement/statement.variable2.scope} | 6 +- ...ement.scope => statement.assignment.scope} | 0 .../python/statement/statement.variable.scope | 10 +++ .../{statement.scope => statement.misc.scope} | 0 .../scopes/talon/interior.command.scope | 4 +- ...ement.scope => statement.assignment.scope} | 22 ++--- .../scopes/talon/statement.command.scope | 26 ++++++ .../talon/statement.iteration.block.scope | 12 +-- .../scopes/talon/statement.variable.scope | 31 +++++++ packages/common/src/scopeSupportFacets/c.ts | 35 ++++++-- .../common/src/scopeSupportFacets/csharp.ts | 2 +- packages/common/src/scopeSupportFacets/css.ts | 1 - .../common/src/scopeSupportFacets/html.ts | 2 +- .../common/src/scopeSupportFacets/java.ts | 2 +- .../src/scopeSupportFacets/javascript.ts | 1 - .../common/src/scopeSupportFacets/json.ts | 2 +- .../common/src/scopeSupportFacets/markdown.ts | 2 +- .../common/src/scopeSupportFacets/python.ts | 2 +- packages/common/src/scopeSupportFacets/scm.ts | 2 +- .../scopeSupportFacetInfos.ts | 89 ++++++++++++++++++- .../scopeSupportFacets.types.ts | 22 ++++- .../common/src/scopeSupportFacets/talon.ts | 1 - packages/common/src/scopeSupportFacets/xml.ts | 1 - .../common/src/scopeSupportFacets/yaml.ts | 1 - queries/c.scm | 12 ++- 56 files changed, 551 insertions(+), 93 deletions(-) rename data/fixtures/scopes/c/{ => namedFunction}/namedFunction.iteration.document.scope (100%) create mode 100644 data/fixtures/scopes/c/namedFunction/namedFunction.scope create mode 100644 data/fixtures/scopes/c/namedFunction/namedFunction2.scope create mode 100644 data/fixtures/scopes/c/namedFunction/namedFunction3.scope create mode 100644 data/fixtures/scopes/c/namedFunction/namedFunction4.scope delete mode 100644 data/fixtures/scopes/c/namedFunction2.scope create mode 100644 data/fixtures/scopes/c/statement/statement.assignment.scope create mode 100644 data/fixtures/scopes/c/statement/statement.break.scope create mode 100644 data/fixtures/scopes/c/statement/statement.continue.scope create mode 100644 data/fixtures/scopes/c/statement/statement.doWhile.scope create mode 100644 data/fixtures/scopes/c/statement/statement.for.scope create mode 100644 data/fixtures/scopes/c/statement/statement.function.scope create mode 100644 data/fixtures/scopes/c/statement/statement.function2.scope create mode 100644 data/fixtures/scopes/c/statement/statement.function3.scope create mode 100644 data/fixtures/scopes/c/statement/statement.function4.scope create mode 100644 data/fixtures/scopes/c/statement/statement.if.scope create mode 100644 data/fixtures/scopes/c/statement/statement.return.scope create mode 100644 data/fixtures/scopes/c/statement/statement.switch.scope rename data/fixtures/scopes/c/statement/{statement.scope => statement.variable.scope} (100%) create mode 100644 data/fixtures/scopes/c/statement/statement.while.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.assignment.scope rename data/fixtures/scopes/csharp/statement/{statement.scope => statement.variable.scope} (100%) rename data/fixtures/scopes/css/{statement.scope => statement.misc.scope} (100%) create mode 100644 data/fixtures/scopes/java/statement/statement.assignment.scope rename data/fixtures/scopes/java/statement/{statement.scope => statement.variable.scope} (100%) create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.assignment.scope rename data/fixtures/scopes/javascript.core/statement/{statement.scope => statement.variable.scope} (100%) rename data/fixtures/scopes/{c/namedFunction.scope => javascript.core/statement/statement.variable2.scope} (52%) rename data/fixtures/scopes/python/statement/{statement.scope => statement.assignment.scope} (100%) create mode 100644 data/fixtures/scopes/python/statement/statement.variable.scope rename data/fixtures/scopes/scm/{statement.scope => statement.misc.scope} (100%) rename data/fixtures/scopes/talon/{statement.scope => statement.assignment.scope} (62%) create mode 100644 data/fixtures/scopes/talon/statement.command.scope create mode 100644 data/fixtures/scopes/talon/statement.variable.scope diff --git a/data/fixtures/scopes/c/name/name.function.scope b/data/fixtures/scopes/c/name/name.function.scope index 3f34e8cda7..80cde86ee4 100644 --- a/data/fixtures/scopes/c/name/name.function.scope +++ b/data/fixtures/scopes/c/name/name.function.scope @@ -1,13 +1,17 @@ -void Foo::bar() {} +void foo() {} --- [Content] = -[Removal] = 0:10-0:13 - >---< -0| void Foo::bar() {} +[Removal] = 0:5-0:8 + >---< +0| void foo() {} -[Domain] = 0:0-0:18 - >------------------< -0| void Foo::bar() {} +[Leading delimiter] = 0:4-0:5 + >-< +0| void foo() {} + +[Domain] = 0:0-0:13 + >-------------< +0| void foo() {} [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/name/name.function2.scope b/data/fixtures/scopes/c/name/name.function2.scope index fc025efe55..e65f6f8937 100644 --- a/data/fixtures/scopes/c/name/name.function2.scope +++ b/data/fixtures/scopes/c/name/name.function2.scope @@ -1,13 +1,17 @@ -void Foo::bar(); +void foo(); --- [Content] = -[Removal] = 0:10-0:13 - >---< -0| void Foo::bar(); +[Removal] = 0:5-0:8 + >---< +0| void foo(); -[Domain] = 0:0-0:16 - >----------------< -0| void Foo::bar(); +[Leading delimiter] = 0:4-0:5 + >-< +0| void foo(); + +[Domain] = 0:0-0:11 + >-----------< +0| void foo(); [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/name/name.function3.scope b/data/fixtures/scopes/c/name/name.function3.scope index 80cde86ee4..3f34e8cda7 100644 --- a/data/fixtures/scopes/c/name/name.function3.scope +++ b/data/fixtures/scopes/c/name/name.function3.scope @@ -1,17 +1,13 @@ -void foo() {} +void Foo::bar() {} --- [Content] = -[Removal] = 0:5-0:8 - >---< -0| void foo() {} +[Removal] = 0:10-0:13 + >---< +0| void Foo::bar() {} -[Leading delimiter] = 0:4-0:5 - >-< -0| void foo() {} - -[Domain] = 0:0-0:13 - >-------------< -0| void foo() {} +[Domain] = 0:0-0:18 + >------------------< +0| void Foo::bar() {} [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/name/name.function4.scope b/data/fixtures/scopes/c/name/name.function4.scope index e65f6f8937..fc025efe55 100644 --- a/data/fixtures/scopes/c/name/name.function4.scope +++ b/data/fixtures/scopes/c/name/name.function4.scope @@ -1,17 +1,13 @@ -void foo(); +void Foo::bar(); --- [Content] = -[Removal] = 0:5-0:8 - >---< -0| void foo(); +[Removal] = 0:10-0:13 + >---< +0| void Foo::bar(); -[Leading delimiter] = 0:4-0:5 - >-< -0| void foo(); - -[Domain] = 0:0-0:11 - >-----------< -0| void foo(); +[Domain] = 0:0-0:16 + >----------------< +0| void Foo::bar(); [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/namedFunction.iteration.document.scope b/data/fixtures/scopes/c/namedFunction/namedFunction.iteration.document.scope similarity index 100% rename from data/fixtures/scopes/c/namedFunction.iteration.document.scope rename to data/fixtures/scopes/c/namedFunction/namedFunction.iteration.document.scope diff --git a/data/fixtures/scopes/c/namedFunction/namedFunction.scope b/data/fixtures/scopes/c/namedFunction/namedFunction.scope new file mode 100644 index 0000000000..49b1c64940 --- /dev/null +++ b/data/fixtures/scopes/c/namedFunction/namedFunction.scope @@ -0,0 +1,10 @@ +void foo() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:13 + >-------------< +0| void foo() {} + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/c/namedFunction/namedFunction2.scope b/data/fixtures/scopes/c/namedFunction/namedFunction2.scope new file mode 100644 index 0000000000..7334bfb6e6 --- /dev/null +++ b/data/fixtures/scopes/c/namedFunction/namedFunction2.scope @@ -0,0 +1,10 @@ +void foo(); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:11 + >-----------< +0| void foo(); + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/c/namedFunction/namedFunction3.scope b/data/fixtures/scopes/c/namedFunction/namedFunction3.scope new file mode 100644 index 0000000000..334fdde13b --- /dev/null +++ b/data/fixtures/scopes/c/namedFunction/namedFunction3.scope @@ -0,0 +1,10 @@ +void Foo::bar() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:18 + >------------------< +0| void Foo::bar() {} + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/c/namedFunction/namedFunction4.scope b/data/fixtures/scopes/c/namedFunction/namedFunction4.scope new file mode 100644 index 0000000000..8ca08e4315 --- /dev/null +++ b/data/fixtures/scopes/c/namedFunction/namedFunction4.scope @@ -0,0 +1,10 @@ +void Foo::bar(); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:16 + >----------------< +0| void Foo::bar(); + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/c/namedFunction2.scope b/data/fixtures/scopes/c/namedFunction2.scope deleted file mode 100644 index d611a7619f..0000000000 --- a/data/fixtures/scopes/c/namedFunction2.scope +++ /dev/null @@ -1,10 +0,0 @@ -int foo(); ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:10 - >----------< -0| int foo(); - -[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/c/statement/statement.assignment.scope b/data/fixtures/scopes/c/statement/statement.assignment.scope new file mode 100644 index 0000000000..552bf9f507 --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.assignment.scope @@ -0,0 +1,10 @@ +foo = 0; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:8 + >--------< +0| foo = 0; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.break.scope b/data/fixtures/scopes/c/statement/statement.break.scope new file mode 100644 index 0000000000..c81ea40ae7 --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.break.scope @@ -0,0 +1,33 @@ +while (true) { + break; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >-------------- +0| while (true) { +1| break; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:10 + >------< +1| break; + +[#2 Removal] = 1:0-2:0 + >---------- +1| break; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| break; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.continue.scope b/data/fixtures/scopes/c/statement/statement.continue.scope new file mode 100644 index 0000000000..8715a90063 --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.continue.scope @@ -0,0 +1,33 @@ +while (true) { + continue; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >-------------- +0| while (true) { +1| continue; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:13 + >---------< +1| continue; + +[#2 Removal] = 1:0-2:0 + >------------- +1| continue; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| continue; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.doWhile.scope b/data/fixtures/scopes/c/statement/statement.doWhile.scope new file mode 100644 index 0000000000..e1e74c9153 --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.doWhile.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/c/statement/statement.for.scope b/data/fixtures/scopes/c/statement/statement.for.scope new file mode 100644 index 0000000000..0094536004 --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.for.scope @@ -0,0 +1,10 @@ +for (int i = 0; i < size; i++) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:33 + >---------------------------------< +0| for (int i = 0; i < size; i++) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.function.scope b/data/fixtures/scopes/c/statement/statement.function.scope new file mode 100644 index 0000000000..1eb8467630 --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.function.scope @@ -0,0 +1,10 @@ +void foo() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:13 + >-------------< +0| void foo() {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.function2.scope b/data/fixtures/scopes/c/statement/statement.function2.scope new file mode 100644 index 0000000000..205c2db59a --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.function2.scope @@ -0,0 +1,10 @@ +void foo(); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:11 + >-----------< +0| void foo(); + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.function3.scope b/data/fixtures/scopes/c/statement/statement.function3.scope new file mode 100644 index 0000000000..641385cc09 --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.function3.scope @@ -0,0 +1,10 @@ +void Foo::bar() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:18 + >------------------< +0| void Foo::bar() {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.function4.scope b/data/fixtures/scopes/c/statement/statement.function4.scope new file mode 100644 index 0000000000..b1f39eb2cd --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.function4.scope @@ -0,0 +1,10 @@ +void Foo::bar(); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:16 + >----------------< +0| void Foo::bar(); + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.if.scope b/data/fixtures/scopes/c/statement/statement.if.scope new file mode 100644 index 0000000000..14f2507621 --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.if.scope @@ -0,0 +1,15 @@ +if (true) {} +else if (false) {} +else {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:7 + >------------ +0| if (true) {} +1| else if (false) {} +2| else {} + -------< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.return.scope b/data/fixtures/scopes/c/statement/statement.return.scope new file mode 100644 index 0000000000..3fd055f39b --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.return.scope @@ -0,0 +1,33 @@ +int foo() { + return 0; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| int foo() { +1| return 0; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:13 + >---------< +1| return 0; + +[#2 Removal] = 1:0-2:0 + >------------- +1| return 0; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| return 0; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.switch.scope b/data/fixtures/scopes/c/statement/statement.switch.scope new file mode 100644 index 0000000000..bcd2bb4acb --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.switch.scope @@ -0,0 +1,10 @@ +switch (foo) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:15 + >---------------< +0| switch (foo) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/statement/statement.scope b/data/fixtures/scopes/c/statement/statement.variable.scope similarity index 100% rename from data/fixtures/scopes/c/statement/statement.scope rename to data/fixtures/scopes/c/statement/statement.variable.scope diff --git a/data/fixtures/scopes/c/statement/statement.while.scope b/data/fixtures/scopes/c/statement/statement.while.scope new file mode 100644 index 0000000000..5aaf57be8f --- /dev/null +++ b/data/fixtures/scopes/c/statement/statement.while.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/csharp/statement/statement.assignment.scope b/data/fixtures/scopes/csharp/statement/statement.assignment.scope new file mode 100644 index 0000000000..552bf9f507 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.assignment.scope @@ -0,0 +1,10 @@ +foo = 0; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:8 + >--------< +0| foo = 0; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.scope b/data/fixtures/scopes/csharp/statement/statement.variable.scope similarity index 100% rename from data/fixtures/scopes/csharp/statement/statement.scope rename to data/fixtures/scopes/csharp/statement/statement.variable.scope diff --git a/data/fixtures/scopes/css/statement.scope b/data/fixtures/scopes/css/statement.misc.scope similarity index 100% rename from data/fixtures/scopes/css/statement.scope rename to data/fixtures/scopes/css/statement.misc.scope diff --git a/data/fixtures/scopes/java/statement/statement.assignment.scope b/data/fixtures/scopes/java/statement/statement.assignment.scope new file mode 100644 index 0000000000..552bf9f507 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.assignment.scope @@ -0,0 +1,10 @@ +foo = 0; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:8 + >--------< +0| foo = 0; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.scope b/data/fixtures/scopes/java/statement/statement.variable.scope similarity index 100% rename from data/fixtures/scopes/java/statement/statement.scope rename to data/fixtures/scopes/java/statement/statement.variable.scope diff --git a/data/fixtures/scopes/javascript.core/statement/statement.assignment.scope b/data/fixtures/scopes/javascript.core/statement/statement.assignment.scope new file mode 100644 index 0000000000..552bf9f507 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.assignment.scope @@ -0,0 +1,10 @@ +foo = 0; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:8 + >--------< +0| foo = 0; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.scope b/data/fixtures/scopes/javascript.core/statement/statement.variable.scope similarity index 100% rename from data/fixtures/scopes/javascript.core/statement/statement.scope rename to data/fixtures/scopes/javascript.core/statement/statement.variable.scope diff --git a/data/fixtures/scopes/c/namedFunction.scope b/data/fixtures/scopes/javascript.core/statement/statement.variable2.scope similarity index 52% rename from data/fixtures/scopes/c/namedFunction.scope rename to data/fixtures/scopes/javascript.core/statement/statement.variable2.scope index 74e8628bdc..cebc33100e 100644 --- a/data/fixtures/scopes/c/namedFunction.scope +++ b/data/fixtures/scopes/javascript.core/statement/statement.variable2.scope @@ -1,10 +1,10 @@ -int foo() {} +let foo = 0; --- [Content] = [Removal] = [Domain] = 0:0-0:12 >------------< -0| int foo() {} +0| let foo = 0; -[Insertion delimiter] = "\n\n" +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.scope b/data/fixtures/scopes/python/statement/statement.assignment.scope similarity index 100% rename from data/fixtures/scopes/python/statement/statement.scope rename to data/fixtures/scopes/python/statement/statement.assignment.scope diff --git a/data/fixtures/scopes/python/statement/statement.variable.scope b/data/fixtures/scopes/python/statement/statement.variable.scope new file mode 100644 index 0000000000..acdb2b1498 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.variable.scope @@ -0,0 +1,10 @@ +foo = 0 +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:7 + >-------< +0| foo = 0 + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/scm/statement.scope b/data/fixtures/scopes/scm/statement.misc.scope similarity index 100% rename from data/fixtures/scopes/scm/statement.scope rename to data/fixtures/scopes/scm/statement.misc.scope diff --git a/data/fixtures/scopes/talon/interior.command.scope b/data/fixtures/scopes/talon/interior.command.scope index 415e113c23..3d89dc2f3e 100644 --- a/data/fixtures/scopes/talon/interior.command.scope +++ b/data/fixtures/scopes/talon/interior.command.scope @@ -1,5 +1,5 @@ -command: - foo = 0 +foo: + bar = 0 --- [Content] = diff --git a/data/fixtures/scopes/talon/statement.scope b/data/fixtures/scopes/talon/statement.assignment.scope similarity index 62% rename from data/fixtures/scopes/talon/statement.scope rename to data/fixtures/scopes/talon/statement.assignment.scope index 6a5a9a2ff7..222847c401 100644 --- a/data/fixtures/scopes/talon/statement.scope +++ b/data/fixtures/scopes/talon/statement.assignment.scope @@ -1,13 +1,13 @@ -command: - foo = 0 +foo: + bar = 0 --- [#1 Content] = [#1 Removal] = [#1 Domain] = 0:0-1:11 - >-------- -0| command: -1| foo = 0 + >---- +0| foo: +1| bar = 0 -----------< [#1 Insertion delimiter] = "\n" @@ -16,16 +16,16 @@ command: [#2 Content] = [#2 Domain] = 1:4-1:11 >-------< -1| foo = 0 +1| bar = 0 -[#2 Removal] = 0:8-1:11 - > -0| command: -1| foo = 0 +[#2 Removal] = 0:4-1:11 + > +0| foo: +1| bar = 0 -----------< [#2 Leading delimiter] = 1:0-1:4 >----< -1| foo = 0 +1| bar = 0 [#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/talon/statement.command.scope b/data/fixtures/scopes/talon/statement.command.scope new file mode 100644 index 0000000000..95d8e05b2d --- /dev/null +++ b/data/fixtures/scopes/talon/statement.command.scope @@ -0,0 +1,26 @@ +foo: "bar" +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-0:10 + >----------< +0| foo: "bar" + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 0:5-0:10 + >-----< +0| foo: "bar" + +[#2 Removal] = 0:4-0:10 + >------< +0| foo: "bar" + +[#2 Leading delimiter] = 0:4-0:5 + >-< +0| foo: "bar" + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/talon/statement.iteration.block.scope b/data/fixtures/scopes/talon/statement.iteration.block.scope index 02bd0ff62b..a3fcadf03d 100644 --- a/data/fixtures/scopes/talon/statement.iteration.block.scope +++ b/data/fixtures/scopes/talon/statement.iteration.block.scope @@ -1,16 +1,16 @@ -command: - foo = 0 +foo: + bar = 0 --- [#1 Content] = [#1 Domain] = 0:0-1:11 - >-------- -0| command: -1| foo = 0 + >---- +0| foo: +1| bar = 0 -----------< [#2 Content] = [#2 Domain] = 1:4-1:11 >-------< -1| foo = 0 +1| bar = 0 diff --git a/data/fixtures/scopes/talon/statement.variable.scope b/data/fixtures/scopes/talon/statement.variable.scope new file mode 100644 index 0000000000..222847c401 --- /dev/null +++ b/data/fixtures/scopes/talon/statement.variable.scope @@ -0,0 +1,31 @@ +foo: + bar = 0 +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-1:11 + >---- +0| foo: +1| bar = 0 + -----------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:11 + >-------< +1| bar = 0 + +[#2 Removal] = 0:4-1:11 + > +0| foo: +1| bar = 0 + -----------< + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| bar = 0 + +[#2 Insertion delimiter] = "\n" diff --git a/packages/common/src/scopeSupportFacets/c.ts b/packages/common/src/scopeSupportFacets/c.ts index 5e7cd84952..825a03d95d 100644 --- a/packages/common/src/scopeSupportFacets/c.ts +++ b/packages/common/src/scopeSupportFacets/c.ts @@ -8,10 +8,22 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { disqualifyDelimiter: supported, ifStatement: supported, - statement: supported, + "statement.class": supported, "statement.enum": supported, "statement.field.class": supported, + "statement.function": supported, + "statement.if": supported, + "statement.switch": supported, + "statement.for": supported, + "statement.while": supported, + "statement.doWhile": supported, + "statement.variable": supported, + "statement.assignment": supported, + "statement.return": supported, + "statement.break": supported, + "statement.continue": supported, + "statement.namespace": supported, "statement.iteration.document": supported, "statement.iteration.class": supported, "statement.iteration.block": supported, @@ -134,6 +146,7 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { "textFragment.element": notApplicable, // Resource syntax + "statement.resource": notApplicable, "interior.resource": notApplicable, "type.resource": notApplicable, "type.resource.iteration": notApplicable, @@ -171,6 +184,7 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, @@ -187,6 +201,7 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { "class.iteration.block": notApplicable, // Try catch + "statement.try": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, "interior.try": notApplicable, @@ -206,12 +221,18 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { "type.iteration.interface": notApplicable, "interior.interface": notApplicable, + // Static + "statement.static": notApplicable, + "interior.static": notApplicable, + + // Yield + "statement.yield": notApplicable, + "value.yield": notApplicable, + // Miscellaneous "key.attribute": notApplicable, "value.attribute": notApplicable, - "value.yield": notApplicable, "value.field.class": notApplicable, - "interior.static": notApplicable, "branch.loop": notApplicable, "branch.loop.iteration": notApplicable, environment: notApplicable, @@ -260,6 +281,7 @@ export const cScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.formal.constructor": notApplicable, "name.constructor": notApplicable, "namedFunction.constructor": notApplicable, + "statement.constructor": notApplicable, "type.argument.formal.constructor.iteration": notApplicable, "type.argument.formal.constructor": notApplicable, "value.argument.formal.constructor.iteration": notApplicable, @@ -267,6 +289,9 @@ export const cScopeSupport: LanguageScopeSupportFacetMap = { "interior.constructor": notApplicable, // Method + "namedFunction.method": notApplicable, + "namedFunction.iteration.class": notApplicable, + "statement.method": notApplicable, "argument.formal.method.iteration": notApplicable, "argument.formal.method.singleLine": notApplicable, "argument.formal.method.multiLine": notApplicable, @@ -276,8 +301,6 @@ export const cScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.formal.method.iteration": notApplicable, "name.argument.formal.method": notApplicable, "name.method": notApplicable, - "namedFunction.iteration.class": notApplicable, - "namedFunction.method": notApplicable, "type.argument.formal.method.iteration": notApplicable, "type.argument.formal.method": notApplicable, "value.argument.formal.method.iteration": notApplicable, @@ -285,6 +308,7 @@ export const cScopeSupport: LanguageScopeSupportFacetMap = { "interior.method": notApplicable, // Foreach + "statement.foreach": notApplicable, "name.foreach": notApplicable, "type.foreach": notApplicable, "value.foreach": notApplicable, @@ -299,6 +323,7 @@ export const cScopeSupport: LanguageScopeSupportFacetMap = { "type.typeArgument.iteration": notApplicable, // Namespace + "statement.namespace": notApplicable, "name.namespace": notApplicable, "interior.namespace": notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index 22fac31308..b5ecd28a21 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -167,7 +167,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "argument.catch": supported, ifStatement: supported, - statement: supported, + "statement.class": supported, "statement.interface": supported, "statement.enum": supported, diff --git a/packages/common/src/scopeSupportFacets/css.ts b/packages/common/src/scopeSupportFacets/css.ts index f2be42cfbf..a8bc65ee00 100644 --- a/packages/common/src/scopeSupportFacets/css.ts +++ b/packages/common/src/scopeSupportFacets/css.ts @@ -34,7 +34,6 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "collectionItem.unenclosed": supported, "collectionItem.unenclosed.iteration": supported, - statement: supported, "statement.iteration.document": supported, selector: supported, diff --git a/packages/common/src/scopeSupportFacets/html.ts b/packages/common/src/scopeSupportFacets/html.ts index 284c0e1903..d1ea8e1d74 100644 --- a/packages/common/src/scopeSupportFacets/html.ts +++ b/packages/common/src/scopeSupportFacets/html.ts @@ -241,7 +241,7 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { pairDelimiter: notApplicable, regularExpression: notApplicable, section: notApplicable, - statement: notApplicable, + selector: notApplicable, unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/java.ts b/packages/common/src/scopeSupportFacets/java.ts index d2e6e53cf4..4fb7958bae 100644 --- a/packages/common/src/scopeSupportFacets/java.ts +++ b/packages/common/src/scopeSupportFacets/java.ts @@ -86,7 +86,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "namedFunction.iteration.class": supported, ifStatement: supported, - statement: supported, + "statement.class": supported, "statement.interface": supported, "statement.enum": supported, diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index e1cd225675..aa956ff9b4 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -21,7 +21,6 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, - statement: supported, "statement.class": supported, "statement.field.class": supported, "statement.iteration.document": supported, diff --git a/packages/common/src/scopeSupportFacets/json.ts b/packages/common/src/scopeSupportFacets/json.ts index 89c9aa4410..680802f246 100644 --- a/packages/common/src/scopeSupportFacets/json.ts +++ b/packages/common/src/scopeSupportFacets/json.ts @@ -200,7 +200,7 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, startTag: notApplicable, - statement: notApplicable, + "statement.iteration.block": notApplicable, "statement.iteration.document": notApplicable, "string.multiLine": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/markdown.ts b/packages/common/src/scopeSupportFacets/markdown.ts index 8a93ba90d4..7126a20c41 100644 --- a/packages/common/src/scopeSupportFacets/markdown.ts +++ b/packages/common/src/scopeSupportFacets/markdown.ts @@ -194,7 +194,7 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { pairDelimiter: notApplicable, regularExpression: notApplicable, startTag: notApplicable, - statement: notApplicable, + "statement.iteration.block": notApplicable, "statement.iteration.document": notApplicable, "string.multiLine": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index c72614305c..f968c851f7 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -175,7 +175,7 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { "textFragment.string.singleLine": supported, ifStatement: supported, - statement: supported, + "statement.class": supported, "statement.field.class": supported, "statement.iteration.block": supported, diff --git a/packages/common/src/scopeSupportFacets/scm.ts b/packages/common/src/scopeSupportFacets/scm.ts index 42a7ac3492..cb098ae2b8 100644 --- a/packages/common/src/scopeSupportFacets/scm.ts +++ b/packages/common/src/scopeSupportFacets/scm.ts @@ -4,7 +4,7 @@ import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types"; const { supported, notApplicable } = ScopeSupportFacetLevel; export const scmScopeSupport: LanguageScopeSupportFacetMap = { - statement: supported, + "statement.misc": supported, list: supported, "argument.actual.singleLine": supported, diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index f1504fdd65..0218299d4e 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -70,10 +70,6 @@ export const scopeSupportFacetInfos: Record< scopeType: "ifStatement", }, - statement: { - description: "A statement, eg assignment, for loop, etc", - scopeType: "statement", - }, "statement.class": { description: "A class declaration", scopeType: "statement", @@ -94,6 +90,91 @@ export const scopeSupportFacetInfos: Record< description: "A field declaration in a interface", scopeType: "statement", }, + "statement.function": { + description: "A named function declaration", + scopeType: "statement", + }, + "statement.constructor": { + description: "A constructor declaration", + scopeType: "statement", + }, + "statement.method": { + description: "A method declaration", + scopeType: "statement", + }, + "statement.if": { + description: "A if/elif/else statement", + scopeType: "statement", + }, + "statement.try": { + description: "A try/catch/finally statement", + scopeType: "statement", + }, + "statement.switch": { + description: "A switch statement", + scopeType: "statement", + }, + "statement.for": { + description: "A for loop statement", + scopeType: "statement", + }, + "statement.foreach": { + description: "A for-each loop statement", + scopeType: "statement", + }, + "statement.while": { + description: "A while loop statement", + scopeType: "statement", + }, + "statement.doWhile": { + description: "A do-while loop statement", + scopeType: "statement", + }, + "statement.variable": { + description: "A variable declaration", + scopeType: "statement", + }, + "statement.assignment": { + description: "An assignment statement", + scopeType: "statement", + }, + "statement.return": { + description: "A return statement", + scopeType: "statement", + }, + "statement.yield": { + description: "A yield statement", + scopeType: "statement", + }, + "statement.break": { + description: "A break statement", + scopeType: "statement", + }, + "statement.continue": { + description: "A continue statement", + scopeType: "statement", + }, + "statement.resource": { + description: "A 'with' / 'use' / 'using' statement", + scopeType: "statement", + }, + "statement.command": { + description: "A command statement, eg Talon spoken command or bash", + scopeType: "statement", + }, + "statement.namespace": { + description: "A namespace declaration", + scopeType: "statement", + }, + "statement.static": { + description: "A static statement", + scopeType: "statement", + }, + "statement.misc": { + description: "A miscellaneous statement", + scopeType: "statement", + }, + "statement.iteration.document": documentIter("statement", "statements"), "statement.iteration.class": classIter("statement", "statements"), "statement.iteration.interface": interfaceIter("statement", "statements"), diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index 5677a8aa86..12892016fa 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -26,12 +26,32 @@ export const scopeSupportFacets = [ "ifStatement", - "statement", "statement.class", "statement.interface", "statement.enum", "statement.field.class", "statement.field.interface", + "statement.function", + "statement.constructor", + "statement.method", + "statement.if", + "statement.try", + "statement.switch", + "statement.for", + "statement.foreach", + "statement.while", + "statement.doWhile", + "statement.variable", + "statement.assignment", + "statement.return", + "statement.yield", + "statement.break", + "statement.continue", + "statement.resource", + "statement.command", + "statement.namespace", + "statement.static", + "statement.misc", "statement.iteration.document", "statement.iteration.class", "statement.iteration.interface", diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index c3e2247715..0d75ca9aac 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -32,7 +32,6 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "value.iteration.document": supported, command: supported, - statement: supported, "string.singleLine": supported, diff --git a/packages/common/src/scopeSupportFacets/xml.ts b/packages/common/src/scopeSupportFacets/xml.ts index 243ff64733..02e14301ea 100644 --- a/packages/common/src/scopeSupportFacets/xml.ts +++ b/packages/common/src/scopeSupportFacets/xml.ts @@ -196,7 +196,6 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { section: notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, - statement: notApplicable, "statement.iteration.block": notApplicable, "statement.iteration.document": notApplicable, "string.multiLine": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/yaml.ts b/packages/common/src/scopeSupportFacets/yaml.ts index e24208433e..b3ee2219a7 100644 --- a/packages/common/src/scopeSupportFacets/yaml.ts +++ b/packages/common/src/scopeSupportFacets/yaml.ts @@ -204,7 +204,6 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, startTag: notApplicable, - statement: notApplicable, "statement.iteration.block": notApplicable, "statement.iteration.document": notApplicable, tags: notApplicable, diff --git a/queries/c.scm b/queries/c.scm index 2cc6b2524e..ef8b688fcd 100644 --- a/queries/c.scm +++ b/queries/c.scm @@ -3,7 +3,6 @@ ;; Generated by the following command: ;; > curl https://raw.githubusercontent.com/tree-sitter/tree-sitter-cpp/master/src/node-types.json | jq '[.[] | select(.type == "compound_statement") | .children.types[].type] + [.[] | select(.type == "_statement") | .subtypes[].type]' [ - (declaration) (function_definition) (linkage_specification) (preproc_call) @@ -14,7 +13,6 @@ (preproc_include) (type_definition) (break_statement) - (case_statement) (continue_statement) (do_statement) (expression_statement) @@ -24,12 +22,20 @@ (return_statement) (switch_statement) (while_statement) + ;; Disabled on purpose + ;; (case_statement) ;; Disabled on purpose. This is the entire body of statements. ;; (compound_statement) - ;; Disabled on purpose. We have a better definition of this below. + ;; Disabled on purpose. We have a better definition of these below. ;; (if_statement) + ;; (declaration) ] @statement +( + (declaration) @statement + (#not-parent-type? @statement for_statement) +) + ( (translation_unit) @statement.iteration @class.iteration @namedFunction.iteration (#document-range! @statement.iteration @class.iteration @namedFunction.iteration) From a6b95aa44f95027fe88d550d99ce6df8fee21a61 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 10:39:06 +0200 Subject: [PATCH 02/18] Ran meta updater --- data/scopeSupportFacetInfos.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/data/scopeSupportFacetInfos.md b/data/scopeSupportFacetInfos.md index 6ac53724b6..47e5f50965 100644 --- a/data/scopeSupportFacetInfos.md +++ b/data/scopeSupportFacetInfos.md @@ -285,16 +285,36 @@ ### statement -- `statement` A statement, eg assignment, for loop, etc +- `statement.assignment` An assignment statement +- `statement.break` A break statement - `statement.class` A class declaration +- `statement.command` A command statement, eg Talon spoken command or bash +- `statement.constructor` A constructor declaration +- `statement.continue` A continue statement +- `statement.doWhile` A do-while loop statement - `statement.enum` An enum declaration - `statement.field.class` A field declaration in a class - `statement.field.interface` A field declaration in a interface +- `statement.for` A for loop statement +- `statement.foreach` A for-each loop statement +- `statement.function` A named function declaration +- `statement.if` A if/elif/else statement - `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. - `statement.iteration.interface` Iteration scope for statements: interface bodies. +- `statement.method` A method declaration +- `statement.misc` A miscellaneous statement +- `statement.namespace` A namespace declaration +- `statement.resource` A 'with' / 'use' / 'using' statement +- `statement.return` A return statement +- `statement.static` A static statement +- `statement.switch` A switch statement +- `statement.try` A try/catch/finally statement +- `statement.variable` A variable declaration +- `statement.while` A while loop statement +- `statement.yield` A yield statement ### string From 4be666dac7ca044d07671f751e4d5d0293543c20 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 10:49:26 +0200 Subject: [PATCH 03/18] cpp --- .../scopes/c/value/value.switch.scope | 14 ++++---- .../scopes/cpp/name/name.namespace.scope | 16 ++++----- .../cpp/{ => statement}/statement.class.scope | 0 .../cpp/statement/statement.constructor.scope | 33 +++++++++++++++++++ .../statement/statement.constructor2.scope | 33 +++++++++++++++++++ .../cpp/{ => statement}/statement.enum.scope | 0 .../cpp/statement/statement.foreach.scope | 10 ++++++ .../statement.iteration.class.scope | 0 .../cpp/statement/statement.method.scope | 33 +++++++++++++++++++ .../cpp/statement/statement.namespace.scope | 10 ++++++ .../scopes/cpp/statement/statement.try.scope | 13 ++++++++ .../scopes/cpp/value/value.switch.scope | 13 -------- packages/common/src/scopeSupportFacets/c.ts | 18 +++++----- packages/common/src/scopeSupportFacets/cpp.ts | 5 +++ 14 files changed, 161 insertions(+), 37 deletions(-) rename data/fixtures/scopes/cpp/{ => statement}/statement.class.scope (100%) create mode 100644 data/fixtures/scopes/cpp/statement/statement.constructor.scope create mode 100644 data/fixtures/scopes/cpp/statement/statement.constructor2.scope rename data/fixtures/scopes/cpp/{ => statement}/statement.enum.scope (100%) create mode 100644 data/fixtures/scopes/cpp/statement/statement.foreach.scope rename data/fixtures/scopes/cpp/{ => statement}/statement.iteration.class.scope (100%) create mode 100644 data/fixtures/scopes/cpp/statement/statement.method.scope create mode 100644 data/fixtures/scopes/cpp/statement/statement.namespace.scope create mode 100644 data/fixtures/scopes/cpp/statement/statement.try.scope delete mode 100644 data/fixtures/scopes/cpp/value/value.switch.scope diff --git a/data/fixtures/scopes/c/value/value.switch.scope b/data/fixtures/scopes/c/value/value.switch.scope index 67688ae8d0..16325fcb1f 100644 --- a/data/fixtures/scopes/c/value/value.switch.scope +++ b/data/fixtures/scopes/c/value/value.switch.scope @@ -1,13 +1,13 @@ -switch (value) {} +switch (foo) {} --- [Content] = -[Removal] = 0:8-0:13 - >-----< -0| switch (value) {} +[Removal] = 0:8-0:11 + >---< +0| switch (foo) {} -[Domain] = 0:0-0:17 - >-----------------< -0| switch (value) {} +[Domain] = 0:0-0:15 + >---------------< +0| switch (foo) {} [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/name/name.namespace.scope b/data/fixtures/scopes/cpp/name/name.namespace.scope index 12f853ed95..b5c970c528 100644 --- a/data/fixtures/scopes/cpp/name/name.namespace.scope +++ b/data/fixtures/scopes/cpp/name/name.namespace.scope @@ -1,24 +1,24 @@ -namespace Foo { } +namespace Foo {} --- [Content] = 0:10-0:13 >---< -0| namespace Foo { } +0| namespace Foo {} [Removal] = 0:10-0:14 >----< -0| namespace Foo { } +0| namespace Foo {} [Leading delimiter] = 0:9-0:10 >-< -0| namespace Foo { } +0| namespace Foo {} [Trailing delimiter] = 0:13-0:14 >-< -0| namespace Foo { } +0| namespace Foo {} -[Domain] = 0:0-0:17 - >-----------------< -0| namespace Foo { } +[Domain] = 0:0-0:16 + >----------------< +0| namespace Foo {} [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/statement.class.scope b/data/fixtures/scopes/cpp/statement/statement.class.scope similarity index 100% rename from data/fixtures/scopes/cpp/statement.class.scope rename to data/fixtures/scopes/cpp/statement/statement.class.scope diff --git a/data/fixtures/scopes/cpp/statement/statement.constructor.scope b/data/fixtures/scopes/cpp/statement/statement.constructor.scope new file mode 100644 index 0000000000..4a301a6e97 --- /dev/null +++ b/data/fixtures/scopes/cpp/statement/statement.constructor.scope @@ -0,0 +1,33 @@ +class Foo { + Foo() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| class Foo { +1| Foo() {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:12 + >--------< +1| Foo() {} + +[#2 Removal] = 1:0-2:0 + >------------ +1| Foo() {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| Foo() {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/cpp/statement/statement.constructor2.scope b/data/fixtures/scopes/cpp/statement/statement.constructor2.scope new file mode 100644 index 0000000000..cf1c7b4c41 --- /dev/null +++ b/data/fixtures/scopes/cpp/statement/statement.constructor2.scope @@ -0,0 +1,33 @@ +class Foo { + ~Foo() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| class Foo { +1| ~Foo() {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:13 + >---------< +1| ~Foo() {} + +[#2 Removal] = 1:0-2:0 + >------------- +1| ~Foo() {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| ~Foo() {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/cpp/statement.enum.scope b/data/fixtures/scopes/cpp/statement/statement.enum.scope similarity index 100% rename from data/fixtures/scopes/cpp/statement.enum.scope rename to data/fixtures/scopes/cpp/statement/statement.enum.scope diff --git a/data/fixtures/scopes/cpp/statement/statement.foreach.scope b/data/fixtures/scopes/cpp/statement/statement.foreach.scope new file mode 100644 index 0000000000..2a65914bfb --- /dev/null +++ b/data/fixtures/scopes/cpp/statement/statement.foreach.scope @@ -0,0 +1,10 @@ +for (int v : values) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:23 + >-----------------------< +0| for (int v : values) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/cpp/statement.iteration.class.scope b/data/fixtures/scopes/cpp/statement/statement.iteration.class.scope similarity index 100% rename from data/fixtures/scopes/cpp/statement.iteration.class.scope rename to data/fixtures/scopes/cpp/statement/statement.iteration.class.scope diff --git a/data/fixtures/scopes/cpp/statement/statement.method.scope b/data/fixtures/scopes/cpp/statement/statement.method.scope new file mode 100644 index 0000000000..16d0cf1c55 --- /dev/null +++ b/data/fixtures/scopes/cpp/statement/statement.method.scope @@ -0,0 +1,33 @@ +class Foo { + void bar() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| class Foo { +1| void bar() {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:17 + >-------------< +1| void bar() {} + +[#2 Removal] = 1:0-2:0 + >----------------- +1| void bar() {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| void bar() {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/cpp/statement/statement.namespace.scope b/data/fixtures/scopes/cpp/statement/statement.namespace.scope new file mode 100644 index 0000000000..e62dcbdb0a --- /dev/null +++ b/data/fixtures/scopes/cpp/statement/statement.namespace.scope @@ -0,0 +1,10 @@ +namespace Foo {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:16 + >----------------< +0| namespace Foo {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/cpp/statement/statement.try.scope b/data/fixtures/scopes/cpp/statement/statement.try.scope new file mode 100644 index 0000000000..395e1ec8fb --- /dev/null +++ b/data/fixtures/scopes/cpp/statement/statement.try.scope @@ -0,0 +1,13 @@ +try {} +catch (const std::exception& e) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-1:34 + >------ +0| try {} +1| catch (const std::exception& e) {} + ----------------------------------< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/cpp/value/value.switch.scope b/data/fixtures/scopes/cpp/value/value.switch.scope deleted file mode 100644 index 67688ae8d0..0000000000 --- a/data/fixtures/scopes/cpp/value/value.switch.scope +++ /dev/null @@ -1,13 +0,0 @@ -switch (value) {} ---- - -[Content] = -[Removal] = 0:8-0:13 - >-----< -0| switch (value) {} - -[Domain] = 0:0-0:17 - >-----------------< -0| switch (value) {} - -[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/c.ts b/packages/common/src/scopeSupportFacets/c.ts index 825a03d95d..2ad3e6f1f2 100644 --- a/packages/common/src/scopeSupportFacets/c.ts +++ b/packages/common/src/scopeSupportFacets/c.ts @@ -200,15 +200,6 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { // Nested class "class.iteration.block": notApplicable, - // Try catch - "statement.try": notApplicable, - "branch.try": notApplicable, - "branch.try.iteration": notApplicable, - "interior.try": notApplicable, - "argument.catch": notApplicable, - "name.argument.catch": notApplicable, - "type.argument.catch": notApplicable, - // Interface "statement.interface": notApplicable, "statement.field.interface": notApplicable, @@ -307,6 +298,15 @@ export const cScopeSupport: LanguageScopeSupportFacetMap = { "value.argument.formal.method": notApplicable, "interior.method": notApplicable, + // Try catch + "statement.try": notApplicable, + "branch.try": notApplicable, + "branch.try.iteration": notApplicable, + "interior.try": notApplicable, + "argument.catch": notApplicable, + "name.argument.catch": notApplicable, + "type.argument.catch": notApplicable, + // Foreach "statement.foreach": notApplicable, "name.foreach": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/cpp.ts b/packages/common/src/scopeSupportFacets/cpp.ts index a1855015f8..990a75214c 100644 --- a/packages/common/src/scopeSupportFacets/cpp.ts +++ b/packages/common/src/scopeSupportFacets/cpp.ts @@ -10,6 +10,11 @@ export const cppScopeSupport: LanguageScopeSupportFacetMap = { attribute: supported, anonymousFunction: supported, + "statement.try": supported, + "statement.foreach": supported, + "statement.constructor": supported, + "statement.method": supported, + "branch.try": supported, "branch.try.iteration": supported, From b07f99963edeca007b5db5b00fbabdd3b0f1f2e1 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 11:10:26 +0200 Subject: [PATCH 04/18] Added support to pass tests --- data/fixtures/scopes/talon/interior.command.scope | 8 ++++---- packages/common/src/scopeSupportFacets/csharp.ts | 2 ++ packages/common/src/scopeSupportFacets/css.ts | 1 + packages/common/src/scopeSupportFacets/java.ts | 2 ++ packages/common/src/scopeSupportFacets/javascript.ts | 2 ++ packages/common/src/scopeSupportFacets/python.ts | 2 ++ packages/common/src/scopeSupportFacets/talon.ts | 3 +++ 7 files changed, 16 insertions(+), 4 deletions(-) diff --git a/data/fixtures/scopes/talon/interior.command.scope b/data/fixtures/scopes/talon/interior.command.scope index 3d89dc2f3e..1f3a9d4c54 100644 --- a/data/fixtures/scopes/talon/interior.command.scope +++ b/data/fixtures/scopes/talon/interior.command.scope @@ -5,12 +5,12 @@ foo: [Content] = [Removal] = 1:4-1:11 >-------< -1| foo = 0 +1| bar = 0 [Domain] = 0:0-1:11 - >-------- -0| command: -1| foo = 0 + >---- +0| foo: +1| bar = 0 -----------< [Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index b5ecd28a21..573af3124e 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -171,6 +171,8 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "statement.class": supported, "statement.interface": supported, "statement.enum": supported, + "statement.assignment": supported, + "statement.variable": supported, "statement.field.class": supported, "statement.field.interface": supported, "statement.iteration.block": supported, diff --git a/packages/common/src/scopeSupportFacets/css.ts b/packages/common/src/scopeSupportFacets/css.ts index a8bc65ee00..3c1baaf2af 100644 --- a/packages/common/src/scopeSupportFacets/css.ts +++ b/packages/common/src/scopeSupportFacets/css.ts @@ -34,6 +34,7 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "collectionItem.unenclosed": supported, "collectionItem.unenclosed.iteration": supported, + "statement.misc": supported, "statement.iteration.document": supported, selector: supported, diff --git a/packages/common/src/scopeSupportFacets/java.ts b/packages/common/src/scopeSupportFacets/java.ts index 4fb7958bae..b656358111 100644 --- a/packages/common/src/scopeSupportFacets/java.ts +++ b/packages/common/src/scopeSupportFacets/java.ts @@ -90,6 +90,8 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "statement.class": supported, "statement.interface": supported, "statement.enum": supported, + "statement.variable": supported, + "statement.assignment": supported, "statement.field.class": supported, "statement.field.interface": supported, "statement.iteration.block": supported, diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index aa956ff9b4..f9f44d097d 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -22,6 +22,8 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, "statement.class": supported, + "statement.variable": supported, + "statement.assignment": supported, "statement.field.class": supported, "statement.iteration.document": supported, "statement.iteration.class": supported, diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index f968c851f7..a42646a929 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -177,6 +177,8 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, "statement.class": supported, + "statement.variable": supported, + "statement.assignment": supported, "statement.field.class": supported, "statement.iteration.block": supported, "statement.iteration.class": supported, diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index 0d75ca9aac..9a881e112c 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -22,6 +22,9 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "name.iteration.block": supported, "name.iteration.document": supported, + "statement.command": supported, + "statement.variable": supported, + "statement.assignment": supported, "statement.iteration.block": supported, "statement.iteration.document": supported, From 86b8791e588ced66d75a580712eb37b54aa8fb0e Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 11:53:14 +0200 Subject: [PATCH 05/18] css html markdown xml yaml --- .../argument/argument.actual.multiLine.scope | 46 +++ .../collectionItem.unenclosed.iteration.scope | 71 ++++ packages/common/src/scopeSupportFacets/c.ts | 1 + packages/common/src/scopeSupportFacets/cpp.ts | 3 + packages/common/src/scopeSupportFacets/css.ts | 347 ++++++++++------- .../common/src/scopeSupportFacets/html.ts | 367 +++++++++++------- .../common/src/scopeSupportFacets/markdown.ts | 366 ++++++++++------- packages/common/src/scopeSupportFacets/xml.ts | 356 ++++++++++------- .../common/src/scopeSupportFacets/yaml.ts | 350 ++++++++++------- queries/css.scm | 4 +- 10 files changed, 1204 insertions(+), 707 deletions(-) create mode 100644 data/fixtures/scopes/css/argument/argument.actual.multiLine.scope create mode 100644 data/fixtures/scopes/markdown/collectionItem.unenclosed.iteration.scope diff --git a/data/fixtures/scopes/css/argument/argument.actual.multiLine.scope b/data/fixtures/scopes/css/argument/argument.actual.multiLine.scope new file mode 100644 index 0000000000..f550a04f1c --- /dev/null +++ b/data/fixtures/scopes/css/argument/argument.actual.multiLine.scope @@ -0,0 +1,46 @@ +* { + clip-path: polygon( + 50% 0%, + 60% 40% + ); +} +--- + +[#1 Content] = +[#1 Domain] = 2:8-2:14 + >------< +2| 50% 0%, + +[#1 Removal] = 2:8-3:8 + >------- +2| 50% 0%, +3| 60% 40% + --------< + +[#1 Trailing delimiter] = 2:14-3:8 + >- +2| 50% 0%, +3| 60% 40% + --------< + +[#1 Insertion delimiter] = ",\n" + + +[#2 Content] = +[#2 Domain] = 3:8-3:15 + >-------< +3| 60% 40% + +[#2 Removal] = 2:14-3:15 + >- +2| 50% 0%, +3| 60% 40% + ---------------< + +[#2 Leading delimiter] = 2:14-3:8 + >- +2| 50% 0%, +3| 60% 40% + --------< + +[#2 Insertion delimiter] = ",\n" diff --git a/data/fixtures/scopes/markdown/collectionItem.unenclosed.iteration.scope b/data/fixtures/scopes/markdown/collectionItem.unenclosed.iteration.scope new file mode 100644 index 0000000000..334572988c --- /dev/null +++ b/data/fixtures/scopes/markdown/collectionItem.unenclosed.iteration.scope @@ -0,0 +1,71 @@ +- This is the first level of a list. + - This is the second level of a list. +- This is the first level of a list again. +--- + +[#1 Content] = 0:2-1:39 + >---------------------------------- +0| - This is the first level of a list. +1| - This is the second level of a list. + ---------------------------------------< + +[#1 Removal] = 0:0-2:0 + >------------------------------------ +0| - This is the first level of a list. +1| - This is the second level of a list. +2| - This is the first level of a list again. + < + +[#1 Trailing delimiter] = 1:39-2:0 + > +1| - This is the second level of a list. +2| - This is the first level of a list again. + < + +[#1 Domain] = 0:0-1:39 + >------------------------------------ +0| - This is the first level of a list. +1| - This is the second level of a list. + ---------------------------------------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = 1:4-1:39 + >-----------------------------------< +1| - This is the second level of a list. + +[#2 Removal] = 1:0-2:0 + >--------------------------------------- +1| - This is the second level of a list. +2| - This is the first level of a list again. + < + +[#2 Leading delimiter] = 1:0-1:2 + >--< +1| - This is the second level of a list. + +[#2 Domain] = 1:2-1:39 + >-------------------------------------< +1| - This is the second level of a list. + +[#2 Insertion delimiter] = "\n" + + +[#3 Content] = 2:2-2:42 + >----------------------------------------< +2| - This is the first level of a list again. + +[#3 Removal] = 2:0-2:42 + >------------------------------------------< +2| - This is the first level of a list again. + +[#3 Leading delimiter] = 2:0-2:0 + >< +2| - This is the first level of a list again. + +[#3 Domain] = 2:0-2:42 + >------------------------------------------< +2| - This is the first level of a list again. + +[#3 Insertion delimiter] = "\n" diff --git a/packages/common/src/scopeSupportFacets/c.ts b/packages/common/src/scopeSupportFacets/c.ts index 2ad3e6f1f2..00254fb17b 100644 --- a/packages/common/src/scopeSupportFacets/c.ts +++ b/packages/common/src/scopeSupportFacets/c.ts @@ -226,6 +226,7 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { "value.field.class": notApplicable, "branch.loop": notApplicable, "branch.loop.iteration": notApplicable, + "statement.misc": notApplicable, environment: notApplicable, pairDelimiter: notApplicable, regularExpression: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/cpp.ts b/packages/common/src/scopeSupportFacets/cpp.ts index 990a75214c..25feebc0c0 100644 --- a/packages/common/src/scopeSupportFacets/cpp.ts +++ b/packages/common/src/scopeSupportFacets/cpp.ts @@ -30,6 +30,7 @@ export const cppScopeSupport: LanguageScopeSupportFacetMap = { "argument.formal.lambda.singleLine": supported, "argument.formal.lambda.multiLine": supported, "argument.formal.lambda.iteration": supported, + "argument.catch": supported, "argumentList.actual.constructor.empty": supported, "argumentList.actual.constructor.singleLine": supported, @@ -55,6 +56,7 @@ export const cppScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.formal.method.iteration": supported, "name.argument.formal.constructor": supported, "name.argument.formal.constructor.iteration": supported, + "name.argument.catch": supported, "name.constructor": supported, "name.foreach": supported, "name.method": supported, @@ -74,6 +76,7 @@ export const cppScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method.iteration": supported, "type.argument.formal.constructor": supported, "type.argument.formal.constructor.iteration": supported, + "type.argument.catch": supported, "type.foreach": supported, "type.typeArgument": supported, "type.typeArgument.iteration": supported, diff --git a/packages/common/src/scopeSupportFacets/css.ts b/packages/common/src/scopeSupportFacets/css.ts index 3c1baaf2af..cd811af1b4 100644 --- a/packages/common/src/scopeSupportFacets/css.ts +++ b/packages/common/src/scopeSupportFacets/css.ts @@ -13,6 +13,7 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { functionCallee: supported, "argument.actual.singleLine": supported, + "argument.actual.multiLine": supported, "argument.actual.iteration": supported, "argumentList.actual.empty": supported, @@ -42,6 +43,18 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { /* NOT APPLICABLE */ + // Variable + "statement.variable": notApplicable, + "statement.assignment": notApplicable, + "name.assignment": notApplicable, + "name.assignment.pattern": notApplicable, + "name.variable": notApplicable, + "name.variable.pattern": notApplicable, + "type.variable": notApplicable, + "value.assignment": notApplicable, + "value.variable": notApplicable, + "value.variable.pattern": notApplicable, + // Class class: notApplicable, "class.iteration.block": notApplicable, @@ -58,19 +71,114 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "value.field.class": notApplicable, "value.iteration.class": notApplicable, "interior.class": notApplicable, + + // Constructor + "statement.constructor": notApplicable, + "namedFunction.constructor": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, + "argument.actual.constructor.singleLine": notApplicable, + "argument.actual.constructor.multiLine": notApplicable, + "argument.actual.constructor.iteration": notApplicable, + "argument.formal.constructor.singleLine": notApplicable, + "argument.formal.constructor.multiLine": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argumentList.actual.constructor.empty": notApplicable, + "argumentList.actual.constructor.singleLine": notApplicable, + "argumentList.actual.constructor.multiLine": notApplicable, + "argumentList.formal.constructor.empty": notApplicable, + "argumentList.formal.constructor.singleLine": notApplicable, + "argumentList.formal.constructor.multiLine": notApplicable, + "interior.constructor": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.constructor": notApplicable, + "type.argument.formal.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "value.argument.formal.constructor": notApplicable, + "value.argument.formal.constructor.iteration": notApplicable, + + // Method + "statement.method": notApplicable, + "namedFunction.method": notApplicable, + "argument.actual.method.singleLine": notApplicable, + "argument.actual.method.multiLine": notApplicable, + "argument.actual.method.iteration": notApplicable, + "argument.formal.method.singleLine": notApplicable, + "argument.formal.method.multiLine": notApplicable, + "argument.formal.method.iteration": notApplicable, + "argumentList.actual.method.empty": notApplicable, + "argumentList.actual.method.singleLine": notApplicable, + "argumentList.actual.method.multiLine": notApplicable, + "argumentList.formal.method.empty": notApplicable, + "argumentList.formal.method.singleLine": notApplicable, + "argumentList.formal.method.multiLine": notApplicable, + "interior.method": notApplicable, + "name.argument.formal.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.method": notApplicable, + "type.argument.formal.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "value.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + + // Function + namedFunction: notApplicable, + "namedFunction.iteration.document": notApplicable, "namedFunction.iteration.class": notApplicable, + "statement.function": notApplicable, + "name.function": notApplicable, + "interior.function": notApplicable, + "argumentList.formal.empty": notApplicable, + "argumentList.formal.singleLine": notApplicable, + "argumentList.formal.multiLine": notApplicable, + "argument.formal.singleLine": notApplicable, + "argument.formal.multiLine": notApplicable, + "argument.formal.iteration": notApplicable, + "name.argument.formal": notApplicable, + "name.argument.formal.iteration": notApplicable, + "type.argument.formal": notApplicable, + "type.argument.formal.iteration": notApplicable, + "value.argument.formal": notApplicable, + "value.argument.formal.iteration": notApplicable, + + // Anonymous function / lambda + anonymousFunction: notApplicable, + "argumentList.formal.lambda.empty": notApplicable, + "argumentList.formal.lambda.singleLine": notApplicable, + "argumentList.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.singleLine": notApplicable, + "argument.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "value.return.lambda": notApplicable, + "interior.lambda": notApplicable, + + // Keyword argument + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, + + // Return statement + "statement.return": notApplicable, + "type.return": notApplicable, + "value.return": notApplicable, + + // Yield statement + "statement.yield": notApplicable, + "value.yield": notApplicable, // Interface "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, @@ -84,11 +192,13 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, // Try catch + "statement.try": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, "interior.try": notApplicable, @@ -96,162 +206,127 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.catch": notApplicable, "type.argument.catch": notApplicable, - anonymousFunction: notApplicable, - "argument.actual.multiLine": notApplicable, - "argument.actual.constructor.iteration": notApplicable, - "argument.actual.constructor.singleLine": notApplicable, - "argument.actual.constructor.multiLine": notApplicable, - "argument.actual.method.iteration": notApplicable, - "argument.actual.method.singleLine": notApplicable, - "argument.actual.method.multiLine": notApplicable, - "argument.formal.constructor.iteration": notApplicable, - "argument.formal.constructor.singleLine": notApplicable, - "argument.formal.constructor.multiLine": notApplicable, - "argument.formal.iteration": notApplicable, - "argument.formal.method.iteration": notApplicable, - "argument.formal.method.singleLine": notApplicable, - "argument.formal.method.multiLine": notApplicable, - "argument.formal.singleLine": notApplicable, - "argument.formal.multiLine": notApplicable, - "argument.formal.lambda.singleLine": notApplicable, - "argument.formal.lambda.multiLine": notApplicable, - "argument.formal.lambda.iteration": notApplicable, - "argumentList.actual.method.empty": notApplicable, - "argumentList.actual.method.singleLine": notApplicable, - "argumentList.actual.method.multiLine": notApplicable, - "argumentList.actual.constructor.empty": notApplicable, - "argumentList.actual.constructor.singleLine": notApplicable, - "argumentList.actual.constructor.multiLine": notApplicable, - "argumentList.formal.empty": notApplicable, - "argumentList.formal.singleLine": notApplicable, - "argumentList.formal.multiLine": notApplicable, - "argumentList.formal.lambda.empty": notApplicable, - "argumentList.formal.lambda.singleLine": notApplicable, - "argumentList.formal.lambda.multiLine": notApplicable, - "argumentList.formal.method.empty": notApplicable, - "argumentList.formal.method.singleLine": notApplicable, - "argumentList.formal.method.multiLine": notApplicable, - "argumentList.formal.constructor.empty": notApplicable, - "argumentList.formal.constructor.singleLine": notApplicable, - "argumentList.formal.constructor.multiLine": notApplicable, - attribute: notApplicable, - "branch.if.iteration": notApplicable, + // If statement + ifStatement: notApplicable, + "statement.if": notApplicable, "branch.if": notApplicable, "branch.if.elif.else": notApplicable, "branch.if.else": notApplicable, + "branch.if.iteration": notApplicable, + "condition.if": notApplicable, + "interior.if": notApplicable, + + // Switch statement + "statement.switch": notApplicable, + "branch.switchCase": notApplicable, + "branch.switchCase.iteration": notApplicable, + "condition.switchCase": notApplicable, + "condition.switchCase.iteration": notApplicable, + "interior.switch": notApplicable, + "interior.switchCase": notApplicable, + "value.switch": notApplicable, + + // Loop "branch.loop": notApplicable, "branch.loop.iteration": notApplicable, - "branch.switchCase.iteration": notApplicable, - "branch.switchCase": notApplicable, - "branch.ternary": notApplicable, - "branch.ternary.iteration": notApplicable, - "comment.line": notApplicable, - "condition.doWhile": notApplicable, + + // For loop + "statement.for": notApplicable, "condition.for": notApplicable, - "condition.if": notApplicable, - "condition.switchCase.iteration": notApplicable, - "condition.switchCase": notApplicable, - "condition.ternary": notApplicable, - "condition.while": notApplicable, - element: notApplicable, - endTag: notApplicable, - environment: notApplicable, - fieldAccess: notApplicable, - "functionCall.constructor": notApplicable, - "functionCallee.constructor": notApplicable, - ifStatement: notApplicable, - "interior.cell": notApplicable, - "interior.element": notApplicable, - "interior.function": notApplicable, - "interior.constructor": notApplicable, - "interior.method": notApplicable, - "interior.if": notApplicable, - "interior.lambda": notApplicable, "interior.for": notApplicable, + + // For-each loop + "statement.foreach": notApplicable, "interior.foreach": notApplicable, + "name.foreach": notApplicable, + "type.foreach": notApplicable, + "value.foreach": notApplicable, + + // While loop + "statement.while": notApplicable, + "condition.while": notApplicable, "interior.while": notApplicable, + + // Do-while loop + "statement.doWhile": notApplicable, + "condition.doWhile": notApplicable, "interior.doWhile": notApplicable, + + // Resource statement + "statement.resource": notApplicable, "interior.resource": notApplicable, - "interior.switch": notApplicable, - "interior.switchCase": notApplicable, - "interior.ternary": notApplicable, - "interior.namespace": notApplicable, + "name.resource": notApplicable, + "name.resource.iteration": notApplicable, + "type.resource": notApplicable, + "type.resource.iteration": notApplicable, + "value.resource": notApplicable, + "value.resource.iteration": notApplicable, + + // Multi-line string + "string.multiLine": notApplicable, + "textFragment.string.multiLine": notApplicable, + + // Line comment + "comment.line": notApplicable, + "textFragment.comment.line": notApplicable, + + // Static + "statement.static": notApplicable, "interior.static": notApplicable, - "key.attribute": notApplicable, - list: notApplicable, - "name.argument.actual.iteration": notApplicable, - "name.argument.actual": notApplicable, - "name.argument.formal.constructor.iteration": notApplicable, - "name.argument.formal.constructor": notApplicable, - "name.argument.formal.iteration": notApplicable, - "name.argument.formal.method.iteration": notApplicable, - "name.argument.formal.method": notApplicable, - "name.argument.formal": notApplicable, - "name.assignment.pattern": notApplicable, - "name.assignment": notApplicable, + + // Namespace + "statement.namespace": notApplicable, + "interior.namespace": notApplicable, "name.namespace": notApplicable, - "name.constructor": notApplicable, - "name.foreach": notApplicable, - "name.function": notApplicable, - "name.method": notApplicable, - "name.resource.iteration": notApplicable, - "name.resource": notApplicable, - "name.variable.pattern": notApplicable, - "name.variable": notApplicable, - "namedFunction.constructor": notApplicable, - "namedFunction.iteration.document": notApplicable, - "namedFunction.method": notApplicable, - namedFunction: notApplicable, - notebookCell: notApplicable, - pairDelimiter: notApplicable, - regularExpression: notApplicable, + + // Ternary + "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, + "condition.ternary": notApplicable, + "interior.ternary": notApplicable, + + // Section + section: notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, - section: notApplicable, - startTag: notApplicable, - "statement.iteration.block": notApplicable, - "string.multiLine": notApplicable, - tags: notApplicable, - "textFragment.comment.line": notApplicable, + + // Element + element: notApplicable, + "interior.element": notApplicable, "textFragment.element": notApplicable, - "textFragment.string.multiLine": notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + + // Attribute + attribute: notApplicable, + "key.attribute": notApplicable, + "value.attribute": notApplicable, + + // Notebook cell + notebookCell: notApplicable, + "interior.cell": notApplicable, + + // Type alias "type.alias": notApplicable, - "type.argument.formal.constructor.iteration": notApplicable, - "type.argument.formal.constructor": notApplicable, - "type.argument.formal.iteration": notApplicable, - "type.argument.formal.method.iteration": notApplicable, - "type.argument.formal.method": notApplicable, - "type.argument.formal": notApplicable, + "value.typeAlias": notApplicable, + + // Miscellaneous statements + "statement.break": notApplicable, + "statement.continue": notApplicable, + "statement.iteration.block": notApplicable, + + // Miscellaneous + environment: notApplicable, + fieldAccess: notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, "type.cast": notApplicable, - "type.foreach": notApplicable, - "type.resource": notApplicable, - "type.resource.iteration": notApplicable, - "type.return": notApplicable, - "type.typeArgument.iteration": notApplicable, "type.typeArgument": notApplicable, - "type.variable": notApplicable, + "type.typeArgument.iteration": notApplicable, "type.iteration.block": notApplicable, "type.iteration.document": notApplicable, - "value.argument.actual.iteration": notApplicable, - "value.argument.actual": notApplicable, - "value.argument.formal.constructor.iteration": notApplicable, - "value.argument.formal.constructor": notApplicable, - "value.argument.formal.iteration": notApplicable, - "value.argument.formal.method.iteration": notApplicable, - "value.argument.formal.method": notApplicable, - "value.argument.formal": notApplicable, - "value.assignment": notApplicable, - "value.attribute": notApplicable, - "value.foreach": notApplicable, - "value.resource.iteration": notApplicable, - "value.resource": notApplicable, - "value.return.lambda": notApplicable, - "value.return": notApplicable, - "value.typeAlias": notApplicable, - "value.variable.pattern": notApplicable, - "value.variable": notApplicable, - "value.yield": notApplicable, - "value.switch": notApplicable, "value.iteration.block": notApplicable, "value.iteration.document": notApplicable, + list: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/html.ts b/packages/common/src/scopeSupportFacets/html.ts index d1ea8e1d74..8c4557d360 100644 --- a/packages/common/src/scopeSupportFacets/html.ts +++ b/packages/common/src/scopeSupportFacets/html.ts @@ -20,6 +20,18 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { /* NOT APPLICABLE */ + // Variable + "statement.variable": notApplicable, + "statement.assignment": notApplicable, + "name.assignment": notApplicable, + "name.assignment.pattern": notApplicable, + "name.variable": notApplicable, + "name.variable.pattern": notApplicable, + "type.variable": notApplicable, + "value.assignment": notApplicable, + "value.variable": notApplicable, + "value.variable.pattern": notApplicable, + // Class class: notApplicable, "class.iteration.block": notApplicable, @@ -36,7 +48,110 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { "value.field.class": notApplicable, "value.iteration.class": notApplicable, "interior.class": notApplicable, + + // Constructor + "statement.constructor": notApplicable, + "namedFunction.constructor": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, + "argument.actual.constructor.singleLine": notApplicable, + "argument.actual.constructor.multiLine": notApplicable, + "argument.actual.constructor.iteration": notApplicable, + "argument.formal.constructor.singleLine": notApplicable, + "argument.formal.constructor.multiLine": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argumentList.actual.constructor.empty": notApplicable, + "argumentList.actual.constructor.singleLine": notApplicable, + "argumentList.actual.constructor.multiLine": notApplicable, + "argumentList.formal.constructor.empty": notApplicable, + "argumentList.formal.constructor.singleLine": notApplicable, + "argumentList.formal.constructor.multiLine": notApplicable, + "interior.constructor": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.constructor": notApplicable, + "type.argument.formal.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "value.argument.formal.constructor": notApplicable, + "value.argument.formal.constructor.iteration": notApplicable, + + // Method + "statement.method": notApplicable, + "namedFunction.method": notApplicable, + "argument.actual.method.singleLine": notApplicable, + "argument.actual.method.multiLine": notApplicable, + "argument.actual.method.iteration": notApplicable, + "argument.formal.method.singleLine": notApplicable, + "argument.formal.method.multiLine": notApplicable, + "argument.formal.method.iteration": notApplicable, + "argumentList.actual.method.empty": notApplicable, + "argumentList.actual.method.singleLine": notApplicable, + "argumentList.actual.method.multiLine": notApplicable, + "argumentList.formal.method.empty": notApplicable, + "argumentList.formal.method.singleLine": notApplicable, + "argumentList.formal.method.multiLine": notApplicable, + "interior.method": notApplicable, + "name.argument.formal.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.method": notApplicable, + "type.argument.formal.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "value.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + + // Function + namedFunction: notApplicable, + "namedFunction.iteration.document": notApplicable, "namedFunction.iteration.class": notApplicable, + "statement.function": notApplicable, + "name.function": notApplicable, + "interior.function": notApplicable, + "argumentList.formal.empty": notApplicable, + "argumentList.formal.singleLine": notApplicable, + "argumentList.formal.multiLine": notApplicable, + "argument.formal.singleLine": notApplicable, + "argument.formal.multiLine": notApplicable, + "argument.formal.iteration": notApplicable, + "name.argument.formal": notApplicable, + "name.argument.formal.iteration": notApplicable, + "type.argument.formal": notApplicable, + "type.argument.formal.iteration": notApplicable, + "value.argument.formal": notApplicable, + "value.argument.formal.iteration": notApplicable, + + // Anonymous function / lambda + anonymousFunction: notApplicable, + "argumentList.formal.lambda.empty": notApplicable, + "argumentList.formal.lambda.singleLine": notApplicable, + "argumentList.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.singleLine": notApplicable, + "argument.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "value.return.lambda": notApplicable, + "interior.lambda": notApplicable, + + // Function call + functionCall: notApplicable, + functionCallee: notApplicable, + "argumentList.actual.empty": notApplicable, + "argumentList.actual.singleLine": notApplicable, + "argumentList.actual.multiLine": notApplicable, + "argument.actual.singleLine": notApplicable, + "argument.actual.multiLine": notApplicable, + "argument.actual.iteration": notApplicable, + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, + + // Return statement + "statement.return": notApplicable, + "type.return": notApplicable, + "value.return": notApplicable, + + // Yield statement + "statement.yield": notApplicable, + "value.yield": notApplicable, // Interface "statement.interface": notApplicable, @@ -62,11 +177,13 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, // Try catch + "statement.try": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, "interior.try": notApplicable, @@ -74,174 +191,132 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.catch": notApplicable, "type.argument.catch": notApplicable, - "argument.actual.constructor.iteration": notApplicable, - "argument.actual.constructor.singleLine": notApplicable, - "argument.actual.constructor.multiLine": notApplicable, - "argument.actual.iteration": notApplicable, - "argument.actual.method.iteration": notApplicable, - "argument.actual.method.singleLine": notApplicable, - "argument.actual.method.multiLine": notApplicable, - "argument.actual.singleLine": notApplicable, - "argument.actual.multiLine": notApplicable, - "argument.formal.constructor.iteration": notApplicable, - "argument.formal.constructor.singleLine": notApplicable, - "argument.formal.constructor.multiLine": notApplicable, - "argument.formal.iteration": notApplicable, - "argument.formal.method.iteration": notApplicable, - "argument.formal.method.singleLine": notApplicable, - "argument.formal.method.multiLine": notApplicable, - "argument.formal.singleLine": notApplicable, - "argument.formal.multiLine": notApplicable, - "argument.formal.lambda.singleLine": notApplicable, - "argument.formal.lambda.multiLine": notApplicable, - "argument.formal.lambda.iteration": notApplicable, - "argumentList.actual.empty": notApplicable, - "argumentList.actual.singleLine": notApplicable, - "argumentList.actual.multiLine": notApplicable, - "argumentList.actual.method.empty": notApplicable, - "argumentList.actual.method.singleLine": notApplicable, - "argumentList.actual.method.multiLine": notApplicable, - "argumentList.actual.constructor.empty": notApplicable, - "argumentList.actual.constructor.singleLine": notApplicable, - "argumentList.actual.constructor.multiLine": notApplicable, - "argumentList.formal.empty": notApplicable, - "argumentList.formal.singleLine": notApplicable, - "argumentList.formal.multiLine": notApplicable, - "argumentList.formal.lambda.empty": notApplicable, - "argumentList.formal.lambda.singleLine": notApplicable, - "argumentList.formal.lambda.multiLine": notApplicable, - "argumentList.formal.method.empty": notApplicable, - "argumentList.formal.method.singleLine": notApplicable, - "argumentList.formal.method.multiLine": notApplicable, - "argumentList.formal.constructor.empty": notApplicable, - "argumentList.formal.constructor.singleLine": notApplicable, - "argumentList.formal.constructor.multiLine": notApplicable, - "branch.if.iteration": notApplicable, + // If statement + ifStatement: notApplicable, + "statement.if": notApplicable, "branch.if": notApplicable, "branch.if.elif.else": notApplicable, "branch.if.else": notApplicable, + "branch.if.iteration": notApplicable, + "condition.if": notApplicable, + "interior.if": notApplicable, + + // Switch statement + "statement.switch": notApplicable, + "branch.switchCase": notApplicable, + "branch.switchCase.iteration": notApplicable, + "condition.switchCase": notApplicable, + "condition.switchCase.iteration": notApplicable, + "interior.switch": notApplicable, + "interior.switchCase": notApplicable, + "value.switch": notApplicable, + + // Loop "branch.loop": notApplicable, "branch.loop.iteration": notApplicable, - "branch.switchCase.iteration": notApplicable, - "branch.switchCase": notApplicable, - "branch.ternary": notApplicable, - "branch.ternary.iteration": notApplicable, - "collectionItem.unenclosed.iteration": notApplicable, - "collectionItem.unenclosed": notApplicable, - "comment.line": notApplicable, - "condition.doWhile": notApplicable, + + // For loop + "statement.for": notApplicable, "condition.for": notApplicable, - "condition.if": notApplicable, - "condition.switchCase.iteration": notApplicable, - "condition.switchCase": notApplicable, - "condition.ternary": notApplicable, - "condition.while": notApplicable, - "functionCall.constructor": notApplicable, - "functionCallee.constructor": notApplicable, - "interior.cell": notApplicable, - "interior.function": notApplicable, - "interior.constructor": notApplicable, - "interior.method": notApplicable, - "interior.if": notApplicable, - "interior.lambda": notApplicable, "interior.for": notApplicable, + + // For-each loop + "statement.foreach": notApplicable, "interior.foreach": notApplicable, + "name.foreach": notApplicable, + "type.foreach": notApplicable, + "value.foreach": notApplicable, + + // While loop + "statement.while": notApplicable, + "condition.while": notApplicable, "interior.while": notApplicable, + + // Do-while loop + "statement.doWhile": notApplicable, + "condition.doWhile": notApplicable, "interior.doWhile": notApplicable, + + // Resource statement + "statement.resource": notApplicable, "interior.resource": notApplicable, - "interior.switch": notApplicable, - "interior.switchCase": notApplicable, - "interior.ternary": notApplicable, - "interior.namespace": notApplicable, - "interior.static": notApplicable, - "key.mapPair.iteration": notApplicable, - "key.mapPair": notApplicable, - "name.argument.actual.iteration": notApplicable, - "name.argument.actual": notApplicable, - "name.argument.formal.constructor.iteration": notApplicable, - "name.argument.formal.constructor": notApplicable, - "name.argument.formal.iteration": notApplicable, - "name.argument.formal.method.iteration": notApplicable, - "name.argument.formal.method": notApplicable, - "name.argument.formal": notApplicable, - "name.assignment.pattern": notApplicable, - "name.assignment": notApplicable, - "name.constructor": notApplicable, - "name.foreach": notApplicable, - "name.function": notApplicable, - "name.iteration.block": notApplicable, - "name.iteration.document": notApplicable, - "name.method": notApplicable, - "name.resource.iteration": notApplicable, "name.resource": notApplicable, - "name.variable.pattern": notApplicable, - "name.variable": notApplicable, + "name.resource.iteration": notApplicable, + "type.resource": notApplicable, + "type.resource.iteration": notApplicable, + "value.resource": notApplicable, + "value.resource.iteration": notApplicable, + + // Map + map: notApplicable, + "key.mapPair": notApplicable, + "key.mapPair.iteration": notApplicable, + "value.mapPair": notApplicable, + "value.mapPair.iteration": notApplicable, + + // Multiline string + "string.multiLine": notApplicable, + "textFragment.string.multiLine": notApplicable, + + // Line comment + "comment.line": notApplicable, + "textFragment.comment.line": notApplicable, + + // Collection item + "collectionItem.unenclosed": notApplicable, + "collectionItem.unenclosed.iteration": notApplicable, + + // Static + "statement.static": notApplicable, + "interior.static": notApplicable, + + // Namespace + "statement.namespace": notApplicable, + "interior.namespace": notApplicable, "name.namespace": notApplicable, - "namedFunction.constructor": notApplicable, - "namedFunction.iteration.document": notApplicable, - "namedFunction.method": notApplicable, + + // Ternary + "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, + "condition.ternary": notApplicable, + "interior.ternary": notApplicable, + + // Section + section: notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, - "statement.iteration.block": notApplicable, - "statement.iteration.document": notApplicable, - "string.multiLine": notApplicable, - "textFragment.comment.line": notApplicable, - "textFragment.string.multiLine": notApplicable, + + // Notebook cell + notebookCell: notApplicable, + "interior.cell": notApplicable, + + // Type alias "type.alias": notApplicable, - "type.argument.formal.constructor.iteration": notApplicable, - "type.argument.formal.constructor": notApplicable, - "type.argument.formal.iteration": notApplicable, - "type.argument.formal.method.iteration": notApplicable, - "type.argument.formal.method": notApplicable, - "type.argument.formal": notApplicable, + "value.typeAlias": notApplicable, + + // Miscellaneous statements + "statement.break": notApplicable, + "statement.continue": notApplicable, + "statement.misc": notApplicable, + "statement.iteration.document": notApplicable, + "statement.iteration.block": notApplicable, + + // Miscellaneous + environment: notApplicable, + fieldAccess: notApplicable, + "name.iteration.block": notApplicable, + "name.iteration.document": notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, "type.cast": notApplicable, - "type.foreach": notApplicable, - "type.resource": notApplicable, - "type.resource.iteration": notApplicable, - "type.return": notApplicable, - "type.typeArgument.iteration": notApplicable, "type.typeArgument": notApplicable, - "type.variable": notApplicable, + "type.typeArgument.iteration": notApplicable, "type.iteration.block": notApplicable, "type.iteration.document": notApplicable, - "value.argument.actual.iteration": notApplicable, - "value.argument.actual": notApplicable, - "value.argument.formal.constructor.iteration": notApplicable, - "value.argument.formal.constructor": notApplicable, - "value.argument.formal.iteration": notApplicable, - "value.argument.formal.method.iteration": notApplicable, - "value.argument.formal.method": notApplicable, - "value.argument.formal": notApplicable, - "value.assignment": notApplicable, - "value.foreach": notApplicable, - "value.mapPair.iteration": notApplicable, - "value.mapPair": notApplicable, - "value.resource.iteration": notApplicable, - "value.resource": notApplicable, - "value.return.lambda": notApplicable, - "value.return": notApplicable, - "value.typeAlias": notApplicable, - "value.variable.pattern": notApplicable, - "value.variable": notApplicable, - "value.yield": notApplicable, - "value.switch": notApplicable, "value.iteration.block": notApplicable, "value.iteration.document": notApplicable, - anonymousFunction: notApplicable, - disqualifyDelimiter: notApplicable, - environment: notApplicable, - fieldAccess: notApplicable, - functionCall: notApplicable, - functionCallee: notApplicable, - ifStatement: notApplicable, - list: notApplicable, - map: notApplicable, - namedFunction: notApplicable, - notebookCell: notApplicable, - pairDelimiter: notApplicable, - regularExpression: notApplicable, - section: notApplicable, - selector: notApplicable, unit: notApplicable, + list: notApplicable, + disqualifyDelimiter: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/markdown.ts b/packages/common/src/scopeSupportFacets/markdown.ts index 7126a20c41..c40bfe94d1 100644 --- a/packages/common/src/scopeSupportFacets/markdown.ts +++ b/packages/common/src/scopeSupportFacets/markdown.ts @@ -15,10 +15,24 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "interior.cell": supported, "collectionItem.unenclosed": supported, + "collectionItem.unenclosed.iteration": supported, + list: supported, /* NOT APPLICABLE */ + // Variable + "statement.variable": notApplicable, + "statement.assignment": notApplicable, + "name.assignment": notApplicable, + "name.assignment.pattern": notApplicable, + "name.variable": notApplicable, + "name.variable.pattern": notApplicable, + "type.variable": notApplicable, + "value.assignment": notApplicable, + "value.variable": notApplicable, + "value.variable.pattern": notApplicable, + // Class class: notApplicable, "class.iteration.block": notApplicable, @@ -35,7 +49,110 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "value.field.class": notApplicable, "value.iteration.class": notApplicable, "interior.class": notApplicable, + + // Constructor + "statement.constructor": notApplicable, + "namedFunction.constructor": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, + "argument.actual.constructor.singleLine": notApplicable, + "argument.actual.constructor.multiLine": notApplicable, + "argument.actual.constructor.iteration": notApplicable, + "argument.formal.constructor.singleLine": notApplicable, + "argument.formal.constructor.multiLine": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argumentList.actual.constructor.empty": notApplicable, + "argumentList.actual.constructor.singleLine": notApplicable, + "argumentList.actual.constructor.multiLine": notApplicable, + "argumentList.formal.constructor.empty": notApplicable, + "argumentList.formal.constructor.singleLine": notApplicable, + "argumentList.formal.constructor.multiLine": notApplicable, + "interior.constructor": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.constructor": notApplicable, + "type.argument.formal.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "value.argument.formal.constructor": notApplicable, + "value.argument.formal.constructor.iteration": notApplicable, + + // Method + "statement.method": notApplicable, + "namedFunction.method": notApplicable, + "argument.actual.method.singleLine": notApplicable, + "argument.actual.method.multiLine": notApplicable, + "argument.actual.method.iteration": notApplicable, + "argument.formal.method.singleLine": notApplicable, + "argument.formal.method.multiLine": notApplicable, + "argument.formal.method.iteration": notApplicable, + "argumentList.actual.method.empty": notApplicable, + "argumentList.actual.method.singleLine": notApplicable, + "argumentList.actual.method.multiLine": notApplicable, + "argumentList.formal.method.empty": notApplicable, + "argumentList.formal.method.singleLine": notApplicable, + "argumentList.formal.method.multiLine": notApplicable, + "interior.method": notApplicable, + "name.argument.formal.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.method": notApplicable, + "type.argument.formal.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "value.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + + // Function + namedFunction: notApplicable, + "namedFunction.iteration.document": notApplicable, "namedFunction.iteration.class": notApplicable, + "statement.function": notApplicable, + "name.function": notApplicable, + "interior.function": notApplicable, + "argumentList.formal.empty": notApplicable, + "argumentList.formal.singleLine": notApplicable, + "argumentList.formal.multiLine": notApplicable, + "argument.formal.singleLine": notApplicable, + "argument.formal.multiLine": notApplicable, + "argument.formal.iteration": notApplicable, + "name.argument.formal": notApplicable, + "name.argument.formal.iteration": notApplicable, + "type.argument.formal": notApplicable, + "type.argument.formal.iteration": notApplicable, + "value.argument.formal": notApplicable, + "value.argument.formal.iteration": notApplicable, + + // Anonymous function / lambda + anonymousFunction: notApplicable, + "argumentList.formal.lambda.empty": notApplicable, + "argumentList.formal.lambda.singleLine": notApplicable, + "argumentList.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.singleLine": notApplicable, + "argument.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "value.return.lambda": notApplicable, + "interior.lambda": notApplicable, + + // Function call + functionCall: notApplicable, + functionCallee: notApplicable, + "argumentList.actual.empty": notApplicable, + "argumentList.actual.singleLine": notApplicable, + "argumentList.actual.multiLine": notApplicable, + "argument.actual.singleLine": notApplicable, + "argument.actual.multiLine": notApplicable, + "argument.actual.iteration": notApplicable, + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, + + // Return statement + "statement.return": notApplicable, + "type.return": notApplicable, + "value.return": notApplicable, + + // Yield statement + "statement.yield": notApplicable, + "value.yield": notApplicable, // Interface "statement.interface": notApplicable, @@ -61,11 +178,13 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, // Try catch + "statement.try": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, "interior.try": notApplicable, @@ -73,178 +192,135 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.catch": notApplicable, "type.argument.catch": notApplicable, - anonymousFunction: notApplicable, - "argument.actual.singleLine": notApplicable, - "argument.actual.multiLine": notApplicable, - "argument.actual.constructor.singleLine": notApplicable, - "argument.actual.constructor.multiLine": notApplicable, - "argument.actual.constructor.iteration": notApplicable, - "argument.actual.iteration": notApplicable, - "argument.actual.method.singleLine": notApplicable, - "argument.actual.method.multiLine": notApplicable, - "argument.actual.method.iteration": notApplicable, - "argument.formal.singleLine": notApplicable, - "argument.formal.multiLine": notApplicable, - "argument.formal.constructor.singleLine": notApplicable, - "argument.formal.constructor.multiLine": notApplicable, - "argument.formal.constructor.iteration": notApplicable, - "argument.formal.iteration": notApplicable, - "argument.formal.method.singleLine": notApplicable, - "argument.formal.method.multiLine": notApplicable, - "argument.formal.method.iteration": notApplicable, - "argument.formal.lambda.singleLine": notApplicable, - "argument.formal.lambda.multiLine": notApplicable, - "argument.formal.lambda.iteration": notApplicable, - "argumentList.actual.empty": notApplicable, - "argumentList.actual.singleLine": notApplicable, - "argumentList.actual.multiLine": notApplicable, - "argumentList.actual.method.empty": notApplicable, - "argumentList.actual.method.singleLine": notApplicable, - "argumentList.actual.method.multiLine": notApplicable, - "argumentList.actual.constructor.empty": notApplicable, - "argumentList.actual.constructor.singleLine": notApplicable, - "argumentList.actual.constructor.multiLine": notApplicable, - "argumentList.formal.empty": notApplicable, - "argumentList.formal.singleLine": notApplicable, - "argumentList.formal.multiLine": notApplicable, - "argumentList.formal.lambda.empty": notApplicable, - "argumentList.formal.lambda.singleLine": notApplicable, - "argumentList.formal.lambda.multiLine": notApplicable, - "argumentList.formal.method.empty": notApplicable, - "argumentList.formal.method.singleLine": notApplicable, - "argumentList.formal.method.multiLine": notApplicable, - "argumentList.formal.constructor.empty": notApplicable, - "argumentList.formal.constructor.singleLine": notApplicable, - "argumentList.formal.constructor.multiLine": notApplicable, - attribute: notApplicable, + // If statement + ifStatement: notApplicable, + "statement.if": notApplicable, "branch.if": notApplicable, "branch.if.elif.else": notApplicable, "branch.if.else": notApplicable, "branch.if.iteration": notApplicable, - "branch.loop": notApplicable, - "branch.loop.iteration": notApplicable, + "condition.if": notApplicable, + "interior.if": notApplicable, + + // Switch statement + "statement.switch": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, - "branch.ternary": notApplicable, - "branch.ternary.iteration": notApplicable, - "collectionItem.unenclosed.iteration": notApplicable, - "comment.line": notApplicable, - "condition.doWhile": notApplicable, - "condition.for": notApplicable, - "condition.if": notApplicable, "condition.switchCase": notApplicable, "condition.switchCase.iteration": notApplicable, - "condition.ternary": notApplicable, - "condition.while": notApplicable, - disqualifyDelimiter: notApplicable, - element: notApplicable, - endTag: notApplicable, - environment: notApplicable, - fieldAccess: notApplicable, - functionCall: notApplicable, - "functionCall.constructor": notApplicable, - functionCallee: notApplicable, - "functionCallee.constructor": notApplicable, - ifStatement: notApplicable, - "interior.element": notApplicable, - "interior.function": notApplicable, - "interior.constructor": notApplicable, - "interior.method": notApplicable, - "interior.if": notApplicable, - "interior.lambda": notApplicable, + "interior.switch": notApplicable, + "interior.switchCase": notApplicable, + "value.switch": notApplicable, + + // Loop + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, + + // For loop + "statement.for": notApplicable, + "condition.for": notApplicable, "interior.for": notApplicable, + + // For-each loop + "statement.foreach": notApplicable, "interior.foreach": notApplicable, + "name.foreach": notApplicable, + "type.foreach": notApplicable, + "value.foreach": notApplicable, + + // While loop + "statement.while": notApplicable, + "condition.while": notApplicable, "interior.while": notApplicable, + + // Do-while loop + "statement.doWhile": notApplicable, + "condition.doWhile": notApplicable, "interior.doWhile": notApplicable, + + // Resource statement + "statement.resource": notApplicable, "interior.resource": notApplicable, - "interior.switch": notApplicable, - "interior.switchCase": notApplicable, - "interior.ternary": notApplicable, - "interior.namespace": notApplicable, - "interior.static": notApplicable, - "key.attribute": notApplicable, - "key.mapPair": notApplicable, - "key.mapPair.iteration": notApplicable, - map: notApplicable, - "name.argument.actual": notApplicable, - "name.argument.actual.iteration": notApplicable, - "name.argument.formal": notApplicable, - "name.argument.formal.constructor": notApplicable, - "name.argument.formal.constructor.iteration": notApplicable, - "name.argument.formal.iteration": notApplicable, - "name.argument.formal.method": notApplicable, - "name.argument.formal.method.iteration": notApplicable, - "name.assignment": notApplicable, - "name.assignment.pattern": notApplicable, - "name.namespace": notApplicable, - "name.constructor": notApplicable, - "name.foreach": notApplicable, - "name.function": notApplicable, - "name.iteration.block": notApplicable, - "name.iteration.document": notApplicable, - "name.method": notApplicable, "name.resource": notApplicable, "name.resource.iteration": notApplicable, - "name.variable": notApplicable, - "name.variable.pattern": notApplicable, - namedFunction: notApplicable, - "namedFunction.constructor": notApplicable, - "namedFunction.iteration.document": notApplicable, - "namedFunction.method": notApplicable, - pairDelimiter: notApplicable, - regularExpression: notApplicable, - startTag: notApplicable, + "type.resource": notApplicable, + "type.resource.iteration": notApplicable, + "value.resource": notApplicable, + "value.resource.iteration": notApplicable, - "statement.iteration.block": notApplicable, - "statement.iteration.document": notApplicable, - "string.multiLine": notApplicable, + // Single-line string "string.singleLine": notApplicable, - tags: notApplicable, - "textFragment.element": notApplicable, - "textFragment.string.multiLine": notApplicable, "textFragment.string.singleLine": notApplicable, + + // Map + map: notApplicable, + "key.mapPair": notApplicable, + "key.mapPair.iteration": notApplicable, + "value.mapPair": notApplicable, + "value.mapPair.iteration": notApplicable, + + // Multiline string + "string.multiLine": notApplicable, + "textFragment.string.multiLine": notApplicable, + + // Line comment + "comment.line": notApplicable, "textFragment.comment.line": notApplicable, + + // Static + "statement.static": notApplicable, + "interior.static": notApplicable, + + // Namespace + "statement.namespace": notApplicable, + "interior.namespace": notApplicable, + "name.namespace": notApplicable, + + // Ternary + "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, + "condition.ternary": notApplicable, + "interior.ternary": notApplicable, + + // Element + element: notApplicable, + "interior.element": notApplicable, + "textFragment.element": notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + + // Attribute + attribute: notApplicable, + "key.attribute": notApplicable, + "value.attribute": notApplicable, + + // Type alias "type.alias": notApplicable, - "type.argument.formal": notApplicable, - "type.argument.formal.constructor": notApplicable, - "type.argument.formal.constructor.iteration": notApplicable, - "type.argument.formal.iteration": notApplicable, - "type.argument.formal.method": notApplicable, - "type.argument.formal.method.iteration": notApplicable, + "value.typeAlias": notApplicable, + + // Miscellaneous statements + "statement.break": notApplicable, + "statement.continue": notApplicable, + "statement.misc": notApplicable, + "statement.iteration.document": notApplicable, + "statement.iteration.block": notApplicable, + + // Miscellaneous + environment: notApplicable, + fieldAccess: notApplicable, + "name.iteration.block": notApplicable, + "name.iteration.document": notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, "type.cast": notApplicable, - "type.foreach": notApplicable, - "type.variable": notApplicable, - "type.return": notApplicable, - "type.resource": notApplicable, - "type.resource.iteration": notApplicable, "type.typeArgument": notApplicable, "type.typeArgument.iteration": notApplicable, "type.iteration.block": notApplicable, "type.iteration.document": notApplicable, - "value.argument.actual": notApplicable, - "value.argument.actual.iteration": notApplicable, - "value.argument.formal": notApplicable, - "value.argument.formal.constructor": notApplicable, - "value.argument.formal.constructor.iteration": notApplicable, - "value.argument.formal.iteration": notApplicable, - "value.argument.formal.method": notApplicable, - "value.argument.formal.method.iteration": notApplicable, - "value.assignment": notApplicable, - "value.attribute": notApplicable, - "value.foreach": notApplicable, - "value.mapPair": notApplicable, - "value.mapPair.iteration": notApplicable, - "value.resource": notApplicable, - "value.resource.iteration": notApplicable, - "value.return": notApplicable, - "value.return.lambda": notApplicable, - "value.typeAlias": notApplicable, - "value.variable": notApplicable, - "value.variable.pattern": notApplicable, - "value.yield": notApplicable, - "value.switch": notApplicable, "value.iteration.block": notApplicable, "value.iteration.document": notApplicable, selector: notApplicable, unit: notApplicable, + disqualifyDelimiter: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/xml.ts b/packages/common/src/scopeSupportFacets/xml.ts index 02e14301ea..1ea0107560 100644 --- a/packages/common/src/scopeSupportFacets/xml.ts +++ b/packages/common/src/scopeSupportFacets/xml.ts @@ -20,6 +20,18 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { /* NOT APPLICABLE */ + // Variable + "statement.variable": notApplicable, + "statement.assignment": notApplicable, + "name.assignment": notApplicable, + "name.assignment.pattern": notApplicable, + "name.variable": notApplicable, + "name.variable.pattern": notApplicable, + "type.variable": notApplicable, + "value.assignment": notApplicable, + "value.variable": notApplicable, + "value.variable.pattern": notApplicable, + // Class class: notApplicable, "class.iteration.block": notApplicable, @@ -36,7 +48,110 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "value.field.class": notApplicable, "value.iteration.class": notApplicable, "interior.class": notApplicable, + + // Constructor + "statement.constructor": notApplicable, + "namedFunction.constructor": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, + "argument.actual.constructor.singleLine": notApplicable, + "argument.actual.constructor.multiLine": notApplicable, + "argument.actual.constructor.iteration": notApplicable, + "argument.formal.constructor.singleLine": notApplicable, + "argument.formal.constructor.multiLine": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argumentList.actual.constructor.empty": notApplicable, + "argumentList.actual.constructor.singleLine": notApplicable, + "argumentList.actual.constructor.multiLine": notApplicable, + "argumentList.formal.constructor.empty": notApplicable, + "argumentList.formal.constructor.singleLine": notApplicable, + "argumentList.formal.constructor.multiLine": notApplicable, + "interior.constructor": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.constructor": notApplicable, + "type.argument.formal.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "value.argument.formal.constructor": notApplicable, + "value.argument.formal.constructor.iteration": notApplicable, + + // Method + "statement.method": notApplicable, + "namedFunction.method": notApplicable, + "argument.actual.method.singleLine": notApplicable, + "argument.actual.method.multiLine": notApplicable, + "argument.actual.method.iteration": notApplicable, + "argument.formal.method.singleLine": notApplicable, + "argument.formal.method.multiLine": notApplicable, + "argument.formal.method.iteration": notApplicable, + "argumentList.actual.method.empty": notApplicable, + "argumentList.actual.method.singleLine": notApplicable, + "argumentList.actual.method.multiLine": notApplicable, + "argumentList.formal.method.empty": notApplicable, + "argumentList.formal.method.singleLine": notApplicable, + "argumentList.formal.method.multiLine": notApplicable, + "interior.method": notApplicable, + "name.argument.formal.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.method": notApplicable, + "type.argument.formal.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "value.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + + // Function + namedFunction: notApplicable, + "namedFunction.iteration.document": notApplicable, "namedFunction.iteration.class": notApplicable, + "statement.function": notApplicable, + "name.function": notApplicable, + "interior.function": notApplicable, + "argumentList.formal.empty": notApplicable, + "argumentList.formal.singleLine": notApplicable, + "argumentList.formal.multiLine": notApplicable, + "argument.formal.singleLine": notApplicable, + "argument.formal.multiLine": notApplicable, + "argument.formal.iteration": notApplicable, + "name.argument.formal": notApplicable, + "name.argument.formal.iteration": notApplicable, + "type.argument.formal": notApplicable, + "type.argument.formal.iteration": notApplicable, + "value.argument.formal": notApplicable, + "value.argument.formal.iteration": notApplicable, + + // Anonymous function / lambda + anonymousFunction: notApplicable, + "argumentList.formal.lambda.empty": notApplicable, + "argumentList.formal.lambda.singleLine": notApplicable, + "argumentList.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.singleLine": notApplicable, + "argument.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "value.return.lambda": notApplicable, + "interior.lambda": notApplicable, + + // Function call + functionCall: notApplicable, + functionCallee: notApplicable, + "argumentList.actual.empty": notApplicable, + "argumentList.actual.singleLine": notApplicable, + "argumentList.actual.multiLine": notApplicable, + "argument.actual.singleLine": notApplicable, + "argument.actual.multiLine": notApplicable, + "argument.actual.iteration": notApplicable, + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, + + // Return statement + "statement.return": notApplicable, + "type.return": notApplicable, + "value.return": notApplicable, + + // Yield statement + "statement.yield": notApplicable, + "value.yield": notApplicable, // Interface "statement.interface": notApplicable, @@ -62,11 +177,13 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, // Try catch + "statement.try": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, "interior.try": notApplicable, @@ -74,173 +191,132 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.catch": notApplicable, "type.argument.catch": notApplicable, - anonymousFunction: notApplicable, - "argument.actual.singleLine": notApplicable, - "argument.actual.multiLine": notApplicable, - "argument.actual.constructor.singleLine": notApplicable, - "argument.actual.constructor.multiLine": notApplicable, - "argument.actual.constructor.iteration": notApplicable, - "argument.actual.iteration": notApplicable, - "argument.actual.method.singleLine": notApplicable, - "argument.actual.method.multiLine": notApplicable, - "argument.actual.method.iteration": notApplicable, - "argument.formal.singleLine": notApplicable, - "argument.formal.multiLine": notApplicable, - "argument.formal.constructor.singleLine": notApplicable, - "argument.formal.constructor.multiLine": notApplicable, - "argument.formal.constructor.iteration": notApplicable, - "argument.formal.iteration": notApplicable, - "argument.formal.method.singleLine": notApplicable, - "argument.formal.method.multiLine": notApplicable, - "argument.formal.method.iteration": notApplicable, - "argument.formal.lambda.singleLine": notApplicable, - "argument.formal.lambda.multiLine": notApplicable, - "argument.formal.lambda.iteration": notApplicable, - "argumentList.actual.empty": notApplicable, - "argumentList.actual.singleLine": notApplicable, - "argumentList.actual.multiLine": notApplicable, - "argumentList.actual.method.empty": notApplicable, - "argumentList.actual.method.singleLine": notApplicable, - "argumentList.actual.method.multiLine": notApplicable, - "argumentList.actual.constructor.empty": notApplicable, - "argumentList.actual.constructor.singleLine": notApplicable, - "argumentList.actual.constructor.multiLine": notApplicable, - "argumentList.formal.empty": notApplicable, - "argumentList.formal.singleLine": notApplicable, - "argumentList.formal.multiLine": notApplicable, - "argumentList.formal.lambda.empty": notApplicable, - "argumentList.formal.lambda.singleLine": notApplicable, - "argumentList.formal.lambda.multiLine": notApplicable, - "argumentList.formal.method.empty": notApplicable, - "argumentList.formal.method.singleLine": notApplicable, - "argumentList.formal.method.multiLine": notApplicable, - "argumentList.formal.constructor.empty": notApplicable, - "argumentList.formal.constructor.singleLine": notApplicable, - "argumentList.formal.constructor.multiLine": notApplicable, + // If statement + ifStatement: notApplicable, + "statement.if": notApplicable, "branch.if": notApplicable, "branch.if.elif.else": notApplicable, "branch.if.else": notApplicable, "branch.if.iteration": notApplicable, - "branch.loop": notApplicable, - "branch.loop.iteration": notApplicable, + "condition.if": notApplicable, + "interior.if": notApplicable, + + // Switch statement + "statement.switch": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, - "branch.ternary": notApplicable, - "branch.ternary.iteration": notApplicable, - "collectionItem.unenclosed": notApplicable, - "collectionItem.unenclosed.iteration": notApplicable, - "comment.line": notApplicable, - "condition.doWhile": notApplicable, - "condition.for": notApplicable, - "condition.if": notApplicable, "condition.switchCase": notApplicable, "condition.switchCase.iteration": notApplicable, - "condition.ternary": notApplicable, - "condition.while": notApplicable, - disqualifyDelimiter: notApplicable, - environment: notApplicable, - fieldAccess: notApplicable, - functionCall: notApplicable, - "functionCall.constructor": notApplicable, - functionCallee: notApplicable, - "functionCallee.constructor": notApplicable, - ifStatement: notApplicable, - "interior.cell": notApplicable, - "interior.function": notApplicable, - "interior.constructor": notApplicable, - "interior.method": notApplicable, - "interior.if": notApplicable, - "interior.lambda": notApplicable, + "interior.switch": notApplicable, + "interior.switchCase": notApplicable, + "value.switch": notApplicable, + + // Loop + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, + + // For loop + "statement.for": notApplicable, + "condition.for": notApplicable, "interior.for": notApplicable, + + // For-each loop + "statement.foreach": notApplicable, "interior.foreach": notApplicable, + "name.foreach": notApplicable, + "type.foreach": notApplicable, + "value.foreach": notApplicable, + + // While loop + "statement.while": notApplicable, + "condition.while": notApplicable, "interior.while": notApplicable, + + // Do-while loop + "statement.doWhile": notApplicable, + "condition.doWhile": notApplicable, "interior.doWhile": notApplicable, + + // Resource statement + "statement.resource": notApplicable, "interior.resource": notApplicable, - "interior.switch": notApplicable, - "interior.switchCase": notApplicable, - "interior.ternary": notApplicable, - "interior.namespace": notApplicable, - "interior.static": notApplicable, + "name.resource": notApplicable, + "name.resource.iteration": notApplicable, + "type.resource": notApplicable, + "type.resource.iteration": notApplicable, + "value.resource": notApplicable, + "value.resource.iteration": notApplicable, + + // Map + map: notApplicable, "key.mapPair": notApplicable, "key.mapPair.iteration": notApplicable, - list: notApplicable, - map: notApplicable, - "name.argument.actual": notApplicable, - "name.argument.actual.iteration": notApplicable, - "name.argument.formal": notApplicable, - "name.argument.formal.constructor": notApplicable, - "name.argument.formal.constructor.iteration": notApplicable, - "name.argument.formal.iteration": notApplicable, - "name.argument.formal.method": notApplicable, - "name.argument.formal.method.iteration": notApplicable, - "name.assignment": notApplicable, - "name.assignment.pattern": notApplicable, + "value.mapPair": notApplicable, + "value.mapPair.iteration": notApplicable, + + // Multiline string + "string.multiLine": notApplicable, + "textFragment.string.multiLine": notApplicable, + + // Line comment + "comment.line": notApplicable, + "textFragment.comment.line": notApplicable, + + // Collection item + "collectionItem.unenclosed": notApplicable, + "collectionItem.unenclosed.iteration": notApplicable, + + // Static + "statement.static": notApplicable, + "interior.static": notApplicable, + + // Namespace + "statement.namespace": notApplicable, + "interior.namespace": notApplicable, "name.namespace": notApplicable, - "name.constructor": notApplicable, - "name.foreach": notApplicable, - "name.function": notApplicable, - "name.iteration.block": notApplicable, - "name.iteration.document": notApplicable, - "name.method": notApplicable, - "name.resource": notApplicable, - "name.resource.iteration": notApplicable, - "name.variable": notApplicable, - "name.variable.pattern": notApplicable, - namedFunction: notApplicable, - "namedFunction.constructor": notApplicable, - "namedFunction.iteration.document": notApplicable, - "namedFunction.method": notApplicable, - notebookCell: notApplicable, - pairDelimiter: notApplicable, - regularExpression: notApplicable, + + // Ternary + "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, + "condition.ternary": notApplicable, + "interior.ternary": notApplicable, + + // Section section: notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, - "statement.iteration.block": notApplicable, - "statement.iteration.document": notApplicable, - "string.multiLine": notApplicable, - "textFragment.comment.line": notApplicable, - "textFragment.string.multiLine": notApplicable, + + // Notebook cell + notebookCell: notApplicable, + "interior.cell": notApplicable, + + // Type alias "type.alias": notApplicable, - "type.argument.formal": notApplicable, - "type.argument.formal.constructor": notApplicable, - "type.argument.formal.constructor.iteration": notApplicable, - "type.argument.formal.iteration": notApplicable, - "type.argument.formal.method": notApplicable, - "type.argument.formal.method.iteration": notApplicable, + "value.typeAlias": notApplicable, + + // Miscellaneous statements + "statement.break": notApplicable, + "statement.continue": notApplicable, + "statement.misc": notApplicable, + "statement.iteration.document": notApplicable, + "statement.iteration.block": notApplicable, + + // Miscellaneous + environment: notApplicable, + fieldAccess: notApplicable, + "name.iteration.block": notApplicable, + "name.iteration.document": notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, "type.cast": notApplicable, - "type.foreach": notApplicable, - "type.return": notApplicable, - "type.variable": notApplicable, - "type.resource": notApplicable, - "type.resource.iteration": notApplicable, "type.typeArgument": notApplicable, "type.typeArgument.iteration": notApplicable, "type.iteration.block": notApplicable, "type.iteration.document": notApplicable, - "value.argument.actual": notApplicable, - "value.argument.actual.iteration": notApplicable, - "value.argument.formal": notApplicable, - "value.argument.formal.constructor": notApplicable, - "value.argument.formal.constructor.iteration": notApplicable, - "value.argument.formal.iteration": notApplicable, - "value.argument.formal.method": notApplicable, - "value.argument.formal.method.iteration": notApplicable, - "value.assignment": notApplicable, - "value.foreach": notApplicable, - "value.mapPair": notApplicable, - "value.mapPair.iteration": notApplicable, - "value.resource": notApplicable, - "value.resource.iteration": notApplicable, - "value.return": notApplicable, - "value.return.lambda": notApplicable, - "value.typeAlias": notApplicable, - "value.variable": notApplicable, - "value.variable.pattern": notApplicable, - "value.yield": notApplicable, - "value.switch": notApplicable, "value.iteration.block": notApplicable, "value.iteration.document": notApplicable, selector: notApplicable, unit: notApplicable, + list: notApplicable, + disqualifyDelimiter: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/yaml.ts b/packages/common/src/scopeSupportFacets/yaml.ts index b3ee2219a7..c9254b715c 100644 --- a/packages/common/src/scopeSupportFacets/yaml.ts +++ b/packages/common/src/scopeSupportFacets/yaml.ts @@ -29,6 +29,18 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { /* NOT APPLICABLE */ + // Variable + "statement.variable": notApplicable, + "statement.assignment": notApplicable, + "name.assignment": notApplicable, + "name.assignment.pattern": notApplicable, + "name.variable": notApplicable, + "name.variable.pattern": notApplicable, + "type.variable": notApplicable, + "value.assignment": notApplicable, + "value.variable": notApplicable, + "value.variable.pattern": notApplicable, + // Class class: notApplicable, "class.iteration.block": notApplicable, @@ -45,7 +57,110 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "value.field.class": notApplicable, "value.iteration.class": notApplicable, "interior.class": notApplicable, + + // Constructor + "statement.constructor": notApplicable, + "namedFunction.constructor": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, + "argument.actual.constructor.singleLine": notApplicable, + "argument.actual.constructor.multiLine": notApplicable, + "argument.actual.constructor.iteration": notApplicable, + "argument.formal.constructor.singleLine": notApplicable, + "argument.formal.constructor.multiLine": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argumentList.actual.constructor.empty": notApplicable, + "argumentList.actual.constructor.singleLine": notApplicable, + "argumentList.actual.constructor.multiLine": notApplicable, + "argumentList.formal.constructor.empty": notApplicable, + "argumentList.formal.constructor.singleLine": notApplicable, + "argumentList.formal.constructor.multiLine": notApplicable, + "interior.constructor": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.constructor": notApplicable, + "type.argument.formal.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "value.argument.formal.constructor": notApplicable, + "value.argument.formal.constructor.iteration": notApplicable, + + // Method + "statement.method": notApplicable, + "namedFunction.method": notApplicable, + "argument.actual.method.singleLine": notApplicable, + "argument.actual.method.multiLine": notApplicable, + "argument.actual.method.iteration": notApplicable, + "argument.formal.method.singleLine": notApplicable, + "argument.formal.method.multiLine": notApplicable, + "argument.formal.method.iteration": notApplicable, + "argumentList.actual.method.empty": notApplicable, + "argumentList.actual.method.singleLine": notApplicable, + "argumentList.actual.method.multiLine": notApplicable, + "argumentList.formal.method.empty": notApplicable, + "argumentList.formal.method.singleLine": notApplicable, + "argumentList.formal.method.multiLine": notApplicable, + "interior.method": notApplicable, + "name.argument.formal.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.method": notApplicable, + "type.argument.formal.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "value.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + + // Function + namedFunction: notApplicable, + "namedFunction.iteration.document": notApplicable, "namedFunction.iteration.class": notApplicable, + "statement.function": notApplicable, + "name.function": notApplicable, + "interior.function": notApplicable, + "argumentList.formal.empty": notApplicable, + "argumentList.formal.singleLine": notApplicable, + "argumentList.formal.multiLine": notApplicable, + "argument.formal.singleLine": notApplicable, + "argument.formal.multiLine": notApplicable, + "argument.formal.iteration": notApplicable, + "name.argument.formal": notApplicable, + "name.argument.formal.iteration": notApplicable, + "type.argument.formal": notApplicable, + "type.argument.formal.iteration": notApplicable, + "value.argument.formal": notApplicable, + "value.argument.formal.iteration": notApplicable, + + // Anonymous function / lambda + anonymousFunction: notApplicable, + "argumentList.formal.lambda.empty": notApplicable, + "argumentList.formal.lambda.singleLine": notApplicable, + "argumentList.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.singleLine": notApplicable, + "argument.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "value.return.lambda": notApplicable, + "interior.lambda": notApplicable, + + // Function call + functionCall: notApplicable, + functionCallee: notApplicable, + "argumentList.actual.empty": notApplicable, + "argumentList.actual.singleLine": notApplicable, + "argumentList.actual.multiLine": notApplicable, + "argument.actual.singleLine": notApplicable, + "argument.actual.multiLine": notApplicable, + "argument.actual.iteration": notApplicable, + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, + + // Return statement + "statement.return": notApplicable, + "type.return": notApplicable, + "value.return": notApplicable, + + // Yield statement + "statement.yield": notApplicable, + "value.yield": notApplicable, // Interface "statement.interface": notApplicable, @@ -71,11 +186,13 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, // Try catch + "statement.try": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, "interior.try": notApplicable, @@ -83,169 +200,126 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.catch": notApplicable, "type.argument.catch": notApplicable, - anonymousFunction: notApplicable, - "argument.actual.singleLine": notApplicable, - "argument.actual.multiLine": notApplicable, - "argument.actual.constructor.singleLine": notApplicable, - "argument.actual.constructor.multiLine": notApplicable, - "argument.actual.constructor.iteration": notApplicable, - "argument.actual.iteration": notApplicable, - "argument.actual.method.singleLine": notApplicable, - "argument.actual.method.multiLine": notApplicable, - "argument.actual.method.iteration": notApplicable, - "argument.formal.singleLine": notApplicable, - "argument.formal.multiLine": notApplicable, - "argument.formal.constructor.singleLine": notApplicable, - "argument.formal.constructor.multiLine": notApplicable, - "argument.formal.constructor.iteration": notApplicable, - "argument.formal.iteration": notApplicable, - "argument.formal.method.singleLine": notApplicable, - "argument.formal.method.multiLine": notApplicable, - "argument.formal.method.iteration": notApplicable, - "argument.formal.lambda.singleLine": notApplicable, - "argument.formal.lambda.multiLine": notApplicable, - "argument.formal.lambda.iteration": notApplicable, - "argumentList.actual.empty": notApplicable, - "argumentList.actual.singleLine": notApplicable, - "argumentList.actual.multiLine": notApplicable, - "argumentList.actual.method.empty": notApplicable, - "argumentList.actual.method.singleLine": notApplicable, - "argumentList.actual.method.multiLine": notApplicable, - "argumentList.actual.constructor.empty": notApplicable, - "argumentList.actual.constructor.singleLine": notApplicable, - "argumentList.actual.constructor.multiLine": notApplicable, - "argumentList.formal.empty": notApplicable, - "argumentList.formal.singleLine": notApplicable, - "argumentList.formal.multiLine": notApplicable, - "argumentList.formal.lambda.empty": notApplicable, - "argumentList.formal.lambda.singleLine": notApplicable, - "argumentList.formal.lambda.multiLine": notApplicable, - "argumentList.formal.method.empty": notApplicable, - "argumentList.formal.method.singleLine": notApplicable, - "argumentList.formal.method.multiLine": notApplicable, - "argumentList.formal.constructor.empty": notApplicable, - "argumentList.formal.constructor.singleLine": notApplicable, - "argumentList.formal.constructor.multiLine": notApplicable, - attribute: notApplicable, + // If statement + ifStatement: notApplicable, + "statement.if": notApplicable, "branch.if": notApplicable, "branch.if.elif.else": notApplicable, "branch.if.else": notApplicable, "branch.if.iteration": notApplicable, - "branch.loop": notApplicable, - "branch.loop.iteration": notApplicable, + "condition.if": notApplicable, + "interior.if": notApplicable, + + // Switch statement + "statement.switch": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, - "branch.ternary": notApplicable, - "branch.ternary.iteration": notApplicable, - "comment.block": notApplicable, - "condition.doWhile": notApplicable, - "condition.for": notApplicable, - "condition.if": notApplicable, "condition.switchCase": notApplicable, "condition.switchCase.iteration": notApplicable, - "condition.ternary": notApplicable, - "condition.while": notApplicable, - element: notApplicable, - endTag: notApplicable, - environment: notApplicable, - fieldAccess: notApplicable, - functionCall: notApplicable, - "functionCall.constructor": notApplicable, - functionCallee: notApplicable, - "functionCallee.constructor": notApplicable, - ifStatement: notApplicable, - "interior.cell": notApplicable, - "interior.element": notApplicable, - "interior.function": notApplicable, - "interior.constructor": notApplicable, - "interior.method": notApplicable, - "interior.if": notApplicable, - "interior.lambda": notApplicable, + "interior.switch": notApplicable, + "interior.switchCase": notApplicable, + "value.switch": notApplicable, + + // Loop + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, + + // For loop + "statement.for": notApplicable, + "condition.for": notApplicable, "interior.for": notApplicable, + + // For-each loop + "statement.foreach": notApplicable, "interior.foreach": notApplicable, + "name.foreach": notApplicable, + "type.foreach": notApplicable, + "value.foreach": notApplicable, + + // While loop + "statement.while": notApplicable, + "condition.while": notApplicable, "interior.while": notApplicable, + + // Do-while loop + "statement.doWhile": notApplicable, + "condition.doWhile": notApplicable, "interior.doWhile": notApplicable, + + // Resource statement + "statement.resource": notApplicable, "interior.resource": notApplicable, - "interior.switch": notApplicable, - "interior.switchCase": notApplicable, - "interior.ternary": notApplicable, - "interior.namespace": notApplicable, - "interior.static": notApplicable, - "key.attribute": notApplicable, - "name.argument.actual": notApplicable, - "name.argument.actual.iteration": notApplicable, - "name.argument.formal": notApplicable, - "name.argument.formal.constructor": notApplicable, - "name.argument.formal.constructor.iteration": notApplicable, - "name.argument.formal.iteration": notApplicable, - "name.argument.formal.method": notApplicable, - "name.argument.formal.method.iteration": notApplicable, - "name.assignment": notApplicable, - "name.assignment.pattern": notApplicable, - "name.namespace": notApplicable, - "name.constructor": notApplicable, - "name.foreach": notApplicable, - "name.function": notApplicable, - "name.iteration.block": notApplicable, - "name.iteration.document": notApplicable, - "name.method": notApplicable, "name.resource": notApplicable, "name.resource.iteration": notApplicable, - "name.variable": notApplicable, - "name.variable.pattern": notApplicable, - namedFunction: notApplicable, - "namedFunction.constructor": notApplicable, - "namedFunction.iteration.document": notApplicable, - "namedFunction.method": notApplicable, - notebookCell: notApplicable, - pairDelimiter: notApplicable, - regularExpression: notApplicable, + "type.resource": notApplicable, + "type.resource.iteration": notApplicable, + "value.resource": notApplicable, + "value.resource.iteration": notApplicable, + + // Block comment + "comment.block": notApplicable, + "textFragment.comment.block": notApplicable, + + // Static + "statement.static": notApplicable, + "interior.static": notApplicable, + + // Namespace + "statement.namespace": notApplicable, + "interior.namespace": notApplicable, + "name.namespace": notApplicable, + + // Ternary + "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, + "condition.ternary": notApplicable, + "interior.ternary": notApplicable, + + // Section section: notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, - startTag: notApplicable, - "statement.iteration.block": notApplicable, - "statement.iteration.document": notApplicable, - tags: notApplicable, - "textFragment.comment.block": notApplicable, + + // Element + element: notApplicable, + "interior.element": notApplicable, "textFragment.element": notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + + // Attribute + attribute: notApplicable, + "key.attribute": notApplicable, + "value.attribute": notApplicable, + + // Notebook cell + notebookCell: notApplicable, + "interior.cell": notApplicable, + + // Type alias "type.alias": notApplicable, - "type.argument.formal": notApplicable, - "type.argument.formal.constructor": notApplicable, - "type.argument.formal.constructor.iteration": notApplicable, - "type.argument.formal.iteration": notApplicable, - "type.argument.formal.method": notApplicable, - "type.argument.formal.method.iteration": notApplicable, + "value.typeAlias": notApplicable, + + // Miscellaneous statements + "statement.break": notApplicable, + "statement.continue": notApplicable, + "statement.misc": notApplicable, + "statement.iteration.document": notApplicable, + "statement.iteration.block": notApplicable, + + // Miscellaneous + environment: notApplicable, + fieldAccess: notApplicable, + "name.iteration.block": notApplicable, + "name.iteration.document": notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, "type.cast": notApplicable, - "type.foreach": notApplicable, - "type.variable": notApplicable, - "type.return": notApplicable, - "type.resource": notApplicable, - "type.resource.iteration": notApplicable, "type.typeArgument": notApplicable, "type.typeArgument.iteration": notApplicable, "type.iteration.block": notApplicable, "type.iteration.document": notApplicable, - "value.argument.actual": notApplicable, - "value.argument.actual.iteration": notApplicable, - "value.argument.formal": notApplicable, - "value.argument.formal.constructor": notApplicable, - "value.argument.formal.constructor.iteration": notApplicable, - "value.argument.formal.iteration": notApplicable, - "value.argument.formal.method": notApplicable, - "value.argument.formal.method.iteration": notApplicable, - "value.assignment": notApplicable, - "value.attribute": notApplicable, - "value.foreach": notApplicable, - "value.resource": notApplicable, - "value.resource.iteration": notApplicable, - "value.return": notApplicable, - "value.return.lambda": notApplicable, - "value.typeAlias": notApplicable, - "value.variable": notApplicable, - "value.variable.pattern": notApplicable, - "value.yield": notApplicable, - "value.switch": notApplicable, "value.iteration.block": notApplicable, "value.iteration.document": notApplicable, selector: notApplicable, diff --git a/queries/css.scm b/queries/css.scm index c30344a585..fe19c7b302 100644 --- a/queries/css.scm +++ b/queries/css.scm @@ -83,9 +83,9 @@ . (_) @_.trailing.startOf )? - ) + ) @_dummyList (#grow-to-named-siblings! @argumentOrParameter "at") - (#insertion-delimiter! @argumentOrParameter ", ") + (#single-or-multi-line-delimiter! @argumentOrParameter @_dummyList ", " ",\n") ) ;;!! translate(-50%, -50%) From 99f0fc8bf4629a4ea1a1d4eb4556152e0428cced Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 12:29:56 +0200 Subject: [PATCH 06/18] cpp missing scopes --- .../scopes/cpp/argument/argument.catch.scope | 11 ++++ .../scopes/cpp/branch.try.iteration.scope | 8 +-- data/fixtures/scopes/cpp/branch.try.scope | 16 ++--- .../scopes/cpp/name/name.argument.catch.scope | 21 +++++++ .../scopes/cpp/statement/statement.try.scope | 8 +-- .../scopes/cpp/type/type.argument.catch.scope | 25 ++++++++ .../collectionItem.unenclosed.iteration.scope | 63 ++----------------- queries/cpp.scm | 2 +- 8 files changed, 80 insertions(+), 74 deletions(-) create mode 100644 data/fixtures/scopes/cpp/argument/argument.catch.scope create mode 100644 data/fixtures/scopes/cpp/name/name.argument.catch.scope create mode 100644 data/fixtures/scopes/cpp/type/type.argument.catch.scope diff --git a/data/fixtures/scopes/cpp/argument/argument.catch.scope b/data/fixtures/scopes/cpp/argument/argument.catch.scope new file mode 100644 index 0000000000..170bfb3b38 --- /dev/null +++ b/data/fixtures/scopes/cpp/argument/argument.catch.scope @@ -0,0 +1,11 @@ +try {} +catch (const std::exception e) {} +--- + +[Content] = +[Removal] = +[Domain] = 1:7-1:29 + >----------------------< +1| catch (const std::exception e) {} + +[Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/cpp/branch.try.iteration.scope b/data/fixtures/scopes/cpp/branch.try.iteration.scope index e7b19b17dd..8220f8cb54 100644 --- a/data/fixtures/scopes/cpp/branch.try.iteration.scope +++ b/data/fixtures/scopes/cpp/branch.try.iteration.scope @@ -1,10 +1,10 @@ try {} -catch (const std::exception& e) {} +catch (const std::exception e) {} --- [Content] = -[Domain] = 0:0-1:34 +[Domain] = 0:0-1:33 >------ 0| try {} -1| catch (const std::exception& e) {} - ----------------------------------< +1| catch (const std::exception e) {} + ---------------------------------< diff --git a/data/fixtures/scopes/cpp/branch.try.scope b/data/fixtures/scopes/cpp/branch.try.scope index d34a05b27e..d65e6fd771 100644 --- a/data/fixtures/scopes/cpp/branch.try.scope +++ b/data/fixtures/scopes/cpp/branch.try.scope @@ -1,5 +1,5 @@ try {} -catch (const std::exception& e) {} +catch (const std::exception e) {} --- [#1 Content] = @@ -10,21 +10,21 @@ catch (const std::exception& e) {} [#1 Removal] = 0:0-1:0 >------ 0| try {} -1| catch (const std::exception& e) {} +1| catch (const std::exception e) {} < [#1 Insertion delimiter] = "\n" [#2 Content] = -[#2 Domain] = 1:0-1:34 - >----------------------------------< -1| catch (const std::exception& e) {} +[#2 Domain] = 1:0-1:33 + >---------------------------------< +1| catch (const std::exception e) {} -[#2 Removal] = 0:6-1:34 +[#2 Removal] = 0:6-1:33 > 0| try {} -1| catch (const std::exception& e) {} - ----------------------------------< +1| catch (const std::exception e) {} + ---------------------------------< [#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/cpp/name/name.argument.catch.scope b/data/fixtures/scopes/cpp/name/name.argument.catch.scope new file mode 100644 index 0000000000..48a88a437f --- /dev/null +++ b/data/fixtures/scopes/cpp/name/name.argument.catch.scope @@ -0,0 +1,21 @@ +try {} +catch (const std::exception e) {} +--- + +[Content] = 1:28-1:29 + >-< +1| catch (const std::exception e) {} + +[Removal] = 1:27-1:29 + >--< +1| catch (const std::exception e) {} + +[Leading delimiter] = 1:27-1:28 + >-< +1| catch (const std::exception e) {} + +[Domain] = 1:7-1:29 + >----------------------< +1| catch (const std::exception e) {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/statement/statement.try.scope b/data/fixtures/scopes/cpp/statement/statement.try.scope index 395e1ec8fb..85aa49ce42 100644 --- a/data/fixtures/scopes/cpp/statement/statement.try.scope +++ b/data/fixtures/scopes/cpp/statement/statement.try.scope @@ -1,13 +1,13 @@ try {} -catch (const std::exception& e) {} +catch (const std::exception e) {} --- [Content] = [Removal] = -[Domain] = 0:0-1:34 +[Domain] = 0:0-1:33 >------ 0| try {} -1| catch (const std::exception& e) {} - ----------------------------------< +1| catch (const std::exception e) {} + ---------------------------------< [Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/cpp/type/type.argument.catch.scope b/data/fixtures/scopes/cpp/type/type.argument.catch.scope new file mode 100644 index 0000000000..e0c229145d --- /dev/null +++ b/data/fixtures/scopes/cpp/type/type.argument.catch.scope @@ -0,0 +1,25 @@ +try {} +catch (const std::exception e) {} +--- + +[Content] = 1:13-1:27 + >--------------< +1| catch (const std::exception e) {} + +[Removal] = 1:13-1:28 + >---------------< +1| catch (const std::exception e) {} + +[Leading delimiter] = 1:12-1:13 + >-< +1| catch (const std::exception e) {} + +[Trailing delimiter] = 1:27-1:28 + >-< +1| catch (const std::exception e) {} + +[Domain] = 1:7-1:29 + >----------------------< +1| catch (const std::exception e) {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/markdown/collectionItem.unenclosed.iteration.scope b/data/fixtures/scopes/markdown/collectionItem.unenclosed.iteration.scope index 334572988c..1ad353d354 100644 --- a/data/fixtures/scopes/markdown/collectionItem.unenclosed.iteration.scope +++ b/data/fixtures/scopes/markdown/collectionItem.unenclosed.iteration.scope @@ -3,69 +3,18 @@ - This is the first level of a list again. --- -[#1 Content] = 0:2-1:39 - >---------------------------------- -0| - This is the first level of a list. -1| - This is the second level of a list. - ---------------------------------------< - -[#1 Removal] = 0:0-2:0 +[#1 Content] = +[#1 Domain] = 0:0-2:42 >------------------------------------ 0| - This is the first level of a list. 1| - This is the second level of a list. 2| - This is the first level of a list again. - < - -[#1 Trailing delimiter] = 1:39-2:0 - > -1| - This is the second level of a list. -2| - This is the first level of a list again. - < + ------------------------------------------< -[#1 Domain] = 0:0-1:39 - >------------------------------------ -0| - This is the first level of a list. -1| - This is the second level of a list. - ---------------------------------------< - -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = 1:4-1:39 - >-----------------------------------< -1| - This is the second level of a list. -[#2 Removal] = 1:0-2:0 - >--------------------------------------- +[#2 Content] = +[#2 Domain] = 1:2-2:0 + >------------------------------------- 1| - This is the second level of a list. 2| - This is the first level of a list again. < - -[#2 Leading delimiter] = 1:0-1:2 - >--< -1| - This is the second level of a list. - -[#2 Domain] = 1:2-1:39 - >-------------------------------------< -1| - This is the second level of a list. - -[#2 Insertion delimiter] = "\n" - - -[#3 Content] = 2:2-2:42 - >----------------------------------------< -2| - This is the first level of a list again. - -[#3 Removal] = 2:0-2:42 - >------------------------------------------< -2| - This is the first level of a list again. - -[#3 Leading delimiter] = 2:0-2:0 - >< -2| - This is the first level of a list again. - -[#3 Domain] = 2:0-2:42 - >------------------------------------------< -2| - This is the first level of a list again. - -[#3 Insertion delimiter] = "\n" diff --git a/queries/cpp.scm b/queries/cpp.scm index 8e0f8a9fee..2b1bf3f7c1 100644 --- a/queries/cpp.scm +++ b/queries/cpp.scm @@ -103,7 +103,7 @@ ) @branch.end @interior.domain.end ) @branch.iteration -;;!! catch (const std::exception& e) {} +;;!! catch (const std::exception e) {} (catch_clause body: (_ "{" @interior.start.endOf From 0f4862ff050f07b6a74519f4e0710d0ded2d36fa Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 12:34:47 +0200 Subject: [PATCH 07/18] json --- .../common/src/scopeSupportFacets/json.ts | 355 +++++++++++------- 1 file changed, 215 insertions(+), 140 deletions(-) diff --git a/packages/common/src/scopeSupportFacets/json.ts b/packages/common/src/scopeSupportFacets/json.ts index 680802f246..08135ca5a8 100644 --- a/packages/common/src/scopeSupportFacets/json.ts +++ b/packages/common/src/scopeSupportFacets/json.ts @@ -23,6 +23,18 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { /* NOT APPLICABLE */ + // Variable + "statement.variable": notApplicable, + "statement.assignment": notApplicable, + "name.assignment": notApplicable, + "name.assignment.pattern": notApplicable, + "name.variable": notApplicable, + "name.variable.pattern": notApplicable, + "type.variable": notApplicable, + "value.assignment": notApplicable, + "value.variable": notApplicable, + "value.variable.pattern": notApplicable, + // Class class: notApplicable, "class.iteration.block": notApplicable, @@ -39,7 +51,110 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "value.field.class": notApplicable, "value.iteration.class": notApplicable, "interior.class": notApplicable, + + // Constructor + "statement.constructor": notApplicable, + "namedFunction.constructor": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, + "argument.actual.constructor.singleLine": notApplicable, + "argument.actual.constructor.multiLine": notApplicable, + "argument.actual.constructor.iteration": notApplicable, + "argument.formal.constructor.singleLine": notApplicable, + "argument.formal.constructor.multiLine": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argumentList.actual.constructor.empty": notApplicable, + "argumentList.actual.constructor.singleLine": notApplicable, + "argumentList.actual.constructor.multiLine": notApplicable, + "argumentList.formal.constructor.empty": notApplicable, + "argumentList.formal.constructor.singleLine": notApplicable, + "argumentList.formal.constructor.multiLine": notApplicable, + "interior.constructor": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.constructor": notApplicable, + "type.argument.formal.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "value.argument.formal.constructor": notApplicable, + "value.argument.formal.constructor.iteration": notApplicable, + + // Method + "statement.method": notApplicable, + "namedFunction.method": notApplicable, + "argument.actual.method.singleLine": notApplicable, + "argument.actual.method.multiLine": notApplicable, + "argument.actual.method.iteration": notApplicable, + "argument.formal.method.singleLine": notApplicable, + "argument.formal.method.multiLine": notApplicable, + "argument.formal.method.iteration": notApplicable, + "argumentList.actual.method.empty": notApplicable, + "argumentList.actual.method.singleLine": notApplicable, + "argumentList.actual.method.multiLine": notApplicable, + "argumentList.formal.method.empty": notApplicable, + "argumentList.formal.method.singleLine": notApplicable, + "argumentList.formal.method.multiLine": notApplicable, + "interior.method": notApplicable, + "name.argument.formal.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.method": notApplicable, + "type.argument.formal.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "value.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + + // Function + namedFunction: notApplicable, + "namedFunction.iteration.document": notApplicable, "namedFunction.iteration.class": notApplicable, + "statement.function": notApplicable, + "name.function": notApplicable, + "interior.function": notApplicable, + "argumentList.formal.empty": notApplicable, + "argumentList.formal.singleLine": notApplicable, + "argumentList.formal.multiLine": notApplicable, + "argument.formal.singleLine": notApplicable, + "argument.formal.multiLine": notApplicable, + "argument.formal.iteration": notApplicable, + "name.argument.formal": notApplicable, + "name.argument.formal.iteration": notApplicable, + "type.argument.formal": notApplicable, + "type.argument.formal.iteration": notApplicable, + "value.argument.formal": notApplicable, + "value.argument.formal.iteration": notApplicable, + + // Anonymous function / lambda + anonymousFunction: notApplicable, + "argumentList.formal.lambda.empty": notApplicable, + "argumentList.formal.lambda.singleLine": notApplicable, + "argumentList.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.singleLine": notApplicable, + "argument.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "value.return.lambda": notApplicable, + "interior.lambda": notApplicable, + + // Function call + functionCall: notApplicable, + functionCallee: notApplicable, + "argumentList.actual.empty": notApplicable, + "argumentList.actual.singleLine": notApplicable, + "argumentList.actual.multiLine": notApplicable, + "argument.actual.singleLine": notApplicable, + "argument.actual.multiLine": notApplicable, + "argument.actual.iteration": notApplicable, + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, + + // Return statement + "statement.return": notApplicable, + "type.return": notApplicable, + "value.return": notApplicable, + + // Yield statement + "statement.yield": notApplicable, + "value.yield": notApplicable, // Interface "statement.interface": notApplicable, @@ -65,11 +180,13 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, // Try catch + "statement.try": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, "interior.try": notApplicable, @@ -77,175 +194,133 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.catch": notApplicable, "type.argument.catch": notApplicable, - anonymousFunction: notApplicable, - "argument.actual.singleLine": notApplicable, - "argument.actual.multiLine": notApplicable, - "argument.actual.constructor.singleLine": notApplicable, - "argument.actual.constructor.multiLine": notApplicable, - "argument.actual.constructor.iteration": notApplicable, - "argument.actual.iteration": notApplicable, - "argument.actual.method.singleLine": notApplicable, - "argument.actual.method.multiLine": notApplicable, - "argument.actual.method.iteration": notApplicable, - "argument.formal.singleLine": notApplicable, - "argument.formal.multiLine": notApplicable, - "argument.formal.constructor.singleLine": notApplicable, - "argument.formal.constructor.multiLine": notApplicable, - "argument.formal.constructor.iteration": notApplicable, - "argument.formal.iteration": notApplicable, - "argument.formal.method.singleLine": notApplicable, - "argument.formal.method.multiLine": notApplicable, - "argument.formal.method.iteration": notApplicable, - "argument.formal.lambda.singleLine": notApplicable, - "argument.formal.lambda.multiLine": notApplicable, - "argument.formal.lambda.iteration": notApplicable, - "argumentList.actual.empty": notApplicable, - "argumentList.actual.singleLine": notApplicable, - "argumentList.actual.multiLine": notApplicable, - "argumentList.actual.method.empty": notApplicable, - "argumentList.actual.method.singleLine": notApplicable, - "argumentList.actual.method.multiLine": notApplicable, - "argumentList.actual.constructor.empty": notApplicable, - "argumentList.actual.constructor.singleLine": notApplicable, - "argumentList.actual.constructor.multiLine": notApplicable, - "argumentList.formal.empty": notApplicable, - "argumentList.formal.singleLine": notApplicable, - "argumentList.formal.multiLine": notApplicable, - "argumentList.formal.lambda.empty": notApplicable, - "argumentList.formal.lambda.singleLine": notApplicable, - "argumentList.formal.lambda.multiLine": notApplicable, - "argumentList.formal.method.empty": notApplicable, - "argumentList.formal.method.singleLine": notApplicable, - "argumentList.formal.method.multiLine": notApplicable, - "argumentList.formal.constructor.empty": notApplicable, - "argumentList.formal.constructor.singleLine": notApplicable, - "argumentList.formal.constructor.multiLine": notApplicable, - attribute: notApplicable, + // If statement + ifStatement: notApplicable, + "statement.if": notApplicable, "branch.if": notApplicable, "branch.if.elif.else": notApplicable, "branch.if.else": notApplicable, "branch.if.iteration": notApplicable, - "branch.loop": notApplicable, - "branch.loop.iteration": notApplicable, + "condition.if": notApplicable, + "interior.if": notApplicable, + + // Switch statement + "statement.switch": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, - "branch.ternary": notApplicable, - "branch.ternary.iteration": notApplicable, - "collectionItem.unenclosed": notApplicable, - "collectionItem.unenclosed.iteration": notApplicable, - "condition.doWhile": notApplicable, - "condition.for": notApplicable, - "condition.if": notApplicable, "condition.switchCase": notApplicable, "condition.switchCase.iteration": notApplicable, - "condition.ternary": notApplicable, - "condition.while": notApplicable, - disqualifyDelimiter: notApplicable, - element: notApplicable, - endTag: notApplicable, - environment: notApplicable, - fieldAccess: notApplicable, - functionCall: notApplicable, - "functionCall.constructor": notApplicable, - functionCallee: notApplicable, - "functionCallee.constructor": notApplicable, - ifStatement: notApplicable, - "interior.cell": notApplicable, - "interior.element": notApplicable, - "interior.function": notApplicable, - "interior.constructor": notApplicable, - "interior.method": notApplicable, - "interior.if": notApplicable, - "interior.lambda": notApplicable, + "interior.switch": notApplicable, + "interior.switchCase": notApplicable, + "value.switch": notApplicable, + + // Loop + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, + + // For loop + "statement.for": notApplicable, + "condition.for": notApplicable, "interior.for": notApplicable, + + // For-each loop + "statement.foreach": notApplicable, "interior.foreach": notApplicable, + "name.foreach": notApplicable, + "type.foreach": notApplicable, + "value.foreach": notApplicable, + + // While loop + "statement.while": notApplicable, + "condition.while": notApplicable, "interior.while": notApplicable, + + // Do-while loop + "statement.doWhile": notApplicable, + "condition.doWhile": notApplicable, "interior.doWhile": notApplicable, + + // Resource statement + "statement.resource": notApplicable, "interior.resource": notApplicable, - "interior.switch": notApplicable, - "interior.switchCase": notApplicable, - "interior.ternary": notApplicable, + "name.resource": notApplicable, + "name.resource.iteration": notApplicable, + "type.resource": notApplicable, + "type.resource.iteration": notApplicable, + "value.resource": notApplicable, + "value.resource.iteration": notApplicable, + + // Multiline string + "string.multiLine": notApplicable, + "textFragment.string.multiLine": notApplicable, + + // Static + "statement.static": notApplicable, "interior.static": notApplicable, + + // Namespace + "statement.namespace": notApplicable, "interior.namespace": notApplicable, - "key.attribute": notApplicable, - "name.argument.actual": notApplicable, - "name.argument.actual.iteration": notApplicable, - "name.argument.formal": notApplicable, - "name.argument.formal.constructor": notApplicable, - "name.argument.formal.constructor.iteration": notApplicable, - "name.argument.formal.iteration": notApplicable, - "name.argument.formal.method": notApplicable, - "name.argument.formal.method.iteration": notApplicable, - "name.assignment": notApplicable, - "name.assignment.pattern": notApplicable, "name.namespace": notApplicable, - "name.constructor": notApplicable, - "name.foreach": notApplicable, - "name.function": notApplicable, - "name.iteration.block": notApplicable, - "name.iteration.document": notApplicable, - "name.method": notApplicable, - "name.resource": notApplicable, - "name.resource.iteration": notApplicable, - "name.variable": notApplicable, - "name.variable.pattern": notApplicable, - namedFunction: notApplicable, - "namedFunction.constructor": notApplicable, - "namedFunction.iteration.document": notApplicable, - "namedFunction.method": notApplicable, - notebookCell: notApplicable, - pairDelimiter: notApplicable, - regularExpression: notApplicable, + + // Ternary + "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, + "condition.ternary": notApplicable, + "interior.ternary": notApplicable, + + // Section section: notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, - startTag: notApplicable, - "statement.iteration.block": notApplicable, - "statement.iteration.document": notApplicable, - "string.multiLine": notApplicable, - tags: notApplicable, + // Element + element: notApplicable, + "interior.element": notApplicable, "textFragment.element": notApplicable, - "textFragment.string.multiLine": notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + + // Attribute + attribute: notApplicable, + "key.attribute": notApplicable, + "value.attribute": notApplicable, + + // Notebook cell + notebookCell: notApplicable, + "interior.cell": notApplicable, + + // Type alias "type.alias": notApplicable, - "type.argument.formal": notApplicable, - "type.argument.formal.constructor": notApplicable, - "type.argument.formal.constructor.iteration": notApplicable, - "type.argument.formal.iteration": notApplicable, - "type.argument.formal.method": notApplicable, - "type.argument.formal.method.iteration": notApplicable, + "value.typeAlias": notApplicable, + + // Collection item + "collectionItem.unenclosed": notApplicable, + "collectionItem.unenclosed.iteration": notApplicable, + + // Miscellaneous statements + "statement.break": notApplicable, + "statement.continue": notApplicable, + "statement.misc": notApplicable, + "statement.iteration.document": notApplicable, + "statement.iteration.block": notApplicable, + + // Miscellaneous + environment: notApplicable, + fieldAccess: notApplicable, + "name.iteration.block": notApplicable, + "name.iteration.document": notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, "type.cast": notApplicable, - "type.foreach": notApplicable, - "type.variable": notApplicable, - "type.return": notApplicable, - "type.resource": notApplicable, - "type.resource.iteration": notApplicable, "type.typeArgument": notApplicable, "type.typeArgument.iteration": notApplicable, "type.iteration.block": notApplicable, "type.iteration.document": notApplicable, - "value.argument.actual": notApplicable, - "value.argument.actual.iteration": notApplicable, - "value.argument.formal": notApplicable, - "value.argument.formal.constructor": notApplicable, - "value.argument.formal.constructor.iteration": notApplicable, - "value.argument.formal.iteration": notApplicable, - "value.argument.formal.method": notApplicable, - "value.argument.formal.method.iteration": notApplicable, - "value.assignment": notApplicable, - "value.attribute": notApplicable, - "value.foreach": notApplicable, - "value.resource": notApplicable, - "value.resource.iteration": notApplicable, - "value.return": notApplicable, - "value.return.lambda": notApplicable, - "value.typeAlias": notApplicable, - "value.variable": notApplicable, - "value.variable.pattern": notApplicable, - "value.yield": notApplicable, - "value.switch": notApplicable, "value.iteration.block": notApplicable, "value.iteration.document": notApplicable, selector: notApplicable, unit: notApplicable, + disqualifyDelimiter: notApplicable, }; From 3938c3a209b38065a131d8040ee9006d86219bb8 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 12:38:06 +0200 Subject: [PATCH 08/18] scm --- packages/common/src/scopeSupportFacets/scm.ts | 357 +++++++++++------- 1 file changed, 218 insertions(+), 139 deletions(-) diff --git a/packages/common/src/scopeSupportFacets/scm.ts b/packages/common/src/scopeSupportFacets/scm.ts index cb098ae2b8..a8e7c2f416 100644 --- a/packages/common/src/scopeSupportFacets/scm.ts +++ b/packages/common/src/scopeSupportFacets/scm.ts @@ -25,6 +25,18 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { /* NOT APPLICABLE */ + // Variable + "statement.variable": notApplicable, + "statement.assignment": notApplicable, + "name.assignment": notApplicable, + "name.assignment.pattern": notApplicable, + "name.variable": notApplicable, + "name.variable.pattern": notApplicable, + "type.variable": notApplicable, + "value.assignment": notApplicable, + "value.variable": notApplicable, + "value.variable.pattern": notApplicable, + // Class class: notApplicable, "class.iteration.block": notApplicable, @@ -41,7 +53,102 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "value.field.class": notApplicable, "value.iteration.class": notApplicable, "interior.class": notApplicable, + + // Constructor + "statement.constructor": notApplicable, + "namedFunction.constructor": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, + "argument.actual.constructor.singleLine": notApplicable, + "argument.actual.constructor.multiLine": notApplicable, + "argument.actual.constructor.iteration": notApplicable, + "argument.formal.constructor.singleLine": notApplicable, + "argument.formal.constructor.multiLine": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argumentList.actual.constructor.empty": notApplicable, + "argumentList.actual.constructor.singleLine": notApplicable, + "argumentList.actual.constructor.multiLine": notApplicable, + "argumentList.formal.constructor.empty": notApplicable, + "argumentList.formal.constructor.singleLine": notApplicable, + "argumentList.formal.constructor.multiLine": notApplicable, + "interior.constructor": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.constructor": notApplicable, + "type.argument.formal.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "value.argument.formal.constructor": notApplicable, + "value.argument.formal.constructor.iteration": notApplicable, + + // Method + "statement.method": notApplicable, + "namedFunction.method": notApplicable, + "argument.actual.method.singleLine": notApplicable, + "argument.actual.method.multiLine": notApplicable, + "argument.actual.method.iteration": notApplicable, + "argument.formal.method.singleLine": notApplicable, + "argument.formal.method.multiLine": notApplicable, + "argument.formal.method.iteration": notApplicable, + "argumentList.actual.method.empty": notApplicable, + "argumentList.actual.method.singleLine": notApplicable, + "argumentList.actual.method.multiLine": notApplicable, + "argumentList.formal.method.empty": notApplicable, + "argumentList.formal.method.singleLine": notApplicable, + "argumentList.formal.method.multiLine": notApplicable, + "interior.method": notApplicable, + "name.argument.formal.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.method": notApplicable, + "type.argument.formal.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "value.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + + // Function + namedFunction: notApplicable, + "namedFunction.iteration.document": notApplicable, "namedFunction.iteration.class": notApplicable, + "statement.function": notApplicable, + "name.function": notApplicable, + "interior.function": notApplicable, + "argumentList.formal.empty": notApplicable, + "argumentList.formal.singleLine": notApplicable, + "argumentList.formal.multiLine": notApplicable, + "argument.formal.singleLine": notApplicable, + "argument.formal.multiLine": notApplicable, + "argument.formal.iteration": notApplicable, + "name.argument.formal": notApplicable, + "name.argument.formal.iteration": notApplicable, + "type.argument.formal": notApplicable, + "type.argument.formal.iteration": notApplicable, + "value.argument.formal": notApplicable, + "value.argument.formal.iteration": notApplicable, + + // Anonymous function / lambda + anonymousFunction: notApplicable, + "argumentList.formal.lambda.empty": notApplicable, + "argumentList.formal.lambda.singleLine": notApplicable, + "argumentList.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.singleLine": notApplicable, + "argument.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "value.return.lambda": notApplicable, + "interior.lambda": notApplicable, + + // Keyword argument + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, + + // Return statement + "statement.return": notApplicable, + "type.return": notApplicable, + "value.return": notApplicable, + + // Yield statement + "statement.yield": notApplicable, + "value.yield": notApplicable, // Interface "statement.interface": notApplicable, @@ -67,11 +174,13 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, // Try catch + "statement.try": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, "interior.try": notApplicable, @@ -79,173 +188,143 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.catch": notApplicable, "type.argument.catch": notApplicable, - anonymousFunction: notApplicable, - "argument.actual.constructor.singleLine": notApplicable, - "argument.actual.constructor.multiLine": notApplicable, - "argument.actual.constructor.iteration": notApplicable, - "argument.actual.method.singleLine": notApplicable, - "argument.actual.method.multiLine": notApplicable, - "argument.actual.method.iteration": notApplicable, - "argument.formal.singleLine": notApplicable, - "argument.formal.multiLine": notApplicable, - "argument.formal.constructor.singleLine": notApplicable, - "argument.formal.constructor.multiLine": notApplicable, - "argument.formal.constructor.iteration": notApplicable, - "argument.formal.iteration": notApplicable, - "argument.formal.method.singleLine": notApplicable, - "argument.formal.method.multiLine": notApplicable, - "argument.formal.method.iteration": notApplicable, - "argument.formal.lambda.singleLine": notApplicable, - "argument.formal.lambda.multiLine": notApplicable, - "argument.formal.lambda.iteration": notApplicable, - "argumentList.actual.method.empty": notApplicable, - "argumentList.actual.method.singleLine": notApplicable, - "argumentList.actual.method.multiLine": notApplicable, - "argumentList.actual.constructor.empty": notApplicable, - "argumentList.actual.constructor.singleLine": notApplicable, - "argumentList.actual.constructor.multiLine": notApplicable, - "argumentList.formal.empty": notApplicable, - "argumentList.formal.singleLine": notApplicable, - "argumentList.formal.multiLine": notApplicable, - "argumentList.formal.lambda.empty": notApplicable, - "argumentList.formal.lambda.singleLine": notApplicable, - "argumentList.formal.lambda.multiLine": notApplicable, - "argumentList.formal.method.empty": notApplicable, - "argumentList.formal.method.singleLine": notApplicable, - "argumentList.formal.method.multiLine": notApplicable, - "argumentList.formal.constructor.empty": notApplicable, - "argumentList.formal.constructor.singleLine": notApplicable, - "argumentList.formal.constructor.multiLine": notApplicable, - attribute: notApplicable, + // If statement + ifStatement: notApplicable, + "statement.if": notApplicable, "branch.if": notApplicable, "branch.if.elif.else": notApplicable, "branch.if.else": notApplicable, "branch.if.iteration": notApplicable, - "branch.loop": notApplicable, - "branch.loop.iteration": notApplicable, + "condition.if": notApplicable, + "interior.if": notApplicable, + + // Switch statement + "statement.switch": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, - "branch.ternary": notApplicable, - "branch.ternary.iteration": notApplicable, - "comment.block": notApplicable, - "condition.doWhile": notApplicable, - "condition.for": notApplicable, - "condition.if": notApplicable, "condition.switchCase": notApplicable, "condition.switchCase.iteration": notApplicable, - "condition.ternary": notApplicable, - "condition.while": notApplicable, - "collectionItem.unenclosed": notApplicable, - "collectionItem.unenclosed.iteration": notApplicable, - disqualifyDelimiter: notApplicable, - element: notApplicable, - endTag: notApplicable, - environment: notApplicable, - fieldAccess: notApplicable, - "functionCall.constructor": notApplicable, - "functionCallee.constructor": notApplicable, - ifStatement: notApplicable, - "interior.cell": notApplicable, - "interior.element": notApplicable, - "interior.function": notApplicable, - "interior.constructor": notApplicable, - "interior.method": notApplicable, - "interior.if": notApplicable, - "interior.lambda": notApplicable, + "interior.switch": notApplicable, + "interior.switchCase": notApplicable, + "value.switch": notApplicable, + + // Loop + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, + + // For loop + "statement.for": notApplicable, + "condition.for": notApplicable, "interior.for": notApplicable, + + // For-each loop + "statement.foreach": notApplicable, "interior.foreach": notApplicable, + "name.foreach": notApplicable, + "type.foreach": notApplicable, + "value.foreach": notApplicable, + + // While loop + "statement.while": notApplicable, + "condition.while": notApplicable, "interior.while": notApplicable, + + // Do-while loop + "statement.doWhile": notApplicable, + "condition.doWhile": notApplicable, "interior.doWhile": notApplicable, + + // Resource statement + "statement.resource": notApplicable, "interior.resource": notApplicable, - "interior.switch": notApplicable, - "interior.switchCase": notApplicable, - "interior.ternary": notApplicable, - "interior.namespace": notApplicable, - "interior.static": notApplicable, - "key.attribute": notApplicable, + "name.resource": notApplicable, + "name.resource.iteration": notApplicable, + "type.resource": notApplicable, + "type.resource.iteration": notApplicable, + "value.resource": notApplicable, + "value.resource.iteration": notApplicable, + + // Map + map: notApplicable, "key.mapPair": notApplicable, "key.mapPair.iteration": notApplicable, - map: notApplicable, - "name.argument.actual": notApplicable, - "name.argument.actual.iteration": notApplicable, - "name.argument.formal": notApplicable, - "name.argument.formal.constructor": notApplicable, - "name.argument.formal.constructor.iteration": notApplicable, - "name.argument.formal.iteration": notApplicable, - "name.argument.formal.method": notApplicable, - "name.argument.formal.method.iteration": notApplicable, - "name.assignment": notApplicable, - "name.assignment.pattern": notApplicable, + "value.mapPair": notApplicable, + "value.mapPair.iteration": notApplicable, + + // Multiline string + "string.multiLine": notApplicable, + "textFragment.string.multiLine": notApplicable, + + // Block comment + "comment.block": notApplicable, + "textFragment.comment.block": notApplicable, + + // Static + "statement.static": notApplicable, + "interior.static": notApplicable, + + // Namespace + "statement.namespace": notApplicable, + "interior.namespace": notApplicable, "name.namespace": notApplicable, - "name.constructor": notApplicable, - "name.foreach": notApplicable, - "name.function": notApplicable, - "name.iteration.block": notApplicable, - "name.iteration.document": notApplicable, - "name.method": notApplicable, - "name.resource": notApplicable, - "name.resource.iteration": notApplicable, - "name.variable": notApplicable, - "name.variable.pattern": notApplicable, - namedFunction: notApplicable, - "namedFunction.constructor": notApplicable, - "namedFunction.iteration.document": notApplicable, - "namedFunction.method": notApplicable, - notebookCell: notApplicable, - pairDelimiter: notApplicable, - regularExpression: notApplicable, + + // Ternary + "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, + "condition.ternary": notApplicable, + "interior.ternary": notApplicable, + + // Section section: notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, - startTag: notApplicable, - "statement.iteration.block": notApplicable, - "statement.iteration.document": notApplicable, - "string.multiLine": notApplicable, - tags: notApplicable, - "textFragment.comment.block": notApplicable, + + // Element + element: notApplicable, + "interior.element": notApplicable, "textFragment.element": notApplicable, - "textFragment.string.multiLine": notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + + // Attribute + attribute: notApplicable, + "key.attribute": notApplicable, + "value.attribute": notApplicable, + + // Notebook cell + notebookCell: notApplicable, + "interior.cell": notApplicable, + + // Type alias "type.alias": notApplicable, - "type.argument.formal": notApplicable, - "type.argument.formal.constructor": notApplicable, - "type.argument.formal.constructor.iteration": notApplicable, - "type.argument.formal.iteration": notApplicable, - "type.argument.formal.method": notApplicable, - "type.argument.formal.method.iteration": notApplicable, + "value.typeAlias": notApplicable, + + // Collection item + "collectionItem.unenclosed": notApplicable, + "collectionItem.unenclosed.iteration": notApplicable, + + // Miscellaneous statements + "statement.break": notApplicable, + "statement.continue": notApplicable, + "statement.iteration.document": notApplicable, + "statement.iteration.block": notApplicable, + + // Miscellaneous + environment: notApplicable, + fieldAccess: notApplicable, + "name.iteration.block": notApplicable, + "name.iteration.document": notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, "type.cast": notApplicable, - "type.foreach": notApplicable, - "type.variable": notApplicable, - "type.return": notApplicable, - "type.resource": notApplicable, - "type.resource.iteration": notApplicable, "type.typeArgument": notApplicable, "type.typeArgument.iteration": notApplicable, "type.iteration.block": notApplicable, "type.iteration.document": notApplicable, - "value.argument.actual": notApplicable, - "value.argument.actual.iteration": notApplicable, - "value.argument.formal": notApplicable, - "value.argument.formal.constructor": notApplicable, - "value.argument.formal.constructor.iteration": notApplicable, - "value.argument.formal.iteration": notApplicable, - "value.argument.formal.method": notApplicable, - "value.argument.formal.method.iteration": notApplicable, - "value.assignment": notApplicable, - "value.attribute": notApplicable, - "value.foreach": notApplicable, - "value.mapPair": notApplicable, - "value.mapPair.iteration": notApplicable, - "value.resource": notApplicable, - "value.resource.iteration": notApplicable, - "value.return": notApplicable, - "value.return.lambda": notApplicable, - "value.typeAlias": notApplicable, - "value.variable": notApplicable, - "value.variable.pattern": notApplicable, - "value.yield": notApplicable, - "value.switch": notApplicable, "value.iteration.block": notApplicable, "value.iteration.document": notApplicable, selector: notApplicable, unit: notApplicable, + disqualifyDelimiter: notApplicable, }; From 435c19e33b4dbcc40653601f3048d39e24b79762 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 13:09:26 +0200 Subject: [PATCH 09/18] js --- .../javascript.core/name/name.foreach2.scope | 24 ++++++++++++ .../statement/statement.break.scope | 33 ++++++++++++++++ .../statement/statement.constructor.scope | 33 ++++++++++++++++ .../statement/statement.continue.scope | 33 ++++++++++++++++ .../statement/statement.doWhile.scope | 10 +++++ .../statement/statement.for.scope | 10 +++++ .../statement/statement.foreach.scope | 10 +++++ .../statement/statement.foreach2.scope | 10 +++++ .../statement/statement.function.scope | 10 +++++ .../statement/statement.function10.scope | 10 +++++ .../statement/statement.function11.scope | 10 +++++ .../statement/statement.function12.scope | 10 +++++ .../statement/statement.function13.scope | 10 +++++ .../statement/statement.function14.scope | 10 +++++ .../statement/statement.function15.scope | 10 +++++ .../statement/statement.function2.scope | 10 +++++ .../statement/statement.function3.scope | 10 +++++ .../statement/statement.function4.scope | 10 +++++ .../statement/statement.function5.scope | 10 +++++ .../statement/statement.function6.scope | 10 +++++ .../statement/statement.function7.scope | 10 +++++ .../statement/statement.function8.scope | 10 +++++ .../statement/statement.function9.scope | 10 +++++ .../statement/statement.if.scope | 15 ++++++++ .../statement/statement.method.scope | 33 ++++++++++++++++ .../statement/statement.method2.scope | 38 +++++++++++++++++++ .../statement/statement.method3.scope | 33 ++++++++++++++++ .../statement/statement.method4.scope | 38 +++++++++++++++++++ .../statement/statement.method5.scope | 33 ++++++++++++++++ .../statement/statement.method6.scope | 15 ++++++++ .../statement/statement.method7.scope | 15 ++++++++ .../statement/statement.method8.scope | 15 ++++++++ .../statement/statement.return.scope | 33 ++++++++++++++++ .../statement/statement.static.scope | 33 ++++++++++++++++ .../statement/statement.switch.scope | 10 +++++ .../statement/statement.try.scope | 15 ++++++++ .../statement/statement.while.scope | 10 +++++ .../statement/statement.yield.scope | 10 +++++ .../value/value.foreach2.scope | 20 ++++++++++ .../src/scopeSupportFacets/javascript.ts | 21 +++++++++- queries/javascript.core.scm | 14 ++++--- queries/javascript.function.scm | 4 +- 42 files changed, 710 insertions(+), 8 deletions(-) create mode 100644 data/fixtures/scopes/javascript.core/name/name.foreach2.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.break.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.constructor.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.continue.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.doWhile.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.for.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.foreach.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.foreach2.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function10.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function11.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function12.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function13.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function14.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function15.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function2.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function3.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function4.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function5.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function6.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function7.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function8.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.function9.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.if.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.method.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.method2.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.method3.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.method4.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.method5.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.method6.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.method7.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.method8.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.return.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.static.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.switch.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.try.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.while.scope create mode 100644 data/fixtures/scopes/javascript.core/statement/statement.yield.scope create mode 100644 data/fixtures/scopes/javascript.core/value/value.foreach2.scope diff --git a/data/fixtures/scopes/javascript.core/name/name.foreach2.scope b/data/fixtures/scopes/javascript.core/name/name.foreach2.scope new file mode 100644 index 0000000000..b104339f94 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/name/name.foreach2.scope @@ -0,0 +1,24 @@ +for (const k in values) {} +--- + +[Content] = 0:11-0:12 + >-< +0| for (const k in values) {} + +[Removal] = 0:11-0:13 + >--< +0| for (const k in values) {} + +[Leading delimiter] = 0:10-0:11 + >-< +0| for (const k in values) {} + +[Trailing delimiter] = 0:12-0:13 + >-< +0| for (const k in values) {} + +[Domain] = 0:0-0:26 + >--------------------------< +0| for (const k in values) {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/statement/statement.break.scope b/data/fixtures/scopes/javascript.core/statement/statement.break.scope new file mode 100644 index 0000000000..c81ea40ae7 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.break.scope @@ -0,0 +1,33 @@ +while (true) { + break; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >-------------- +0| while (true) { +1| break; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:10 + >------< +1| break; + +[#2 Removal] = 1:0-2:0 + >---------- +1| break; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| break; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.constructor.scope b/data/fixtures/scopes/javascript.core/statement/statement.constructor.scope new file mode 100644 index 0000000000..15212a3a3e --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.constructor.scope @@ -0,0 +1,33 @@ +class Foo { + constructor() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| class Foo { +1| constructor() {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:20 + >----------------< +1| constructor() {} + +[#2 Removal] = 1:0-2:0 + >-------------------- +1| constructor() {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| constructor() {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.continue.scope b/data/fixtures/scopes/javascript.core/statement/statement.continue.scope new file mode 100644 index 0000000000..8715a90063 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.continue.scope @@ -0,0 +1,33 @@ +while (true) { + continue; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >-------------- +0| while (true) { +1| continue; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:13 + >---------< +1| continue; + +[#2 Removal] = 1:0-2:0 + >------------- +1| continue; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| continue; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.doWhile.scope b/data/fixtures/scopes/javascript.core/statement/statement.doWhile.scope new file mode 100644 index 0000000000..e1e74c9153 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.doWhile.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/statement/statement.for.scope b/data/fixtures/scopes/javascript.core/statement/statement.for.scope new file mode 100644 index 0000000000..97ef289ef6 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.for.scope @@ -0,0 +1,10 @@ +for (let i = 0; i < size; i++) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:33 + >---------------------------------< +0| for (let i = 0; i < size; i++) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.foreach.scope b/data/fixtures/scopes/javascript.core/statement/statement.foreach.scope new file mode 100644 index 0000000000..e3cdec3288 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.foreach.scope @@ -0,0 +1,10 @@ +for (const v of values) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:26 + >--------------------------< +0| for (const v of values) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.foreach2.scope b/data/fixtures/scopes/javascript.core/statement/statement.foreach2.scope new file mode 100644 index 0000000000..13785aa1d6 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.foreach2.scope @@ -0,0 +1,10 @@ +for (const k in values) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:26 + >--------------------------< +0| for (const k in values) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function.scope b/data/fixtures/scopes/javascript.core/statement/statement.function.scope new file mode 100644 index 0000000000..5880898ab1 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function.scope @@ -0,0 +1,10 @@ +function foo() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:17 + >-----------------< +0| function foo() {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function10.scope b/data/fixtures/scopes/javascript.core/statement/statement.function10.scope new file mode 100644 index 0000000000..83f336b4ac --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function10.scope @@ -0,0 +1,10 @@ +export const foo = () => {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:28 + >----------------------------< +0| export const foo = () => {}; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function11.scope b/data/fixtures/scopes/javascript.core/statement/statement.function11.scope new file mode 100644 index 0000000000..d09d96e13d --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function11.scope @@ -0,0 +1,10 @@ +export default function() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:28 + >----------------------------< +0| export default function() {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function12.scope b/data/fixtures/scopes/javascript.core/statement/statement.function12.scope new file mode 100644 index 0000000000..6e69a967cd --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function12.scope @@ -0,0 +1,10 @@ +export default function *() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:30 + >------------------------------< +0| export default function *() {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function13.scope b/data/fixtures/scopes/javascript.core/statement/statement.function13.scope new file mode 100644 index 0000000000..467a933307 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function13.scope @@ -0,0 +1,10 @@ +export default () => {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:24 + >------------------------< +0| export default () => {}; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function14.scope b/data/fixtures/scopes/javascript.core/statement/statement.function14.scope new file mode 100644 index 0000000000..2117761e48 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function14.scope @@ -0,0 +1,10 @@ +const foo = function bar() {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:30 + >------------------------------< +0| const foo = function bar() {}; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function15.scope b/data/fixtures/scopes/javascript.core/statement/statement.function15.scope new file mode 100644 index 0000000000..49c3fd37a7 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function15.scope @@ -0,0 +1,10 @@ +const foo = function *bar() {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:31 + >-------------------------------< +0| const foo = function *bar() {}; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function2.scope b/data/fixtures/scopes/javascript.core/statement/statement.function2.scope new file mode 100644 index 0000000000..036915f420 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function2.scope @@ -0,0 +1,10 @@ +function *foo() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:18 + >------------------< +0| function *foo() {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function3.scope b/data/fixtures/scopes/javascript.core/statement/statement.function3.scope new file mode 100644 index 0000000000..c1842d24b0 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function3.scope @@ -0,0 +1,10 @@ +const foo = function() {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:26 + >--------------------------< +0| const foo = function() {}; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function4.scope b/data/fixtures/scopes/javascript.core/statement/statement.function4.scope new file mode 100644 index 0000000000..b1f249a191 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function4.scope @@ -0,0 +1,10 @@ +const foo = function *() {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:28 + >----------------------------< +0| const foo = function *() {}; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function5.scope b/data/fixtures/scopes/javascript.core/statement/statement.function5.scope new file mode 100644 index 0000000000..1a787531b3 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function5.scope @@ -0,0 +1,10 @@ +const foo = () => {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:21 + >---------------------< +0| const foo = () => {}; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function6.scope b/data/fixtures/scopes/javascript.core/statement/statement.function6.scope new file mode 100644 index 0000000000..0632e42679 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function6.scope @@ -0,0 +1,10 @@ +export function foo() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:24 + >------------------------< +0| export function foo() {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function7.scope b/data/fixtures/scopes/javascript.core/statement/statement.function7.scope new file mode 100644 index 0000000000..82a5b290f1 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function7.scope @@ -0,0 +1,10 @@ +export function *foo() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:25 + >-------------------------< +0| export function *foo() {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function8.scope b/data/fixtures/scopes/javascript.core/statement/statement.function8.scope new file mode 100644 index 0000000000..5614243b31 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function8.scope @@ -0,0 +1,10 @@ +export const foo = function() {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:33 + >---------------------------------< +0| export const foo = function() {}; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.function9.scope b/data/fixtures/scopes/javascript.core/statement/statement.function9.scope new file mode 100644 index 0000000000..f46b9cc307 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.function9.scope @@ -0,0 +1,10 @@ +export const foo = function *() {}; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:35 + >-----------------------------------< +0| export const foo = function *() {}; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.if.scope b/data/fixtures/scopes/javascript.core/statement/statement.if.scope new file mode 100644 index 0000000000..14f2507621 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.if.scope @@ -0,0 +1,15 @@ +if (true) {} +else if (false) {} +else {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:7 + >------------ +0| if (true) {} +1| else if (false) {} +2| else {} + -------< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.method.scope b/data/fixtures/scopes/javascript.core/statement/statement.method.scope new file mode 100644 index 0000000000..fd50592e3e --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.method.scope @@ -0,0 +1,33 @@ +class Foo { + bar() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| class Foo { +1| bar() {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:12 + >--------< +1| bar() {} + +[#2 Removal] = 1:0-2:0 + >------------ +1| bar() {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| bar() {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.method2.scope b/data/fixtures/scopes/javascript.core/statement/statement.method2.scope new file mode 100644 index 0000000000..e707554b60 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.method2.scope @@ -0,0 +1,38 @@ +class Foo { + @baz + bar() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-3:1 + >----------- +0| class Foo { +1| @baz +2| bar() {} +3| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-2:12 + >---- +1| @baz +2| bar() {} + ------------< + +[#2 Removal] = 1:0-3:0 + >-------- +1| @baz +2| bar() {} +3| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| @baz + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.method3.scope b/data/fixtures/scopes/javascript.core/statement/statement.method3.scope new file mode 100644 index 0000000000..b09ef41a5d --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.method3.scope @@ -0,0 +1,33 @@ +class Foo { + bar = () => {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| class Foo { +1| bar = () => {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:18 + >--------------< +1| bar = () => {} + +[#2 Removal] = 1:0-2:0 + >------------------ +1| bar = () => {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| bar = () => {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.method4.scope b/data/fixtures/scopes/javascript.core/statement/statement.method4.scope new file mode 100644 index 0000000000..d370211186 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.method4.scope @@ -0,0 +1,38 @@ +class Foo { + @baz + bar = () => {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-3:1 + >----------- +0| class Foo { +1| @baz +2| bar = () => {} +3| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-2:18 + >---- +1| @baz +2| bar = () => {} + ------------------< + +[#2 Removal] = 1:0-3:0 + >-------- +1| @baz +2| bar = () => {} +3| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| @baz + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.method5.scope b/data/fixtures/scopes/javascript.core/statement/statement.method5.scope new file mode 100644 index 0000000000..81fc1c5db3 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.method5.scope @@ -0,0 +1,33 @@ +const foo = { + bar() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >------------- +0| const foo = { +1| bar() {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:12 + >--------< +1| bar() {} + +[#2 Removal] = 1:0-2:0 + >------------ +1| bar() {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| bar() {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.method6.scope b/data/fixtures/scopes/javascript.core/statement/statement.method6.scope new file mode 100644 index 0000000000..29d61c5df2 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.method6.scope @@ -0,0 +1,15 @@ +const foo = { + bar: function() {} +} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:1 + >------------- +0| const foo = { +1| bar: function() {} +2| } + -< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.method7.scope b/data/fixtures/scopes/javascript.core/statement/statement.method7.scope new file mode 100644 index 0000000000..8a826d6de6 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.method7.scope @@ -0,0 +1,15 @@ +const foo = { + bar: function *() {} +} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:1 + >------------- +0| const foo = { +1| bar: function *() {} +2| } + -< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.method8.scope b/data/fixtures/scopes/javascript.core/statement/statement.method8.scope new file mode 100644 index 0000000000..e09923487f --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.method8.scope @@ -0,0 +1,15 @@ +const foo = { + bar: () => {} +} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:1 + >------------- +0| const foo = { +1| bar: () => {} +2| } + -< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.return.scope b/data/fixtures/scopes/javascript.core/statement/statement.return.scope new file mode 100644 index 0000000000..732ae5470f --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.return.scope @@ -0,0 +1,33 @@ +function foo() { + return 0; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >---------------- +0| function foo() { +1| return 0; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:13 + >---------< +1| return 0; + +[#2 Removal] = 1:0-2:0 + >------------- +1| return 0; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| return 0; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.static.scope b/data/fixtures/scopes/javascript.core/statement/statement.static.scope new file mode 100644 index 0000000000..65303d72cb --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.static.scope @@ -0,0 +1,33 @@ +class Foo { + static {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| class Foo { +1| static {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:13 + >---------< +1| static {} + +[#2 Removal] = 1:0-2:0 + >------------- +1| static {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| static {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.switch.scope b/data/fixtures/scopes/javascript.core/statement/statement.switch.scope new file mode 100644 index 0000000000..bcd2bb4acb --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.switch.scope @@ -0,0 +1,10 @@ +switch (foo) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:15 + >---------------< +0| switch (foo) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.try.scope b/data/fixtures/scopes/javascript.core/statement/statement.try.scope new file mode 100644 index 0000000000..8226fcbede --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.try.scope @@ -0,0 +1,15 @@ +try {} +catch(e) {} +finally {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:10 + >------ +0| try {} +1| catch(e) {} +2| finally {} + ----------< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/statement/statement.while.scope b/data/fixtures/scopes/javascript.core/statement/statement.while.scope new file mode 100644 index 0000000000..5aaf57be8f --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.while.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/statement/statement.yield.scope b/data/fixtures/scopes/javascript.core/statement/statement.yield.scope new file mode 100644 index 0000000000..d90a74d3bf --- /dev/null +++ b/data/fixtures/scopes/javascript.core/statement/statement.yield.scope @@ -0,0 +1,10 @@ +yield 0; +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:8 + >--------< +0| yield 0; + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/value/value.foreach2.scope b/data/fixtures/scopes/javascript.core/value/value.foreach2.scope new file mode 100644 index 0000000000..15d3df9cef --- /dev/null +++ b/data/fixtures/scopes/javascript.core/value/value.foreach2.scope @@ -0,0 +1,20 @@ +for (const k in values) {} +--- + +[Content] = 0:16-0:22 + >------< +0| for (const k in values) {} + +[Removal] = 0:15-0:22 + >-------< +0| for (const k in values) {} + +[Leading delimiter] = 0:15-0:16 + >-< +0| for (const k in values) {} + +[Domain] = 0:0-0:26 + >--------------------------< +0| for (const k in values) {} + +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index f9f44d097d..b24b6eb73b 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -22,9 +22,24 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, "statement.class": supported, + "statement.field.class": supported, + "statement.function": supported, + "statement.constructor": supported, + "statement.method": supported, + "statement.if": supported, + "statement.try": supported, + "statement.switch": supported, + "statement.for": supported, + "statement.foreach": supported, + "statement.while": supported, + "statement.doWhile": supported, "statement.variable": supported, "statement.assignment": supported, - "statement.field.class": supported, + "statement.return": supported, + "statement.yield": supported, + "statement.break": supported, + "statement.continue": supported, + "statement.static": supported, "statement.iteration.document": supported, "statement.iteration.class": supported, "statement.iteration.block": supported, @@ -188,6 +203,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, @@ -197,6 +213,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "interior.cell": notApplicable, // Resource + "statement.resource": notApplicable, "interior.resource": notApplicable, "name.resource.iteration": notApplicable, "name.resource": notApplicable, @@ -212,6 +229,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "value.argument.actual": notApplicable, // Namespace + "statement.namespace": notApplicable, "name.namespace": notApplicable, "interior.namespace": notApplicable, @@ -220,6 +238,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "branch.loop.iteration": notApplicable, // Miscellaneous + "statement.misc": notApplicable, environment: notApplicable, selector: notApplicable, unit: notApplicable, diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index b2d267a913..77dfd7bdf7 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -17,13 +17,11 @@ (do_statement) (empty_statement) (export_statement) - (expression_statement) (for_in_statement) (for_statement) (generator_function_declaration) (import_statement) (labeled_statement) - (lexical_declaration) (return_statement) (switch_statement) (throw_statement) @@ -31,18 +29,24 @@ (variable_declaration) (while_statement) (with_statement) + (class_static_block) ;; Disabled on purpose. We have a better definition of this below. ;; (if_statement) ;; This is disabled since we want the whole statement and not just the block ;; (statement_block) - - ;; Manually added - (method_definition) ] @statement (#not-parent-type? @statement export_statement) ) +( + [ + (expression_statement) + (lexical_declaration) + ] @statement + (#not-parent-type? @statement export_statement for_statement) +) + ( (program) @statement.iteration @class.iteration (#document-range! @statement.iteration @class.iteration) diff --git a/queries/javascript.function.scm b/queries/javascript.function.scm index 617f8c1ffd..c65a56475f 100644 --- a/queries/javascript.function.scm +++ b/queries/javascript.function.scm @@ -159,11 +159,11 @@ ;;!! class Foo { @bar foo() {} } ;;! ^^^^^^^^^^^^^ ( - (decorator)? @namedFunction.start @name.domain.start + (decorator)? @namedFunction.start @statement.start @name.domain.start . (method_definition name: (_) @name - ) @namedFunction.end @name.domain.end + ) @namedFunction.end @statement.end @name.domain.end ) ( From 3c8edf4e599d4b2771ab49b68e5168b7de8932fa Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 13:28:30 +0200 Subject: [PATCH 10/18] csharp --- .../csharp/statement/statement.break.scope | 33 +++++++++++++++++++ .../statement/statement.constructor.scope | 33 +++++++++++++++++++ .../csharp/statement/statement.continue.scope | 33 +++++++++++++++++++ .../csharp/statement/statement.doWhile.scope | 10 ++++++ .../csharp/statement/statement.for.scope | 10 ++++++ .../csharp/statement/statement.foreach.scope | 10 ++++++ .../csharp/statement/statement.function.scope | 10 ++++++ .../csharp/statement/statement.if.scope | 15 +++++++++ .../csharp/statement/statement.method.scope | 33 +++++++++++++++++++ .../csharp/statement/statement.return.scope | 33 +++++++++++++++++++ .../csharp/statement/statement.switch.scope | 10 ++++++ .../csharp/statement/statement.try.scope | 15 +++++++++ .../csharp/statement/statement.while.scope | 10 ++++++ .../csharp/statement/statement.yield.scope | 33 +++++++++++++++++++ .../common/src/scopeSupportFacets/csharp.ts | 31 ++++++++++++++--- queries/csharp.scm | 3 +- 16 files changed, 316 insertions(+), 6 deletions(-) create mode 100644 data/fixtures/scopes/csharp/statement/statement.break.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.constructor.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.continue.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.doWhile.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.for.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.foreach.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.function.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.if.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.method.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.return.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.switch.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.try.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.while.scope create mode 100644 data/fixtures/scopes/csharp/statement/statement.yield.scope diff --git a/data/fixtures/scopes/csharp/statement/statement.break.scope b/data/fixtures/scopes/csharp/statement/statement.break.scope new file mode 100644 index 0000000000..c81ea40ae7 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.break.scope @@ -0,0 +1,33 @@ +while (true) { + break; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >-------------- +0| while (true) { +1| break; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:10 + >------< +1| break; + +[#2 Removal] = 1:0-2:0 + >---------- +1| break; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| break; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.constructor.scope b/data/fixtures/scopes/csharp/statement/statement.constructor.scope new file mode 100644 index 0000000000..6043e9b751 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.constructor.scope @@ -0,0 +1,33 @@ +class Foo { + public Foo() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| class Foo { +1| public Foo() {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:19 + >---------------< +1| public Foo() {} + +[#2 Removal] = 1:0-2:0 + >------------------- +1| public Foo() {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| public Foo() {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.continue.scope b/data/fixtures/scopes/csharp/statement/statement.continue.scope new file mode 100644 index 0000000000..8715a90063 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.continue.scope @@ -0,0 +1,33 @@ +while (true) { + continue; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >-------------- +0| while (true) { +1| continue; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:13 + >---------< +1| continue; + +[#2 Removal] = 1:0-2:0 + >------------- +1| continue; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| continue; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.doWhile.scope b/data/fixtures/scopes/csharp/statement/statement.doWhile.scope new file mode 100644 index 0000000000..e1e74c9153 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.doWhile.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/csharp/statement/statement.for.scope b/data/fixtures/scopes/csharp/statement/statement.for.scope new file mode 100644 index 0000000000..b17e514454 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.for.scope @@ -0,0 +1,10 @@ +for (int i = 0; i < size; ++i) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:33 + >---------------------------------< +0| for (int i = 0; i < size; ++i) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.foreach.scope b/data/fixtures/scopes/csharp/statement/statement.foreach.scope new file mode 100644 index 0000000000..feb1c6ffaf --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.foreach.scope @@ -0,0 +1,10 @@ +foreach (int v in values) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:28 + >----------------------------< +0| foreach (int v in values) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.function.scope b/data/fixtures/scopes/csharp/statement/statement.function.scope new file mode 100644 index 0000000000..928f8f0bf7 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.function.scope @@ -0,0 +1,10 @@ +void Foo() {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:13 + >-------------< +0| void Foo() {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.if.scope b/data/fixtures/scopes/csharp/statement/statement.if.scope new file mode 100644 index 0000000000..14f2507621 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.if.scope @@ -0,0 +1,15 @@ +if (true) {} +else if (false) {} +else {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:7 + >------------ +0| if (true) {} +1| else if (false) {} +2| else {} + -------< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.method.scope b/data/fixtures/scopes/csharp/statement/statement.method.scope new file mode 100644 index 0000000000..07ad8ab5d1 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.method.scope @@ -0,0 +1,33 @@ +class Foo { + public void Bar() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| class Foo { +1| public void Bar() {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:24 + >--------------------< +1| public void Bar() {} + +[#2 Removal] = 1:0-2:0 + >------------------------ +1| public void Bar() {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| public void Bar() {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.return.scope b/data/fixtures/scopes/csharp/statement/statement.return.scope new file mode 100644 index 0000000000..b3d474e489 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.return.scope @@ -0,0 +1,33 @@ +int Foo() { + return 0; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| int Foo() { +1| return 0; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:13 + >---------< +1| return 0; + +[#2 Removal] = 1:0-2:0 + >------------- +1| return 0; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| return 0; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.switch.scope b/data/fixtures/scopes/csharp/statement/statement.switch.scope new file mode 100644 index 0000000000..bcd2bb4acb --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.switch.scope @@ -0,0 +1,10 @@ +switch (foo) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:15 + >---------------< +0| switch (foo) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.try.scope b/data/fixtures/scopes/csharp/statement/statement.try.scope new file mode 100644 index 0000000000..84dd0fc716 --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.try.scope @@ -0,0 +1,15 @@ +try {} +catch(Exception e) {} +finally {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:10 + >------ +0| try {} +1| catch(Exception e) {} +2| finally {} + ----------< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/statement/statement.while.scope b/data/fixtures/scopes/csharp/statement/statement.while.scope new file mode 100644 index 0000000000..5aaf57be8f --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.while.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/csharp/statement/statement.yield.scope b/data/fixtures/scopes/csharp/statement/statement.yield.scope new file mode 100644 index 0000000000..c1f249a73a --- /dev/null +++ b/data/fixtures/scopes/csharp/statement/statement.yield.scope @@ -0,0 +1,33 @@ +IEnumerable foo() { + yield return 0; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >------------------------ +0| IEnumerable foo() { +1| yield return 0; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:19 + >---------------< +1| yield return 0; + +[#2 Removal] = 1:0-2:0 + >------------------- +1| yield return 0; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| yield return 0; + +[#2 Insertion delimiter] = "\n" diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index 573af3124e..b29a4bf708 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -171,14 +171,28 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "statement.class": supported, "statement.interface": supported, "statement.enum": supported, - "statement.assignment": supported, - "statement.variable": supported, "statement.field.class": supported, "statement.field.interface": supported, - "statement.iteration.block": supported, + "statement.function": supported, + "statement.constructor": supported, + "statement.method": supported, + "statement.if": supported, + "statement.try": supported, + "statement.switch": supported, + "statement.for": supported, + "statement.foreach": supported, + "statement.while": supported, + "statement.doWhile": supported, + "statement.variable": supported, + "statement.assignment": supported, + "statement.return": supported, + "statement.yield": supported, + "statement.break": supported, + "statement.continue": supported, + "statement.iteration.document": supported, "statement.iteration.class": supported, "statement.iteration.interface": supported, - "statement.iteration.document": supported, + "statement.iteration.block": supported, "string.singleLine": supported, "string.multiLine": supported, @@ -228,6 +242,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "value.argument.actual.iteration": notApplicable, // Resource syntax + "statement.resource": notApplicable, "interior.resource": notApplicable, "type.resource": notApplicable, "type.resource.iteration": notApplicable, @@ -252,6 +267,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, @@ -265,6 +281,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "collectionItem.unenclosed": notApplicable, // Namespace + "statement.namespace": notApplicable, "name.namespace": notApplicable, "interior.namespace": notApplicable, @@ -272,11 +289,15 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "branch.loop": notApplicable, "branch.loop.iteration": notApplicable, + // Static + "statement.static": notApplicable, + "interior.static": notApplicable, + // Miscellaneous + "statement.misc": notApplicable, environment: notApplicable, pairDelimiter: notApplicable, regularExpression: notApplicable, selector: notApplicable, unit: notApplicable, - "interior.static": notApplicable, }; diff --git a/queries/csharp.scm b/queries/csharp.scm index 9a8b983a3c..340f6a84d3 100644 --- a/queries/csharp.scm +++ b/queries/csharp.scm @@ -22,7 +22,6 @@ (record_declaration) (struct_declaration) (using_directive) - (block) (break_statement) (checked_statement) (continue_statement) @@ -45,6 +44,8 @@ (using_statement) (while_statement) (yield_statement) + ;; Disabled on purpose. This is the entire body of statements. + ;; (block) ;; Disabled on purpose. We have a better definition of this below. ;; (if_statement) ] @statement From 2997c4110b111865ef6c5cc8aa2e7e334dd4d188 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 13:43:25 +0200 Subject: [PATCH 11/18] java --- .../java/statement/statement.break.scope | 33 ++++++++++ .../statement/statement.constructor.scope | 33 ++++++++++ .../statement/statement.constructor2.scope | 38 ++++++++++++ .../java/statement/statement.continue.scope | 33 ++++++++++ .../java/statement/statement.doWhile.scope | 10 ++++ .../scopes/java/statement/statement.for.scope | 10 ++++ .../java/statement/statement.foreach.scope | 10 ++++ .../scopes/java/statement/statement.if.scope | 15 +++++ .../java/statement/statement.method.scope | 33 ++++++++++ .../java/statement/statement.method2.scope | 38 ++++++++++++ .../java/statement/statement.resource.scope | 10 ++++ .../java/statement/statement.return.scope | 60 +++++++++++++++++++ .../java/statement/statement.static.scope | 33 ++++++++++ .../java/statement/statement.switch.scope | 10 ++++ .../scopes/java/statement/statement.try.scope | 15 +++++ .../java/statement/statement.while.scope | 10 ++++ .../java/statement/statement.yield.scope | 35 +++++++++++ .../common/src/scopeSupportFacets/java.ts | 27 +++++++-- queries/java.scm | 8 ++- 19 files changed, 456 insertions(+), 5 deletions(-) create mode 100644 data/fixtures/scopes/java/statement/statement.break.scope create mode 100644 data/fixtures/scopes/java/statement/statement.constructor.scope create mode 100644 data/fixtures/scopes/java/statement/statement.constructor2.scope create mode 100644 data/fixtures/scopes/java/statement/statement.continue.scope create mode 100644 data/fixtures/scopes/java/statement/statement.doWhile.scope create mode 100644 data/fixtures/scopes/java/statement/statement.for.scope create mode 100644 data/fixtures/scopes/java/statement/statement.foreach.scope create mode 100644 data/fixtures/scopes/java/statement/statement.if.scope create mode 100644 data/fixtures/scopes/java/statement/statement.method.scope create mode 100644 data/fixtures/scopes/java/statement/statement.method2.scope create mode 100644 data/fixtures/scopes/java/statement/statement.resource.scope create mode 100644 data/fixtures/scopes/java/statement/statement.return.scope create mode 100644 data/fixtures/scopes/java/statement/statement.static.scope create mode 100644 data/fixtures/scopes/java/statement/statement.switch.scope create mode 100644 data/fixtures/scopes/java/statement/statement.try.scope create mode 100644 data/fixtures/scopes/java/statement/statement.while.scope create mode 100644 data/fixtures/scopes/java/statement/statement.yield.scope diff --git a/data/fixtures/scopes/java/statement/statement.break.scope b/data/fixtures/scopes/java/statement/statement.break.scope new file mode 100644 index 0000000000..c81ea40ae7 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.break.scope @@ -0,0 +1,33 @@ +while (true) { + break; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >-------------- +0| while (true) { +1| break; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:10 + >------< +1| break; + +[#2 Removal] = 1:0-2:0 + >---------- +1| break; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| break; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.constructor.scope b/data/fixtures/scopes/java/statement/statement.constructor.scope new file mode 100644 index 0000000000..3a473b0ece --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.constructor.scope @@ -0,0 +1,33 @@ +public class Foo { + public Foo() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >------------------ +0| public class Foo { +1| public Foo() {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:19 + >---------------< +1| public Foo() {} + +[#2 Removal] = 1:0-2:0 + >------------------- +1| public Foo() {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| public Foo() {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.constructor2.scope b/data/fixtures/scopes/java/statement/statement.constructor2.scope new file mode 100644 index 0000000000..5b808cb0d0 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.constructor2.scope @@ -0,0 +1,38 @@ +public class Foo { + @bar + public Foo() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-3:1 + >------------------ +0| public class Foo { +1| @bar +2| public Foo() {} +3| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-2:19 + >---- +1| @bar +2| public Foo() {} + -------------------< + +[#2 Removal] = 1:0-3:0 + >-------- +1| @bar +2| public Foo() {} +3| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| @bar + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.continue.scope b/data/fixtures/scopes/java/statement/statement.continue.scope new file mode 100644 index 0000000000..8715a90063 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.continue.scope @@ -0,0 +1,33 @@ +while (true) { + continue; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >-------------- +0| while (true) { +1| continue; +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:13 + >---------< +1| continue; + +[#2 Removal] = 1:0-2:0 + >------------- +1| continue; +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| continue; + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.doWhile.scope b/data/fixtures/scopes/java/statement/statement.doWhile.scope new file mode 100644 index 0000000000..e1e74c9153 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.doWhile.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/java/statement/statement.for.scope b/data/fixtures/scopes/java/statement/statement.for.scope new file mode 100644 index 0000000000..0094536004 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.for.scope @@ -0,0 +1,10 @@ +for (int i = 0; i < size; i++) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:33 + >---------------------------------< +0| for (int i = 0; i < size; i++) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.foreach.scope b/data/fixtures/scopes/java/statement/statement.foreach.scope new file mode 100644 index 0000000000..c699dc20f9 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.foreach.scope @@ -0,0 +1,10 @@ +for (final int v : values) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:29 + >-----------------------------< +0| for (final int v : values) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.if.scope b/data/fixtures/scopes/java/statement/statement.if.scope new file mode 100644 index 0000000000..14f2507621 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.if.scope @@ -0,0 +1,15 @@ +if (true) {} +else if (false) {} +else {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:7 + >------------ +0| if (true) {} +1| else if (false) {} +2| else {} + -------< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.method.scope b/data/fixtures/scopes/java/statement/statement.method.scope new file mode 100644 index 0000000000..d709a30085 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.method.scope @@ -0,0 +1,33 @@ +public class Foo { + public void bar() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >------------------ +0| public class Foo { +1| public void bar() {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:24 + >--------------------< +1| public void bar() {} + +[#2 Removal] = 1:0-2:0 + >------------------------ +1| public void bar() {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| public void bar() {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.method2.scope b/data/fixtures/scopes/java/statement/statement.method2.scope new file mode 100644 index 0000000000..25b3db5e69 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.method2.scope @@ -0,0 +1,38 @@ +public class Foo { + @baz + public void bar() {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-3:1 + >------------------ +0| public class Foo { +1| @baz +2| public void bar() {} +3| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-2:24 + >---- +1| @baz +2| public void bar() {} + ------------------------< + +[#2 Removal] = 1:0-3:0 + >-------- +1| @baz +2| public void bar() {} +3| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| @baz + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.resource.scope b/data/fixtures/scopes/java/statement/statement.resource.scope new file mode 100644 index 0000000000..95d2d5bf5a --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.resource.scope @@ -0,0 +1,10 @@ +try (Foo foo = create()) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:27 + >---------------------------< +0| try (Foo foo = create()) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.return.scope b/data/fixtures/scopes/java/statement/statement.return.scope new file mode 100644 index 0000000000..97e0e310e8 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.return.scope @@ -0,0 +1,60 @@ +public class Foo { + public int bar() { + return 0; + } +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-4:1 + >------------------ +0| public class Foo { +1| public int bar() { +2| return 0; +3| } +4| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-3:5 + >------------------ +1| public int bar() { +2| return 0; +3| } + -----< + +[#2 Removal] = 1:0-4:0 + >---------------------- +1| public int bar() { +2| return 0; +3| } +4| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| public int bar() { + +[#2 Insertion delimiter] = "\n" + + +[#3 Content] = +[#3 Domain] = 2:8-2:17 + >---------< +2| return 0; + +[#3 Removal] = 2:0-3:0 + >----------------- +2| return 0; +3| } + < + +[#3 Leading delimiter] = 2:0-2:8 + >--------< +2| return 0; + +[#3 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.static.scope b/data/fixtures/scopes/java/statement/statement.static.scope new file mode 100644 index 0000000000..65303d72cb --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.static.scope @@ -0,0 +1,33 @@ +class Foo { + static {} +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >----------- +0| class Foo { +1| static {} +2| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:13 + >---------< +1| static {} + +[#2 Removal] = 1:0-2:0 + >------------- +1| static {} +2| } + < + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| static {} + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.switch.scope b/data/fixtures/scopes/java/statement/statement.switch.scope new file mode 100644 index 0000000000..bcd2bb4acb --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.switch.scope @@ -0,0 +1,10 @@ +switch (foo) {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:15 + >---------------< +0| switch (foo) {} + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.try.scope b/data/fixtures/scopes/java/statement/statement.try.scope new file mode 100644 index 0000000000..1d036cd471 --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.try.scope @@ -0,0 +1,15 @@ +try {} +catch(Exception ex) {} +finally {} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:10 + >------ +0| try {} +1| catch(Exception ex) {} +2| finally {} + ----------< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/statement/statement.while.scope b/data/fixtures/scopes/java/statement/statement.while.scope new file mode 100644 index 0000000000..5aaf57be8f --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.while.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/java/statement/statement.yield.scope b/data/fixtures/scopes/java/statement/statement.yield.scope new file mode 100644 index 0000000000..595607012d --- /dev/null +++ b/data/fixtures/scopes/java/statement/statement.yield.scope @@ -0,0 +1,35 @@ +switch (foo) { + case 0: + yield 0; +} +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-3:1 + >-------------- +0| switch (foo) { +1| case 0: +2| yield 0; +3| } + -< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 2:8-2:16 + >--------< +2| yield 0; + +[#2 Removal] = 2:0-3:0 + >---------------- +2| yield 0; +3| } + < + +[#2 Leading delimiter] = 2:0-2:8 + >--------< +2| yield 0; + +[#2 Insertion delimiter] = "\n" diff --git a/packages/common/src/scopeSupportFacets/java.ts b/packages/common/src/scopeSupportFacets/java.ts index b656358111..52cc667fb1 100644 --- a/packages/common/src/scopeSupportFacets/java.ts +++ b/packages/common/src/scopeSupportFacets/java.ts @@ -90,14 +90,29 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "statement.class": supported, "statement.interface": supported, "statement.enum": supported, - "statement.variable": supported, - "statement.assignment": supported, "statement.field.class": supported, "statement.field.interface": supported, - "statement.iteration.block": supported, + "statement.constructor": supported, + "statement.method": supported, + "statement.if": supported, + "statement.try": supported, + "statement.switch": supported, + "statement.for": supported, + "statement.foreach": supported, + "statement.while": supported, + "statement.doWhile": supported, + "statement.variable": supported, + "statement.assignment": supported, + "statement.return": supported, + "statement.yield": supported, + "statement.break": supported, + "statement.continue": supported, + "statement.resource": supported, + "statement.static": supported, + "statement.iteration.document": supported, "statement.iteration.class": supported, "statement.iteration.interface": supported, - "statement.iteration.document": supported, + "statement.iteration.block": supported, "string.singleLine": supported, "string.multiLine": supported, @@ -192,6 +207,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { // Functions (not methods) namedFunction: notApplicable, "namedFunction.iteration.document": notApplicable, + "statement.function": notApplicable, "argument.formal.singleLine": notApplicable, "argument.formal.multiLine": notApplicable, "argument.formal.iteration": notApplicable, @@ -253,6 +269,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, @@ -267,6 +284,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "name.resource.iteration": notApplicable, // Namespace + "statement.namespace": notApplicable, "name.namespace": notApplicable, "interior.namespace": notApplicable, @@ -279,6 +297,7 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "value.iteration.enum": notApplicable, // Miscellaneous + "statement.misc": notApplicable, pairDelimiter: notApplicable, regularExpression: notApplicable, environment: notApplicable, diff --git a/queries/java.scm b/queries/java.scm index 440591269d..09a72a2a4a 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -19,7 +19,6 @@ (expression_statement) (for_statement) (labeled_statement) - (local_variable_declaration) (return_statement) (switch_expression) (synchronized_statement) @@ -32,7 +31,9 @@ (constructor_declaration) (field_declaration) (constant_declaration) + (static_initializer) + ;; Disabled on purpose. We don't consider these to be statements. ;; exceptions ;; ";", ;; "block", @@ -41,6 +42,11 @@ ;; (if_statement) ] @statement +( + (local_variable_declaration) @statement + (#not-parent-type? @statement for_statement) +) + ;;!! enum Foo {} ;;! ^^^^^^^^^^^ ;;! ^^^ From 4745b35b8c59f9465448491ee9642b1c02ec43cb Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 14:18:57 +0200 Subject: [PATCH 12/18] python --- .../python/branch/branch.try.iteration.scope | 24 +++---- .../scopes/python/branch/branch.try.scope | 68 ++++++++----------- .../scopes/python/branch/branch.try2.scope | 68 ++++++++----------- data/fixtures/scopes/python/class.scope | 11 ++- data/fixtures/scopes/python/class2.scope | 10 ++- .../python/condition/condition.while.scope | 17 ++--- .../namedFunction.constructor.scope | 16 ++--- .../namedFunction.iteration.class.scope | 17 ++--- .../python/namedFunction/namedFunction2.scope | 8 +-- .../python/statement/statement.break.scope | 31 +++++++++ .../python/statement/statement.class2.scope | 29 ++++++++ .../statement/statement.constructor.scope | 47 +++++++++++++ .../python/statement/statement.continue.scope | 31 +++++++++ .../python/statement/statement.foreach.scope | 26 +++++++ .../python/statement/statement.function.scope | 26 +++++++ .../statement/statement.function2.scope | 29 ++++++++ .../python/statement/statement.if.scope | 63 +++++++++++++++++ .../python/statement/statement.method.scope | 47 +++++++++++++ .../python/statement/statement.misc.scope | 10 +++ .../python/statement/statement.resource.scope | 26 +++++++ .../python/statement/statement.return.scope | 31 +++++++++ .../python/statement/statement.switch.scope | 13 ++++ .../python/statement/statement.try.scope | 63 +++++++++++++++++ .../python/statement/statement.while.scope | 26 +++++++ .../python/statement/statement.yield.scope | 31 +++++++++ .../common/src/scopeSupportFacets/python.ts | 34 ++++++++-- queries/python.scm | 34 ++++++---- 27 files changed, 676 insertions(+), 160 deletions(-) create mode 100644 data/fixtures/scopes/python/statement/statement.break.scope create mode 100644 data/fixtures/scopes/python/statement/statement.class2.scope create mode 100644 data/fixtures/scopes/python/statement/statement.constructor.scope create mode 100644 data/fixtures/scopes/python/statement/statement.continue.scope create mode 100644 data/fixtures/scopes/python/statement/statement.foreach.scope create mode 100644 data/fixtures/scopes/python/statement/statement.function.scope create mode 100644 data/fixtures/scopes/python/statement/statement.function2.scope create mode 100644 data/fixtures/scopes/python/statement/statement.if.scope create mode 100644 data/fixtures/scopes/python/statement/statement.method.scope create mode 100644 data/fixtures/scopes/python/statement/statement.misc.scope create mode 100644 data/fixtures/scopes/python/statement/statement.resource.scope create mode 100644 data/fixtures/scopes/python/statement/statement.return.scope create mode 100644 data/fixtures/scopes/python/statement/statement.switch.scope create mode 100644 data/fixtures/scopes/python/statement/statement.try.scope create mode 100644 data/fixtures/scopes/python/statement/statement.while.scope create mode 100644 data/fixtures/scopes/python/statement/statement.yield.scope diff --git a/data/fixtures/scopes/python/branch/branch.try.iteration.scope b/data/fixtures/scopes/python/branch/branch.try.iteration.scope index 9a0ca11b98..4ba294aac3 100644 --- a/data/fixtures/scopes/python/branch/branch.try.iteration.scope +++ b/data/fixtures/scopes/python/branch/branch.try.iteration.scope @@ -1,18 +1,12 @@ -try: - pass -except: - pass -finally: - pass +try: pass +except: pass +finally: pass --- [Content] = -[Domain] = 0:0-5:8 - >---- -0| try: -1| pass -2| except: -3| pass -4| finally: -5| pass - --------< +[Domain] = 0:0-2:13 + >--------- +0| try: pass +1| except: pass +2| finally: pass + -------------< diff --git a/data/fixtures/scopes/python/branch/branch.try.scope b/data/fixtures/scopes/python/branch/branch.try.scope index a17648dcf7..931f93f2b0 100644 --- a/data/fixtures/scopes/python/branch/branch.try.scope +++ b/data/fixtures/scopes/python/branch/branch.try.scope @@ -1,57 +1,45 @@ -try: - pass -except: - pass -finally: - pass +try: pass +except: pass +finally: pass --- [#1 Content] = -[#1 Domain] = 0:0-1:8 - >---- -0| try: -1| pass - --------< - -[#1 Removal] = 0:0-2:0 - >---- -0| try: -1| pass -2| except: +[#1 Domain] = 0:0-0:9 + >---------< +0| try: pass + +[#1 Removal] = 0:0-1:0 + >--------- +0| try: pass +1| except: pass < [#1 Insertion delimiter] = "\n" [#2 Content] = -[#2 Domain] = 2:0-3:8 - >------- -2| except: -3| pass - --------< - -[#2 Removal] = 2:0-4:0 - >------- -2| except: -3| pass -4| finally: +[#2 Domain] = 1:0-1:12 + >------------< +1| except: pass + +[#2 Removal] = 1:0-2:0 + >------------ +1| except: pass +2| finally: pass < [#2 Insertion delimiter] = "\n" [#3 Content] = -[#3 Domain] = 4:0-5:8 - >-------- -4| finally: -5| pass - --------< - -[#3 Removal] = 3:8-5:8 - > -3| pass -4| finally: -5| pass - --------< +[#3 Domain] = 2:0-2:13 + >-------------< +2| finally: pass + +[#3 Removal] = 1:12-2:13 + > +1| except: pass +2| finally: pass + -------------< [#3 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/branch/branch.try2.scope b/data/fixtures/scopes/python/branch/branch.try2.scope index b1832ed988..0a903a4568 100644 --- a/data/fixtures/scopes/python/branch/branch.try2.scope +++ b/data/fixtures/scopes/python/branch/branch.try2.scope @@ -1,57 +1,45 @@ -try: - pass -except Exception as e: - pass -else: - pass +try: pass +except Exception as e: pass +else: pass --- [#1 Content] = -[#1 Domain] = 0:0-1:8 - >---- -0| try: -1| pass - --------< - -[#1 Removal] = 0:0-2:0 - >---- -0| try: -1| pass -2| except Exception as e: +[#1 Domain] = 0:0-0:9 + >---------< +0| try: pass + +[#1 Removal] = 0:0-1:0 + >--------- +0| try: pass +1| except Exception as e: pass < [#1 Insertion delimiter] = "\n" [#2 Content] = -[#2 Domain] = 2:0-3:8 - >---------------------- -2| except Exception as e: -3| pass - --------< - -[#2 Removal] = 2:0-4:0 - >---------------------- -2| except Exception as e: -3| pass -4| else: +[#2 Domain] = 1:0-1:27 + >---------------------------< +1| except Exception as e: pass + +[#2 Removal] = 1:0-2:0 + >--------------------------- +1| except Exception as e: pass +2| else: pass < [#2 Insertion delimiter] = "\n" [#3 Content] = -[#3 Domain] = 4:0-5:8 - >----- -4| else: -5| pass - --------< - -[#3 Removal] = 3:8-5:8 - > -3| pass -4| else: -5| pass - --------< +[#3 Domain] = 2:0-2:10 + >----------< +2| else: pass + +[#3 Removal] = 1:27-2:10 + > +1| except Exception as e: pass +2| else: pass + ----------< [#3 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/class.scope b/data/fixtures/scopes/python/class.scope index 450a9fd782..94c99f9f8f 100644 --- a/data/fixtures/scopes/python/class.scope +++ b/data/fixtures/scopes/python/class.scope @@ -1,13 +1,10 @@ -class Foo: - pass +class Foo: pass --- [Content] = [Removal] = -[Domain] = 0:0-1:8 - >---------- -0| class Foo: -1| pass - --------< +[Domain] = 0:0-0:15 + >---------------< +0| class Foo: pass [Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/python/class2.scope b/data/fixtures/scopes/python/class2.scope index eca5dfb37d..50963bf184 100644 --- a/data/fixtures/scopes/python/class2.scope +++ b/data/fixtures/scopes/python/class2.scope @@ -1,15 +1,13 @@ @bar -class Foo: - pass +class Foo: pass --- [Content] = [Removal] = -[Domain] = 0:0-2:8 +[Domain] = 0:0-1:15 >---- 0| @bar -1| class Foo: -2| pass - --------< +1| class Foo: pass + ---------------< [Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/python/condition/condition.while.scope b/data/fixtures/scopes/python/condition/condition.while.scope index 14b9585e9f..80bf2c0990 100644 --- a/data/fixtures/scopes/python/condition/condition.while.scope +++ b/data/fixtures/scopes/python/condition/condition.while.scope @@ -1,23 +1,20 @@ -while True: - pass +while True: pass --- [Content] = 0:6-0:10 >----< -0| while True: +0| while True: pass [Removal] = 0:5-0:10 >-----< -0| while True: +0| while True: pass [Leading delimiter] = 0:5-0:6 >-< -0| while True: +0| while True: pass -[Domain] = 0:0-1:8 - >----------- -0| while True: -1| pass - --------< +[Domain] = 0:0-0:16 + >----------------< +0| while True: pass [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/namedFunction/namedFunction.constructor.scope b/data/fixtures/scopes/python/namedFunction/namedFunction.constructor.scope index c0b44dccef..1422f8036a 100644 --- a/data/fixtures/scopes/python/namedFunction/namedFunction.constructor.scope +++ b/data/fixtures/scopes/python/namedFunction/namedFunction.constructor.scope @@ -1,20 +1,20 @@ class Foo: - def __init__(self, aaa: str, bbb: int): pass + def __init__(self): pass --- [Content] = -[Domain] = 1:4-1:48 - >--------------------------------------------< -1| def __init__(self, aaa: str, bbb: int): pass +[Domain] = 1:4-1:28 + >------------------------< +1| def __init__(self): pass -[Removal] = 0:10-1:48 +[Removal] = 0:10-1:28 > 0| class Foo: -1| def __init__(self, aaa: str, bbb: int): pass - ------------------------------------------------< +1| def __init__(self): pass + ----------------------------< [Leading delimiter] = 1:0-1:4 >----< -1| def __init__(self, aaa: str, bbb: int): pass +1| def __init__(self): pass [Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/python/namedFunction/namedFunction.iteration.class.scope b/data/fixtures/scopes/python/namedFunction/namedFunction.iteration.class.scope index 7ec5e468a5..c91c1c425a 100644 --- a/data/fixtures/scopes/python/namedFunction/namedFunction.iteration.class.scope +++ b/data/fixtures/scopes/python/namedFunction/namedFunction.iteration.class.scope @@ -1,16 +1,13 @@ -class Foo: - def bar(): pass +class Foo: pass --- [#1 Content] = -[#1 Domain] = 0:0-1:19 - >---------- -0| class Foo: -1| def bar(): pass - -------------------< +[#1 Domain] = 0:0-0:15 + >---------------< +0| class Foo: pass [#2 Content] = -[#2 Domain] = 1:4-1:19 - >---------------< -1| def bar(): pass +[#2 Domain] = 0:11-0:15 + >----< +0| class Foo: pass diff --git a/data/fixtures/scopes/python/namedFunction/namedFunction2.scope b/data/fixtures/scopes/python/namedFunction/namedFunction2.scope index 19d1f7b240..c63d73d862 100644 --- a/data/fixtures/scopes/python/namedFunction/namedFunction2.scope +++ b/data/fixtures/scopes/python/namedFunction/namedFunction2.scope @@ -1,13 +1,13 @@ @bar -def foo() -> str: pass +def foo(): pass --- [Content] = [Removal] = -[Domain] = 0:0-1:22 +[Domain] = 0:0-1:15 >---- 0| @bar -1| def foo() -> str: pass - ----------------------< +1| def foo(): pass + ---------------< [Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/python/statement/statement.break.scope b/data/fixtures/scopes/python/statement/statement.break.scope new file mode 100644 index 0000000000..1b7021e36a --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.break.scope @@ -0,0 +1,31 @@ +while True: + break +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-1:9 + >----------- +0| while True: +1| break + ---------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:9 + >-----< +1| break + +[#2 Removal] = 0:11-1:9 + > +0| while True: +1| break + ---------< + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| break + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.class2.scope b/data/fixtures/scopes/python/statement/statement.class2.scope new file mode 100644 index 0000000000..e0bce1d5d0 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.class2.scope @@ -0,0 +1,29 @@ +@bar +class Foo: pass +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-1:15 + >---- +0| @bar +1| class Foo: pass + ---------------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:11-1:15 + >----< +1| class Foo: pass + +[#2 Removal] = 1:10-1:15 + >-----< +1| class Foo: pass + +[#2 Leading delimiter] = 1:10-1:11 + >-< +1| class Foo: pass + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.constructor.scope b/data/fixtures/scopes/python/statement/statement.constructor.scope new file mode 100644 index 0000000000..d7f995ea57 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.constructor.scope @@ -0,0 +1,47 @@ +class Foo: + def __init__(self): pass +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-1:28 + >---------- +0| class Foo: +1| def __init__(self): pass + ----------------------------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:28 + >------------------------< +1| def __init__(self): pass + +[#2 Removal] = 0:10-1:28 + > +0| class Foo: +1| def __init__(self): pass + ----------------------------< + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| def __init__(self): pass + +[#2 Insertion delimiter] = "\n" + + +[#3 Content] = +[#3 Domain] = 1:24-1:28 + >----< +1| def __init__(self): pass + +[#3 Removal] = 1:23-1:28 + >-----< +1| def __init__(self): pass + +[#3 Leading delimiter] = 1:23-1:24 + >-< +1| def __init__(self): pass + +[#3 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.continue.scope b/data/fixtures/scopes/python/statement/statement.continue.scope new file mode 100644 index 0000000000..61c679b416 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.continue.scope @@ -0,0 +1,31 @@ +while True: + continue +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-1:12 + >----------- +0| while True: +1| continue + ------------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:12 + >--------< +1| continue + +[#2 Removal] = 0:11-1:12 + > +0| while True: +1| continue + ------------< + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| continue + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.foreach.scope b/data/fixtures/scopes/python/statement/statement.foreach.scope new file mode 100644 index 0000000000..d1a78f3b11 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.foreach.scope @@ -0,0 +1,26 @@ +for v in values: pass +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-0:21 + >---------------------< +0| for v in values: pass + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 0:17-0:21 + >----< +0| for v in values: pass + +[#2 Removal] = 0:16-0:21 + >-----< +0| for v in values: pass + +[#2 Leading delimiter] = 0:16-0:17 + >-< +0| for v in values: pass + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.function.scope b/data/fixtures/scopes/python/statement/statement.function.scope new file mode 100644 index 0000000000..852827d460 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.function.scope @@ -0,0 +1,26 @@ +def foo(): pass +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-0:15 + >---------------< +0| def foo(): pass + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 0:11-0:15 + >----< +0| def foo(): pass + +[#2 Removal] = 0:10-0:15 + >-----< +0| def foo(): pass + +[#2 Leading delimiter] = 0:10-0:11 + >-< +0| def foo(): pass + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.function2.scope b/data/fixtures/scopes/python/statement/statement.function2.scope new file mode 100644 index 0000000000..8c51f4b225 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.function2.scope @@ -0,0 +1,29 @@ +@bar +def foo(): pass +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-1:15 + >---- +0| @bar +1| def foo(): pass + ---------------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:11-1:15 + >----< +1| def foo(): pass + +[#2 Removal] = 1:10-1:15 + >-----< +1| def foo(): pass + +[#2 Leading delimiter] = 1:10-1:11 + >-< +1| def foo(): pass + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.if.scope b/data/fixtures/scopes/python/statement/statement.if.scope new file mode 100644 index 0000000000..42b3b554e0 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.if.scope @@ -0,0 +1,63 @@ +if True: pass +elif False: pass +else: pass +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:10 + >------------- +0| if True: pass +1| elif False: pass +2| else: pass + ----------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 0:9-0:13 + >----< +0| if True: pass + +[#2 Removal] = 0:8-0:13 + >-----< +0| if True: pass + +[#2 Leading delimiter] = 0:8-0:9 + >-< +0| if True: pass + +[#2 Insertion delimiter] = "\n" + + +[#3 Content] = +[#3 Domain] = 1:12-1:16 + >----< +1| elif False: pass + +[#3 Removal] = 1:11-1:16 + >-----< +1| elif False: pass + +[#3 Leading delimiter] = 1:11-1:12 + >-< +1| elif False: pass + +[#3 Insertion delimiter] = "\n" + + +[#4 Content] = +[#4 Domain] = 2:6-2:10 + >----< +2| else: pass + +[#4 Removal] = 2:5-2:10 + >-----< +2| else: pass + +[#4 Leading delimiter] = 2:5-2:6 + >-< +2| else: pass + +[#4 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.method.scope b/data/fixtures/scopes/python/statement/statement.method.scope new file mode 100644 index 0000000000..347fde98a6 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.method.scope @@ -0,0 +1,47 @@ +class Foo: + def bar(): pass +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-1:19 + >---------- +0| class Foo: +1| def bar(): pass + -------------------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:19 + >---------------< +1| def bar(): pass + +[#2 Removal] = 0:10-1:19 + > +0| class Foo: +1| def bar(): pass + -------------------< + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| def bar(): pass + +[#2 Insertion delimiter] = "\n" + + +[#3 Content] = +[#3 Domain] = 1:15-1:19 + >----< +1| def bar(): pass + +[#3 Removal] = 1:14-1:19 + >-----< +1| def bar(): pass + +[#3 Leading delimiter] = 1:14-1:15 + >-< +1| def bar(): pass + +[#3 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.misc.scope b/data/fixtures/scopes/python/statement/statement.misc.scope new file mode 100644 index 0000000000..c6258214b4 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.misc.scope @@ -0,0 +1,10 @@ +pass +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:4 + >----< +0| pass + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.resource.scope b/data/fixtures/scopes/python/statement/statement.resource.scope new file mode 100644 index 0000000000..143737dd0f --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.resource.scope @@ -0,0 +1,26 @@ +with foo as bar: pass +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-0:21 + >---------------------< +0| with foo as bar: pass + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 0:17-0:21 + >----< +0| with foo as bar: pass + +[#2 Removal] = 0:16-0:21 + >-----< +0| with foo as bar: pass + +[#2 Leading delimiter] = 0:16-0:17 + >-< +0| with foo as bar: pass + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.return.scope b/data/fixtures/scopes/python/statement/statement.return.scope new file mode 100644 index 0000000000..41d04f874e --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.return.scope @@ -0,0 +1,31 @@ +def bar(): + return 0 +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-1:12 + >---------- +0| def bar(): +1| return 0 + ------------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:12 + >--------< +1| return 0 + +[#2 Removal] = 0:10-1:12 + > +0| def bar(): +1| return 0 + ------------< + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| return 0 + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.switch.scope b/data/fixtures/scopes/python/statement/statement.switch.scope new file mode 100644 index 0000000000..0bbeb17605 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.switch.scope @@ -0,0 +1,13 @@ +match foo: + pass +--- + +[Content] = +[Removal] = +[Domain] = 0:0-1:8 + >---------- +0| match foo: +1| pass + --------< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.try.scope b/data/fixtures/scopes/python/statement/statement.try.scope new file mode 100644 index 0000000000..86972af94e --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.try.scope @@ -0,0 +1,63 @@ +try: pass +except: pass +finally: pass +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:13 + >--------- +0| try: pass +1| except: pass +2| finally: pass + -------------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 0:5-0:9 + >----< +0| try: pass + +[#2 Removal] = 0:4-0:9 + >-----< +0| try: pass + +[#2 Leading delimiter] = 0:4-0:5 + >-< +0| try: pass + +[#2 Insertion delimiter] = "\n" + + +[#3 Content] = +[#3 Domain] = 1:8-1:12 + >----< +1| except: pass + +[#3 Removal] = 1:7-1:12 + >-----< +1| except: pass + +[#3 Leading delimiter] = 1:7-1:8 + >-< +1| except: pass + +[#3 Insertion delimiter] = "\n" + + +[#4 Content] = +[#4 Domain] = 2:9-2:13 + >----< +2| finally: pass + +[#4 Removal] = 2:8-2:13 + >-----< +2| finally: pass + +[#4 Leading delimiter] = 2:8-2:9 + >-< +2| finally: pass + +[#4 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.while.scope b/data/fixtures/scopes/python/statement/statement.while.scope new file mode 100644 index 0000000000..bef9c5c662 --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.while.scope @@ -0,0 +1,26 @@ +while True: pass +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-0:16 + >----------------< +0| while True: pass + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 0:12-0:16 + >----< +0| while True: pass + +[#2 Removal] = 0:11-0:16 + >-----< +0| while True: pass + +[#2 Leading delimiter] = 0:11-0:12 + >-< +0| while True: pass + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.yield.scope b/data/fixtures/scopes/python/statement/statement.yield.scope new file mode 100644 index 0000000000..1e1c6e105e --- /dev/null +++ b/data/fixtures/scopes/python/statement/statement.yield.scope @@ -0,0 +1,31 @@ +def foo(): + yield 0 +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-1:11 + >---------- +0| def foo(): +1| yield 0 + -----------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 1:4-1:11 + >-------< +1| yield 0 + +[#2 Removal] = 0:10-1:11 + > +0| def foo(): +1| yield 0 + -----------< + +[#2 Leading delimiter] = 1:0-1:4 + >----< +1| yield 0 + +[#2 Insertion delimiter] = "\n" diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index a42646a929..d9398fa385 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -177,12 +177,26 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, "statement.class": supported, + "statement.field.class": supported, + "statement.function": supported, + "statement.constructor": supported, + "statement.method": supported, + "statement.if": supported, + "statement.try": supported, + "statement.switch": supported, + "statement.foreach": supported, + "statement.while": supported, "statement.variable": supported, "statement.assignment": supported, - "statement.field.class": supported, - "statement.iteration.block": supported, - "statement.iteration.class": supported, + "statement.return": supported, + "statement.yield": supported, + "statement.break": supported, + "statement.continue": supported, + "statement.resource": supported, + "statement.misc": supported, "statement.iteration.document": supported, + "statement.iteration.class": supported, + "statement.iteration.block": supported, functionCall: supported, "functionCall.constructor": supported, @@ -213,18 +227,24 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { // Command command: notApplicable, + "statement.command": notApplicable, "name.command": notApplicable, "value.command": notApplicable, "interior.command": notApplicable, // Namespace + "statement.namespace": notApplicable, "name.namespace": notApplicable, "interior.namespace": notApplicable, - // for and do-while loops - "condition.doWhile": notApplicable, + // For loop + "statement.for": notApplicable, "condition.for": notApplicable, "interior.for": notApplicable, + + // Do-while loop + "statement.doWhile": notApplicable, + "condition.doWhile": notApplicable, "interior.doWhile": notApplicable, // Nested classes @@ -273,7 +293,11 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { "name.field.interface": notApplicable, "name.iteration.interface": notApplicable, + // Static "interior.static": notApplicable, + "statement.static": notApplicable, + + // Miscellaneous environment: notApplicable, regularExpression: notApplicable, selector: notApplicable, diff --git a/queries/python.scm b/queries/python.scm index c15c40e1b4..d5a6c99c5c 100644 --- a/queries/python.scm +++ b/queries/python.scm @@ -8,14 +8,12 @@ [ (assert_statement) (break_statement) - (class_definition) (continue_statement) (decorated_definition) (delete_statement) (exec_statement) (expression_statement) (for_statement) - (function_definition) (future_import_statement) (global_statement) (import_from_statement) @@ -29,7 +27,9 @@ (try_statement) (while_statement) (with_statement) - ;; Disabled on purpose. We have a better definition of this below. + ;; Disabled on purpose. We have a better definition for these below. + ;; (class_definition) + ;; (function_definition) ;; (if_statement) ] @statement @@ -292,14 +292,18 @@ (set) ] @list +;;!! def foo(): pass +;;! ^^^^^^^^^^^^^^^ ( (function_definition name: (_) @name body: (_) @interior - ) @namedFunction @_.domain + ) @namedFunction @statement @_.domain (#not-parent-type? @namedFunction decorated_definition) ) +;;!! @value def foo(): pass +;;! ^^^^^^^^^^^^^^^^^^^^^^ (decorated_definition (function_definition name: (_) @name @@ -321,30 +325,30 @@ ;;!! class MyClass: ( - (class_definition - name: (_) @name - body: (_) @interior - ) @class @_.domain + (class_definition) @class @type @statement (#not-parent-type? @class decorated_definition) ) ( - (class_definition) @type - (#not-parent-type? @type decorated_definition) + (class_definition + name: (_) @name + body: (_) @interior + ) @_.domain + (#not-parent-type? @_.domain decorated_definition) ) ;;!! @value ;;!! class MyClass: +(decorated_definition + (class_definition) +) @class @type @statement + (decorated_definition (class_definition name: (_) @name body: (_) @interior ) -) @class @_.domain - -(decorated_definition - (class_definition) -) @type +) @_.domain ( (module) @statement.iteration @class.iteration @namedFunction.iteration From e2dca158ff08517b7792cea99c4754911d7eaf29 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 14:31:12 +0200 Subject: [PATCH 13/18] talon --- data/fixtures/scopes/talon/functionCall.scope | 17 + .../scopes/talon/functionCallee.scope | 17 + .../common/src/scopeSupportFacets/talon.ts | 336 +++++++++++------- 3 files changed, 241 insertions(+), 129 deletions(-) create mode 100644 data/fixtures/scopes/talon/functionCall.scope create mode 100644 data/fixtures/scopes/talon/functionCallee.scope diff --git a/data/fixtures/scopes/talon/functionCall.scope b/data/fixtures/scopes/talon/functionCall.scope new file mode 100644 index 0000000000..fe111e9015 --- /dev/null +++ b/data/fixtures/scopes/talon/functionCall.scope @@ -0,0 +1,17 @@ +foo: skip() +--- + +[Content] = +[Domain] = 0:5-0:11 + >------< +0| foo: skip() + +[Removal] = 0:4-0:11 + >-------< +0| foo: skip() + +[Leading delimiter] = 0:4-0:5 + >-< +0| foo: skip() + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/talon/functionCallee.scope b/data/fixtures/scopes/talon/functionCallee.scope new file mode 100644 index 0000000000..2c6e7ef907 --- /dev/null +++ b/data/fixtures/scopes/talon/functionCallee.scope @@ -0,0 +1,17 @@ +foo: skip() +--- + +[Content] = +[Removal] = 0:5-0:9 + >----< +0| foo: skip() + +[Leading delimiter] = 0:4-0:5 + >-< +0| foo: skip() + +[Domain] = 0:5-0:11 + >------< +0| foo: skip() + +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index 9a881e112c..2edc82606b 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -46,6 +46,9 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "value.mapPair": supported, "value.mapPair.iteration": supported, + functionCall: supported, + functionCallee: supported, + /* UNSUPPORTED */ fieldAccess: unsupported, @@ -68,7 +71,104 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "value.field.class": notApplicable, "value.iteration.class": notApplicable, "interior.class": notApplicable, + + // Constructor + "statement.constructor": notApplicable, + "namedFunction.constructor": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, + "argument.actual.constructor.singleLine": notApplicable, + "argument.actual.constructor.multiLine": notApplicable, + "argument.actual.constructor.iteration": notApplicable, + "argument.formal.constructor.singleLine": notApplicable, + "argument.formal.constructor.multiLine": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argumentList.actual.constructor.empty": notApplicable, + "argumentList.actual.constructor.singleLine": notApplicable, + "argumentList.actual.constructor.multiLine": notApplicable, + "argumentList.formal.constructor.empty": notApplicable, + "argumentList.formal.constructor.singleLine": notApplicable, + "argumentList.formal.constructor.multiLine": notApplicable, + "interior.constructor": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.constructor": notApplicable, + "type.argument.formal.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "value.argument.formal.constructor": notApplicable, + "value.argument.formal.constructor.iteration": notApplicable, + + // Method + "statement.method": notApplicable, + "namedFunction.method": notApplicable, + "argument.actual.method.singleLine": notApplicable, + "argument.actual.method.multiLine": notApplicable, + "argument.actual.method.iteration": notApplicable, + "argument.formal.method.singleLine": notApplicable, + "argument.formal.method.multiLine": notApplicable, + "argument.formal.method.iteration": notApplicable, + "argumentList.actual.method.multiLine": notApplicable, + "argumentList.formal.method.empty": notApplicable, + "argumentList.formal.method.singleLine": notApplicable, + "argumentList.formal.method.multiLine": notApplicable, + "interior.method": notApplicable, + "name.argument.formal.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.method": notApplicable, + "type.argument.formal.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "value.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + + // Function + namedFunction: notApplicable, + "namedFunction.iteration.document": notApplicable, "namedFunction.iteration.class": notApplicable, + "statement.function": notApplicable, + "name.function": notApplicable, + "interior.function": notApplicable, + "argumentList.formal.empty": notApplicable, + "argumentList.formal.singleLine": notApplicable, + "argumentList.formal.multiLine": notApplicable, + "argument.formal.singleLine": notApplicable, + "argument.formal.multiLine": notApplicable, + "argument.formal.iteration": notApplicable, + "name.argument.formal": notApplicable, + "name.argument.formal.iteration": notApplicable, + "type.argument.formal": notApplicable, + "type.argument.formal.iteration": notApplicable, + "value.argument.formal": notApplicable, + "value.argument.formal.iteration": notApplicable, + + // Multiline function calls + "argument.actual.multiLine": notApplicable, + "argumentList.actual.multiLine": notApplicable, + + // Anonymous function / lambda + anonymousFunction: notApplicable, + "argumentList.formal.lambda.empty": notApplicable, + "argumentList.formal.lambda.singleLine": notApplicable, + "argumentList.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.singleLine": notApplicable, + "argument.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "value.return.lambda": notApplicable, + "interior.lambda": notApplicable, + + // Keyword argument + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, + + // Return statement + "statement.return": notApplicable, + "type.return": notApplicable, + "value.return": notApplicable, + + // Yield statement + "statement.yield": notApplicable, + "value.yield": notApplicable, // Interface "statement.interface": notApplicable, @@ -93,6 +193,7 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "interior.enum": notApplicable, // Try catch + "statement.try": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, "interior.try": notApplicable, @@ -100,161 +201,138 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.catch": notApplicable, "type.argument.catch": notApplicable, - anonymousFunction: notApplicable, - "argument.actual.multiLine": notApplicable, - "argument.actual.constructor.singleLine": notApplicable, - "argument.actual.constructor.multiLine": notApplicable, - "argument.actual.constructor.iteration": notApplicable, - "argument.actual.method.singleLine": notApplicable, - "argument.actual.method.multiLine": notApplicable, - "argument.actual.method.iteration": notApplicable, - "argument.formal.singleLine": notApplicable, - "argument.formal.multiLine": notApplicable, - "argument.formal.constructor.singleLine": notApplicable, - "argument.formal.constructor.multiLine": notApplicable, - "argument.formal.constructor.iteration": notApplicable, - "argument.formal.iteration": notApplicable, - "argument.formal.method.singleLine": notApplicable, - "argument.formal.method.multiLine": notApplicable, - "argument.formal.method.iteration": notApplicable, - "argument.formal.lambda.singleLine": notApplicable, - "argument.formal.lambda.multiLine": notApplicable, - "argument.formal.lambda.iteration": notApplicable, - "argumentList.actual.constructor.empty": notApplicable, - "argumentList.actual.constructor.singleLine": notApplicable, - "argumentList.actual.constructor.multiLine": notApplicable, - "argumentList.actual.multiLine": notApplicable, - "argumentList.actual.method.multiLine": notApplicable, - "argumentList.formal.empty": notApplicable, - "argumentList.formal.singleLine": notApplicable, - "argumentList.formal.multiLine": notApplicable, - "argumentList.formal.lambda.empty": notApplicable, - "argumentList.formal.lambda.singleLine": notApplicable, - "argumentList.formal.lambda.multiLine": notApplicable, - "argumentList.formal.method.empty": notApplicable, - "argumentList.formal.method.singleLine": notApplicable, - "argumentList.formal.method.multiLine": notApplicable, - "argumentList.formal.constructor.empty": notApplicable, - "argumentList.formal.constructor.singleLine": notApplicable, - "argumentList.formal.constructor.multiLine": notApplicable, - attribute: notApplicable, + // If statement + ifStatement: notApplicable, + "statement.if": notApplicable, "branch.if": notApplicable, "branch.if.elif.else": notApplicable, "branch.if.else": notApplicable, "branch.if.iteration": notApplicable, - "branch.loop": notApplicable, - "branch.loop.iteration": notApplicable, + "condition.if": notApplicable, + "interior.if": notApplicable, + + // Switch statement + "statement.switch": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, - "branch.ternary": notApplicable, - "branch.ternary.iteration": notApplicable, - "collectionItem.unenclosed": notApplicable, - "collectionItem.unenclosed.iteration": notApplicable, - "comment.block": notApplicable, - "condition.doWhile": notApplicable, - "condition.for": notApplicable, - "condition.if": notApplicable, "condition.switchCase": notApplicable, "condition.switchCase.iteration": notApplicable, - "condition.ternary": notApplicable, - "condition.while": notApplicable, - disqualifyDelimiter: notApplicable, - element: notApplicable, - endTag: notApplicable, - environment: notApplicable, - functionCall: notApplicable, - "functionCall.constructor": notApplicable, - functionCallee: notApplicable, - "functionCallee.constructor": notApplicable, - ifStatement: notApplicable, - "interior.cell": notApplicable, - "interior.element": notApplicable, - "interior.function": notApplicable, - "interior.constructor": notApplicable, - "interior.method": notApplicable, - "interior.if": notApplicable, - "interior.lambda": notApplicable, + "interior.switch": notApplicable, + "interior.switchCase": notApplicable, + "value.switch": notApplicable, + + // Loop + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, + + // For loop + "statement.for": notApplicable, + "condition.for": notApplicable, "interior.for": notApplicable, + + // For-each loop + "statement.foreach": notApplicable, "interior.foreach": notApplicable, + "name.foreach": notApplicable, + "type.foreach": notApplicable, + "value.foreach": notApplicable, + + // While loop + "statement.while": notApplicable, + "condition.while": notApplicable, "interior.while": notApplicable, + + // Do-while loop + "statement.doWhile": notApplicable, + "condition.doWhile": notApplicable, "interior.doWhile": notApplicable, + + // Resource statement + "statement.resource": notApplicable, "interior.resource": notApplicable, - "interior.switch": notApplicable, - "interior.switchCase": notApplicable, - "interior.ternary": notApplicable, - "interior.namespace": notApplicable, - "interior.static": notApplicable, - "key.attribute": notApplicable, - list: notApplicable, - map: notApplicable, - "name.argument.actual": notApplicable, - "name.argument.actual.iteration": notApplicable, - "name.argument.formal": notApplicable, - "name.argument.formal.constructor": notApplicable, - "name.argument.formal.constructor.iteration": notApplicable, - "name.argument.formal.iteration": notApplicable, - "name.argument.formal.method": notApplicable, - "name.argument.formal.method.iteration": notApplicable, - "name.assignment.pattern": notApplicable, - "name.namespace": notApplicable, - "name.constructor": notApplicable, - "name.foreach": notApplicable, - "name.function": notApplicable, - "name.method": notApplicable, "name.resource": notApplicable, "name.resource.iteration": notApplicable, + "type.resource": notApplicable, + "type.resource.iteration": notApplicable, + "value.resource": notApplicable, + "value.resource.iteration": notApplicable, + + // Pattern destruction + "name.assignment.pattern": notApplicable, "name.variable.pattern": notApplicable, - namedFunction: notApplicable, - "namedFunction.constructor": notApplicable, - "namedFunction.iteration.document": notApplicable, - "namedFunction.method": notApplicable, - notebookCell: notApplicable, - pairDelimiter: notApplicable, - regularExpression: notApplicable, + "value.variable.pattern": notApplicable, + + // Multiline string + "string.multiLine": notApplicable, + "textFragment.string.multiLine": notApplicable, + + // Block comment + "comment.block": notApplicable, + "textFragment.comment.block": notApplicable, + + // Static + "statement.static": notApplicable, + "interior.static": notApplicable, + + // Namespace + "statement.namespace": notApplicable, + "interior.namespace": notApplicable, + "name.namespace": notApplicable, + + // Ternary + "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, + "condition.ternary": notApplicable, + "interior.ternary": notApplicable, + + // Section section: notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, - startTag: notApplicable, - tags: notApplicable, - "textFragment.comment.block": notApplicable, + + // Element + element: notApplicable, + "interior.element": notApplicable, "textFragment.element": notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + + // Attribute + attribute: notApplicable, + "key.attribute": notApplicable, + "value.attribute": notApplicable, + + // Notebook cell + notebookCell: notApplicable, + "interior.cell": notApplicable, + + // Type alias "type.alias": notApplicable, - "type.argument.formal": notApplicable, - "type.argument.formal.constructor": notApplicable, - "type.argument.formal.constructor.iteration": notApplicable, - "type.argument.formal.iteration": notApplicable, - "type.argument.formal.method": notApplicable, - "type.argument.formal.method.iteration": notApplicable, - "type.cast": notApplicable, - "type.foreach": notApplicable, - "type.return": notApplicable, + "value.typeAlias": notApplicable, + + // Collection item + "collectionItem.unenclosed": notApplicable, + "collectionItem.unenclosed.iteration": notApplicable, + + // Miscellaneous statements + "statement.break": notApplicable, + "statement.continue": notApplicable, + + // Miscellaneous + list: notApplicable, + map: notApplicable, + environment: notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, + "statement.misc": notApplicable, "type.variable": notApplicable, + "type.cast": notApplicable, "type.typeArgument": notApplicable, "type.typeArgument.iteration": notApplicable, - "type.resource": notApplicable, - "type.resource.iteration": notApplicable, "type.iteration.block": notApplicable, "type.iteration.document": notApplicable, - "value.argument.actual": notApplicable, - "value.argument.actual.iteration": notApplicable, - "value.argument.formal": notApplicable, - "value.argument.formal.constructor": notApplicable, - "value.argument.formal.constructor.iteration": notApplicable, - "value.argument.formal.iteration": notApplicable, - "value.argument.formal.method": notApplicable, - "value.argument.formal.method.iteration": notApplicable, - "value.attribute": notApplicable, - "value.foreach": notApplicable, - "value.resource": notApplicable, - "value.resource.iteration": notApplicable, - "value.return": notApplicable, - "value.return.lambda": notApplicable, - "value.typeAlias": notApplicable, - "value.variable.pattern": notApplicable, - "value.yield": notApplicable, - "value.switch": notApplicable, - "string.multiLine": notApplicable, - "textFragment.string.multiLine": notApplicable, selector: notApplicable, unit: notApplicable, + disqualifyDelimiter: notApplicable, }; From f5c0f24788fa5f5a10ab066ad6d9d418111552c0 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 14:52:16 +0200 Subject: [PATCH 14/18] Function call method --- .../scopes/c/functionCall.method.scope | 10 ++++++++ .../scopes/c/functionCallee.method.scope | 13 +++++++++++ .../scopes/cpp/functionCall.method.scope | 10 ++++++++ .../scopes/cpp/functionCallee.method.scope | 13 +++++++++++ .../scopes/csharp/functionCall.method.scope | 10 ++++++++ .../functionCallee.constructor.scope | 0 .../scopes/csharp/functionCallee.method.scope | 13 +++++++++++ .../{functionCallee => }/functionCallee.scope | 0 .../scopes/java/functionCall.method.scope | 10 ++++++++ .../scopes/java/functionCallee.method.scope | 13 +++++++++++ .../javascript.core/functionCall.method.scope | 10 ++++++++ .../functionCallee.method.scope | 13 +++++++++++ .../scopes/lua/functionCall.method.scope | 10 ++++++++ .../scopes/lua/functionCall.method2.scope | 10 ++++++++ .../scopes/lua/functionCallee.method.scope | 13 +++++++++++ .../scopes/lua/functionCallee.method2.scope | 13 +++++++++++ data/fixtures/scopes/lua/statement.if.scope | 23 +++++++++++++++++++ .../scopes/python/functionCall.method.scope | 10 ++++++++ .../scopes/python/functionCallee.method.scope | 13 +++++++++++ .../scopes/r/functionCall.method.scope | 10 ++++++++ .../scopes/r/functionCallee.method.scope | 10 ++++++++ data/scopeSupportFacetInfos.md | 10 ++++---- packages/common/src/scopeSupportFacets/c.ts | 2 ++ .../common/src/scopeSupportFacets/csharp.ts | 2 ++ .../common/src/scopeSupportFacets/java.ts | 2 ++ .../src/scopeSupportFacets/javascript.ts | 2 ++ packages/common/src/scopeSupportFacets/lua.ts | 12 +++++++--- .../common/src/scopeSupportFacets/python.ts | 2 ++ packages/common/src/scopeSupportFacets/r.ts | 5 +++- .../scopeSupportFacetInfos.ts | 17 ++++++++++---- .../scopeSupportFacets.types.ts | 2 ++ 31 files changed, 271 insertions(+), 12 deletions(-) create mode 100644 data/fixtures/scopes/c/functionCall.method.scope create mode 100644 data/fixtures/scopes/c/functionCallee.method.scope create mode 100644 data/fixtures/scopes/cpp/functionCall.method.scope create mode 100644 data/fixtures/scopes/cpp/functionCallee.method.scope create mode 100644 data/fixtures/scopes/csharp/functionCall.method.scope rename data/fixtures/scopes/csharp/{functionCallee => }/functionCallee.constructor.scope (100%) create mode 100644 data/fixtures/scopes/csharp/functionCallee.method.scope rename data/fixtures/scopes/csharp/{functionCallee => }/functionCallee.scope (100%) create mode 100644 data/fixtures/scopes/java/functionCall.method.scope create mode 100644 data/fixtures/scopes/java/functionCallee.method.scope create mode 100644 data/fixtures/scopes/javascript.core/functionCall.method.scope create mode 100644 data/fixtures/scopes/javascript.core/functionCallee.method.scope create mode 100644 data/fixtures/scopes/lua/functionCall.method.scope create mode 100644 data/fixtures/scopes/lua/functionCall.method2.scope create mode 100644 data/fixtures/scopes/lua/functionCallee.method.scope create mode 100644 data/fixtures/scopes/lua/functionCallee.method2.scope create mode 100644 data/fixtures/scopes/lua/statement.if.scope create mode 100644 data/fixtures/scopes/python/functionCall.method.scope create mode 100644 data/fixtures/scopes/python/functionCallee.method.scope create mode 100644 data/fixtures/scopes/r/functionCall.method.scope create mode 100644 data/fixtures/scopes/r/functionCallee.method.scope diff --git a/data/fixtures/scopes/c/functionCall.method.scope b/data/fixtures/scopes/c/functionCall.method.scope new file mode 100644 index 0000000000..87d426d2ed --- /dev/null +++ b/data/fixtures/scopes/c/functionCall.method.scope @@ -0,0 +1,10 @@ +foo.bar(); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:9 + >---------< +0| foo.bar(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/functionCallee.method.scope b/data/fixtures/scopes/c/functionCallee.method.scope new file mode 100644 index 0000000000..f30f0f7536 --- /dev/null +++ b/data/fixtures/scopes/c/functionCallee.method.scope @@ -0,0 +1,13 @@ +foo.bar(); +--- + +[Content] = +[Removal] = 0:0-0:7 + >-------< +0| foo.bar(); + +[Domain] = 0:0-0:9 + >---------< +0| foo.bar(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/functionCall.method.scope b/data/fixtures/scopes/cpp/functionCall.method.scope new file mode 100644 index 0000000000..4b139b1b79 --- /dev/null +++ b/data/fixtures/scopes/cpp/functionCall.method.scope @@ -0,0 +1,10 @@ +foo::bar(); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:10 + >----------< +0| foo::bar(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/functionCallee.method.scope b/data/fixtures/scopes/cpp/functionCallee.method.scope new file mode 100644 index 0000000000..d7872b6252 --- /dev/null +++ b/data/fixtures/scopes/cpp/functionCallee.method.scope @@ -0,0 +1,13 @@ +foo::bar(); +--- + +[Content] = +[Removal] = 0:0-0:8 + >--------< +0| foo::bar(); + +[Domain] = 0:0-0:10 + >----------< +0| foo::bar(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/functionCall.method.scope b/data/fixtures/scopes/csharp/functionCall.method.scope new file mode 100644 index 0000000000..702879caaf --- /dev/null +++ b/data/fixtures/scopes/csharp/functionCall.method.scope @@ -0,0 +1,10 @@ +Foo.Bar(); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:9 + >---------< +0| Foo.Bar(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/functionCallee/functionCallee.constructor.scope b/data/fixtures/scopes/csharp/functionCallee.constructor.scope similarity index 100% rename from data/fixtures/scopes/csharp/functionCallee/functionCallee.constructor.scope rename to data/fixtures/scopes/csharp/functionCallee.constructor.scope diff --git a/data/fixtures/scopes/csharp/functionCallee.method.scope b/data/fixtures/scopes/csharp/functionCallee.method.scope new file mode 100644 index 0000000000..f30f0f7536 --- /dev/null +++ b/data/fixtures/scopes/csharp/functionCallee.method.scope @@ -0,0 +1,13 @@ +foo.bar(); +--- + +[Content] = +[Removal] = 0:0-0:7 + >-------< +0| foo.bar(); + +[Domain] = 0:0-0:9 + >---------< +0| foo.bar(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/functionCallee/functionCallee.scope b/data/fixtures/scopes/csharp/functionCallee.scope similarity index 100% rename from data/fixtures/scopes/csharp/functionCallee/functionCallee.scope rename to data/fixtures/scopes/csharp/functionCallee.scope diff --git a/data/fixtures/scopes/java/functionCall.method.scope b/data/fixtures/scopes/java/functionCall.method.scope new file mode 100644 index 0000000000..87d426d2ed --- /dev/null +++ b/data/fixtures/scopes/java/functionCall.method.scope @@ -0,0 +1,10 @@ +foo.bar(); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:9 + >---------< +0| foo.bar(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/functionCallee.method.scope b/data/fixtures/scopes/java/functionCallee.method.scope new file mode 100644 index 0000000000..51400cfb94 --- /dev/null +++ b/data/fixtures/scopes/java/functionCallee.method.scope @@ -0,0 +1,13 @@ +foo.bar(); +--- + +[Content] = +[Removal] = 0:0-0:7 + >-------< +0| foo.bar(); + +[Domain] = 0:0-0:10 + >----------< +0| foo.bar(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/functionCall.method.scope b/data/fixtures/scopes/javascript.core/functionCall.method.scope new file mode 100644 index 0000000000..87d426d2ed --- /dev/null +++ b/data/fixtures/scopes/javascript.core/functionCall.method.scope @@ -0,0 +1,10 @@ +foo.bar(); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:9 + >---------< +0| foo.bar(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/functionCallee.method.scope b/data/fixtures/scopes/javascript.core/functionCallee.method.scope new file mode 100644 index 0000000000..f30f0f7536 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/functionCallee.method.scope @@ -0,0 +1,13 @@ +foo.bar(); +--- + +[Content] = +[Removal] = 0:0-0:7 + >-------< +0| foo.bar(); + +[Domain] = 0:0-0:9 + >---------< +0| foo.bar(); + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/lua/functionCall.method.scope b/data/fixtures/scopes/lua/functionCall.method.scope new file mode 100644 index 0000000000..6ab0ba4c3a --- /dev/null +++ b/data/fixtures/scopes/lua/functionCall.method.scope @@ -0,0 +1,10 @@ +foo.bar() +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:9 + >---------< +0| foo.bar() + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/lua/functionCall.method2.scope b/data/fixtures/scopes/lua/functionCall.method2.scope new file mode 100644 index 0000000000..07aa870f48 --- /dev/null +++ b/data/fixtures/scopes/lua/functionCall.method2.scope @@ -0,0 +1,10 @@ +foo:bar() +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:9 + >---------< +0| foo:bar() + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/lua/functionCallee.method.scope b/data/fixtures/scopes/lua/functionCallee.method.scope new file mode 100644 index 0000000000..e77bc361ec --- /dev/null +++ b/data/fixtures/scopes/lua/functionCallee.method.scope @@ -0,0 +1,13 @@ +foo.bar() +--- + +[Content] = +[Removal] = 0:0-0:7 + >-------< +0| foo.bar() + +[Domain] = 0:0-0:9 + >---------< +0| foo.bar() + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/lua/functionCallee.method2.scope b/data/fixtures/scopes/lua/functionCallee.method2.scope new file mode 100644 index 0000000000..50a2a586b0 --- /dev/null +++ b/data/fixtures/scopes/lua/functionCallee.method2.scope @@ -0,0 +1,13 @@ +foo:bar() +--- + +[Content] = +[Removal] = 0:0-0:7 + >-------< +0| foo:bar() + +[Domain] = 0:0-0:9 + >---------< +0| foo:bar() + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/lua/statement.if.scope b/data/fixtures/scopes/lua/statement.if.scope new file mode 100644 index 0000000000..f92c2b599b --- /dev/null +++ b/data/fixtures/scopes/lua/statement.if.scope @@ -0,0 +1,23 @@ +if true then + a = 1 +elseif false then + a = 2 +else + a = 3 +end +--- + +[Content] = +[Removal] = +[Domain] = 0:0-6:3 + >------------ +0| if true then +1| a = 1 +2| elseif false then +3| a = 2 +4| else +5| a = 3 +6| end + ---< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/functionCall.method.scope b/data/fixtures/scopes/python/functionCall.method.scope new file mode 100644 index 0000000000..6ab0ba4c3a --- /dev/null +++ b/data/fixtures/scopes/python/functionCall.method.scope @@ -0,0 +1,10 @@ +foo.bar() +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:9 + >---------< +0| foo.bar() + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/functionCallee.method.scope b/data/fixtures/scopes/python/functionCallee.method.scope new file mode 100644 index 0000000000..e77bc361ec --- /dev/null +++ b/data/fixtures/scopes/python/functionCallee.method.scope @@ -0,0 +1,13 @@ +foo.bar() +--- + +[Content] = +[Removal] = 0:0-0:7 + >-------< +0| foo.bar() + +[Domain] = 0:0-0:9 + >---------< +0| foo.bar() + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/r/functionCall.method.scope b/data/fixtures/scopes/r/functionCall.method.scope new file mode 100644 index 0000000000..6ab0ba4c3a --- /dev/null +++ b/data/fixtures/scopes/r/functionCall.method.scope @@ -0,0 +1,10 @@ +foo.bar() +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:9 + >---------< +0| foo.bar() + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/r/functionCallee.method.scope b/data/fixtures/scopes/r/functionCallee.method.scope new file mode 100644 index 0000000000..2afce1289c --- /dev/null +++ b/data/fixtures/scopes/r/functionCallee.method.scope @@ -0,0 +1,10 @@ +foo.bar() +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:7 + >-------< +0| foo.bar() + +[Insertion delimiter] = " " diff --git a/data/scopeSupportFacetInfos.md b/data/scopeSupportFacetInfos.md index 47e5f50965..3e78e4b016 100644 --- a/data/scopeSupportFacetInfos.md +++ b/data/scopeSupportFacetInfos.md @@ -1,14 +1,14 @@ ### anonymousFunction -- `anonymousFunction` An anonymous function, eg a lambda function, an arrow function, etc +- `anonymousFunction` An anonymous function, eg a lambda function, an arrow function, etc. ### argumentOrParameter -- `argument.actual.constructor.iteration` Iteration scope for arguments in a constructor call: the argument list. The domain should be the entire constructor call. +- `argument.actual.constructor.iteration` Iteration scope for arguments in a constructor call: the argument list. The domain should be the entire constructor call.. - `argument.actual.constructor.multiLine` A multi line argument in a constructor call. Insertion delimiter should include new line. - `argument.actual.constructor.singleLine` A single line argument in a constructor call - `argument.actual.iteration` Iteration scope for arguments in a function call: the argument list. The domain should be the entire function call. -- `argument.actual.method.iteration` Iteration scope for arguments in a method call: the argument list. The domain should be the entire method call. +- `argument.actual.method.iteration` Iteration scope for arguments in a method call: the argument list. The domain should be the entire method call.. - `argument.actual.method.multiLine` A multi line argument in a method call. Insertion delimiter should include new line. - `argument.actual.method.singleLine` A single line argument in a method call - `argument.actual.multiLine` A multiline argument in a function call. Insertion delimiter should include new line. @@ -144,11 +144,13 @@ - `functionCall` A function call - `functionCall.constructor` A constructor call +- `functionCall.method` A method call ### functionCallee - `functionCallee` The function being called in a function call -- `functionCallee.constructor` The class being constructed in a class instantiation, including the `new` keyword +- `functionCallee.constructor` The class being constructed in a class instantiation, including the `new` keyword. +- `functionCallee.method` The function being called in a method call, including parent objects. ### identifier diff --git a/packages/common/src/scopeSupportFacets/c.ts b/packages/common/src/scopeSupportFacets/c.ts index 00254fb17b..944f13664b 100644 --- a/packages/common/src/scopeSupportFacets/c.ts +++ b/packages/common/src/scopeSupportFacets/c.ts @@ -38,7 +38,9 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { "namedFunction.iteration.document": supported, functionCall: supported, + "functionCall.method": supported, functionCallee: supported, + "functionCallee.method": supported, "argument.actual.singleLine": supported, "argument.actual.multiLine": supported, diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index b29a4bf708..0d3d64074b 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -19,8 +19,10 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { functionCall: supported, "functionCall.constructor": supported, + "functionCall.method": supported, functionCallee: supported, "functionCallee.constructor": supported, + "functionCallee.method": supported, namedFunction: supported, "namedFunction.iteration.document": supported, diff --git a/packages/common/src/scopeSupportFacets/java.ts b/packages/common/src/scopeSupportFacets/java.ts index 52cc667fb1..601bd52c74 100644 --- a/packages/common/src/scopeSupportFacets/java.ts +++ b/packages/common/src/scopeSupportFacets/java.ts @@ -78,8 +78,10 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { functionCall: supported, "functionCall.constructor": supported, + "functionCall.method": supported, functionCallee: supported, "functionCallee.constructor": supported, + "functionCallee.method": supported, "namedFunction.constructor": supported, "namedFunction.method": supported, diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index b24b6eb73b..f7647f4ce6 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -57,8 +57,10 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { functionCall: supported, "functionCall.constructor": supported, + "functionCall.method": supported, functionCallee: supported, "functionCallee.constructor": supported, + "functionCallee.method": supported, "argument.actual.singleLine": supported, "argument.actual.multiLine": supported, diff --git a/packages/common/src/scopeSupportFacets/lua.ts b/packages/common/src/scopeSupportFacets/lua.ts index 47ca17c0f2..8410b459cc 100644 --- a/packages/common/src/scopeSupportFacets/lua.ts +++ b/packages/common/src/scopeSupportFacets/lua.ts @@ -5,13 +5,19 @@ const { supported, notApplicable } = ScopeSupportFacetLevel; export const luaScopeSupport: LanguageScopeSupportFacetMap = { tags: notApplicable, - functionCall: supported, - functionCallee: supported, map: supported, - ifStatement: supported, namedFunction: supported, disqualifyDelimiter: supported, + ifStatement: supported, + + "statement.if": supported, + + functionCall: supported, + "functionCall.method": supported, + functionCallee: supported, + "functionCallee.method": supported, + "key.attribute": notApplicable, "name.assignment": supported, diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index d9398fa385..c11b80da54 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -200,8 +200,10 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { functionCall: supported, "functionCall.constructor": supported, + "functionCall.method": supported, functionCallee: supported, "functionCallee.constructor": supported, + "functionCallee.method": supported, disqualifyDelimiter: supported, pairDelimiter: supported, diff --git a/packages/common/src/scopeSupportFacets/r.ts b/packages/common/src/scopeSupportFacets/r.ts index a810b6c9d7..75833a1983 100644 --- a/packages/common/src/scopeSupportFacets/r.ts +++ b/packages/common/src/scopeSupportFacets/r.ts @@ -25,9 +25,12 @@ export const rScopeSupport: LanguageScopeSupportFacetMap = { "argumentList.formal.lambda.singleLine": supported, "argumentList.formal.lambda.multiLine": supported, - "comment.line": supported, functionCall: supported, + "functionCall.method": supported, functionCallee: supported, + "functionCallee.method": supported, + + "comment.line": supported, ifStatement: supported, "name.assignment": supported, "name.function": supported, diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index 0218299d4e..55fb92433b 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -209,7 +209,7 @@ export const scopeSupportFacetInfos: Record< ), anonymousFunction: { description: - "An anonymous function, eg a lambda function, an arrow function, etc", + "An anonymous function, eg a lambda function, an arrow function, etc.", scopeType: "anonymousFunction", }, @@ -221,13 +221,22 @@ export const scopeSupportFacetInfos: Record< description: "A constructor call", scopeType: "functionCall", }, + "functionCall.method": { + description: "A method call", + scopeType: "functionCall", + }, functionCallee: { description: "The function being called in a function call", scopeType: "functionCallee", }, "functionCallee.constructor": { description: - "The class being constructed in a class instantiation, including the `new` keyword", + "The class being constructed in a class instantiation, including the `new` keyword.", + scopeType: "functionCallee", + }, + "functionCallee.method": { + description: + "The function being called in a method call, including parent objects.", scopeType: "functionCallee", }, @@ -257,7 +266,7 @@ export const scopeSupportFacetInfos: Record< "argument.actual.method.iteration": iteration( "argumentOrParameter", "arguments in a method call", - "the argument list. The domain should be the entire method call", + "the argument list. The domain should be the entire method call.", ), "argument.actual.constructor.singleLine": { description: "A single line argument in a constructor call", @@ -271,7 +280,7 @@ export const scopeSupportFacetInfos: Record< "argument.actual.constructor.iteration": iteration( "argumentOrParameter", "arguments in a constructor call", - "the argument list. The domain should be the entire constructor call", + "the argument list. The domain should be the entire constructor call.", ), "argument.formal.singleLine": { diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index 12892016fa..8513746cb4 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -71,8 +71,10 @@ export const scopeSupportFacets = [ "functionCall", "functionCall.constructor", + "functionCall.method", "functionCallee", "functionCallee.constructor", + "functionCallee.method", "argument.actual.singleLine", "argument.actual.multiLine", From 66dc0188a44f36c6d4478d53945af3bbdc1ccc5e Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 15:01:59 +0200 Subject: [PATCH 15/18] Talon function calls --- .../scopes/talon/functionCall.method.scope | 17 +++++++++++++++++ data/fixtures/scopes/talon/functionCall.scope | 16 ++++++++-------- .../scopes/talon/functionCallee.method.scope | 17 +++++++++++++++++ data/fixtures/scopes/talon/functionCallee.scope | 16 ++++++++-------- packages/common/src/scopeSupportFacets/css.ts | 6 ++++-- packages/common/src/scopeSupportFacets/html.ts | 6 ++++-- packages/common/src/scopeSupportFacets/json.ts | 6 ++++-- .../common/src/scopeSupportFacets/markdown.ts | 6 ++++-- packages/common/src/scopeSupportFacets/scm.ts | 6 ++++-- packages/common/src/scopeSupportFacets/talon.ts | 2 ++ packages/common/src/scopeSupportFacets/xml.ts | 6 ++++-- packages/common/src/scopeSupportFacets/yaml.ts | 6 ++++-- 12 files changed, 80 insertions(+), 30 deletions(-) create mode 100644 data/fixtures/scopes/talon/functionCall.method.scope create mode 100644 data/fixtures/scopes/talon/functionCallee.method.scope diff --git a/data/fixtures/scopes/talon/functionCall.method.scope b/data/fixtures/scopes/talon/functionCall.method.scope new file mode 100644 index 0000000000..2fa559053b --- /dev/null +++ b/data/fixtures/scopes/talon/functionCall.method.scope @@ -0,0 +1,17 @@ +foo: bar.baz() +--- + +[Content] = +[Domain] = 0:5-0:14 + >---------< +0| foo: bar.baz() + +[Removal] = 0:4-0:14 + >----------< +0| foo: bar.baz() + +[Leading delimiter] = 0:4-0:5 + >-< +0| foo: bar.baz() + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/talon/functionCall.scope b/data/fixtures/scopes/talon/functionCall.scope index fe111e9015..2de61468a7 100644 --- a/data/fixtures/scopes/talon/functionCall.scope +++ b/data/fixtures/scopes/talon/functionCall.scope @@ -1,17 +1,17 @@ -foo: skip() +foo: bar() --- [Content] = -[Domain] = 0:5-0:11 - >------< -0| foo: skip() +[Domain] = 0:5-0:10 + >-----< +0| foo: bar() -[Removal] = 0:4-0:11 - >-------< -0| foo: skip() +[Removal] = 0:4-0:10 + >------< +0| foo: bar() [Leading delimiter] = 0:4-0:5 >-< -0| foo: skip() +0| foo: bar() [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/talon/functionCallee.method.scope b/data/fixtures/scopes/talon/functionCallee.method.scope new file mode 100644 index 0000000000..f9e5c17dce --- /dev/null +++ b/data/fixtures/scopes/talon/functionCallee.method.scope @@ -0,0 +1,17 @@ +foo: bar.baz() +--- + +[Content] = +[Removal] = 0:5-0:12 + >-------< +0| foo: bar.baz() + +[Leading delimiter] = 0:4-0:5 + >-< +0| foo: bar.baz() + +[Domain] = 0:5-0:14 + >---------< +0| foo: bar.baz() + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/talon/functionCallee.scope b/data/fixtures/scopes/talon/functionCallee.scope index 2c6e7ef907..565cc7c259 100644 --- a/data/fixtures/scopes/talon/functionCallee.scope +++ b/data/fixtures/scopes/talon/functionCallee.scope @@ -1,17 +1,17 @@ -foo: skip() +foo: bar() --- [Content] = -[Removal] = 0:5-0:9 - >----< -0| foo: skip() +[Removal] = 0:5-0:8 + >---< +0| foo: bar() [Leading delimiter] = 0:4-0:5 >-< -0| foo: skip() +0| foo: bar() -[Domain] = 0:5-0:11 - >------< -0| foo: skip() +[Domain] = 0:5-0:10 + >-----< +0| foo: bar() [Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/css.ts b/packages/common/src/scopeSupportFacets/css.ts index cd811af1b4..e58f96723d 100644 --- a/packages/common/src/scopeSupportFacets/css.ts +++ b/packages/common/src/scopeSupportFacets/css.ts @@ -75,8 +75,6 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { // Constructor "statement.constructor": notApplicable, "namedFunction.constructor": notApplicable, - "functionCall.constructor": notApplicable, - "functionCallee.constructor": notApplicable, "argument.actual.constructor.singleLine": notApplicable, "argument.actual.constructor.multiLine": notApplicable, "argument.actual.constructor.iteration": notApplicable, @@ -97,6 +95,8 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.constructor.iteration": notApplicable, "value.argument.formal.constructor": notApplicable, "value.argument.formal.constructor.iteration": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, // Method "statement.method": notApplicable, @@ -121,6 +121,8 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method.iteration": notApplicable, "value.argument.formal.method": notApplicable, "value.argument.formal.method.iteration": notApplicable, + "functionCall.method": notApplicable, + "functionCallee.method": notApplicable, // Function namedFunction: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/html.ts b/packages/common/src/scopeSupportFacets/html.ts index 8c4557d360..dcf81e3748 100644 --- a/packages/common/src/scopeSupportFacets/html.ts +++ b/packages/common/src/scopeSupportFacets/html.ts @@ -52,8 +52,6 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { // Constructor "statement.constructor": notApplicable, "namedFunction.constructor": notApplicable, - "functionCall.constructor": notApplicable, - "functionCallee.constructor": notApplicable, "argument.actual.constructor.singleLine": notApplicable, "argument.actual.constructor.multiLine": notApplicable, "argument.actual.constructor.iteration": notApplicable, @@ -74,6 +72,8 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.constructor.iteration": notApplicable, "value.argument.formal.constructor": notApplicable, "value.argument.formal.constructor.iteration": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, // Method "statement.method": notApplicable, @@ -98,6 +98,8 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method.iteration": notApplicable, "value.argument.formal.method": notApplicable, "value.argument.formal.method.iteration": notApplicable, + "functionCall.method": notApplicable, + "functionCallee.method": notApplicable, // Function namedFunction: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/json.ts b/packages/common/src/scopeSupportFacets/json.ts index 08135ca5a8..637f851562 100644 --- a/packages/common/src/scopeSupportFacets/json.ts +++ b/packages/common/src/scopeSupportFacets/json.ts @@ -55,8 +55,6 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { // Constructor "statement.constructor": notApplicable, "namedFunction.constructor": notApplicable, - "functionCall.constructor": notApplicable, - "functionCallee.constructor": notApplicable, "argument.actual.constructor.singleLine": notApplicable, "argument.actual.constructor.multiLine": notApplicable, "argument.actual.constructor.iteration": notApplicable, @@ -77,6 +75,8 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.constructor.iteration": notApplicable, "value.argument.formal.constructor": notApplicable, "value.argument.formal.constructor.iteration": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, // Method "statement.method": notApplicable, @@ -101,6 +101,8 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method.iteration": notApplicable, "value.argument.formal.method": notApplicable, "value.argument.formal.method.iteration": notApplicable, + "functionCall.method": notApplicable, + "functionCallee.method": notApplicable, // Function namedFunction: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/markdown.ts b/packages/common/src/scopeSupportFacets/markdown.ts index c40bfe94d1..5d083c1d28 100644 --- a/packages/common/src/scopeSupportFacets/markdown.ts +++ b/packages/common/src/scopeSupportFacets/markdown.ts @@ -53,8 +53,6 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { // Constructor "statement.constructor": notApplicable, "namedFunction.constructor": notApplicable, - "functionCall.constructor": notApplicable, - "functionCallee.constructor": notApplicable, "argument.actual.constructor.singleLine": notApplicable, "argument.actual.constructor.multiLine": notApplicable, "argument.actual.constructor.iteration": notApplicable, @@ -75,6 +73,8 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.constructor.iteration": notApplicable, "value.argument.formal.constructor": notApplicable, "value.argument.formal.constructor.iteration": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, // Method "statement.method": notApplicable, @@ -99,6 +99,8 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method.iteration": notApplicable, "value.argument.formal.method": notApplicable, "value.argument.formal.method.iteration": notApplicable, + "functionCall.method": notApplicable, + "functionCallee.method": notApplicable, // Function namedFunction: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/scm.ts b/packages/common/src/scopeSupportFacets/scm.ts index a8e7c2f416..a627cd6bb4 100644 --- a/packages/common/src/scopeSupportFacets/scm.ts +++ b/packages/common/src/scopeSupportFacets/scm.ts @@ -57,8 +57,6 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { // Constructor "statement.constructor": notApplicable, "namedFunction.constructor": notApplicable, - "functionCall.constructor": notApplicable, - "functionCallee.constructor": notApplicable, "argument.actual.constructor.singleLine": notApplicable, "argument.actual.constructor.multiLine": notApplicable, "argument.actual.constructor.iteration": notApplicable, @@ -79,6 +77,8 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.constructor.iteration": notApplicable, "value.argument.formal.constructor": notApplicable, "value.argument.formal.constructor.iteration": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, // Method "statement.method": notApplicable, @@ -103,6 +103,8 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method.iteration": notApplicable, "value.argument.formal.method": notApplicable, "value.argument.formal.method.iteration": notApplicable, + "functionCall.method": notApplicable, + "functionCallee.method": notApplicable, // Function namedFunction: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index 2edc82606b..e7e524e56d 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -48,6 +48,8 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { functionCall: supported, functionCallee: supported, + "functionCall.method": supported, + "functionCallee.method": supported, /* UNSUPPORTED */ diff --git a/packages/common/src/scopeSupportFacets/xml.ts b/packages/common/src/scopeSupportFacets/xml.ts index 1ea0107560..1b7b88c1c9 100644 --- a/packages/common/src/scopeSupportFacets/xml.ts +++ b/packages/common/src/scopeSupportFacets/xml.ts @@ -52,8 +52,6 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { // Constructor "statement.constructor": notApplicable, "namedFunction.constructor": notApplicable, - "functionCall.constructor": notApplicable, - "functionCallee.constructor": notApplicable, "argument.actual.constructor.singleLine": notApplicable, "argument.actual.constructor.multiLine": notApplicable, "argument.actual.constructor.iteration": notApplicable, @@ -74,6 +72,8 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.constructor.iteration": notApplicable, "value.argument.formal.constructor": notApplicable, "value.argument.formal.constructor.iteration": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, // Method "statement.method": notApplicable, @@ -98,6 +98,8 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method.iteration": notApplicable, "value.argument.formal.method": notApplicable, "value.argument.formal.method.iteration": notApplicable, + "functionCall.method": notApplicable, + "functionCallee.method": notApplicable, // Function namedFunction: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/yaml.ts b/packages/common/src/scopeSupportFacets/yaml.ts index c9254b715c..5ab4c73fb4 100644 --- a/packages/common/src/scopeSupportFacets/yaml.ts +++ b/packages/common/src/scopeSupportFacets/yaml.ts @@ -61,8 +61,6 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { // Constructor "statement.constructor": notApplicable, "namedFunction.constructor": notApplicable, - "functionCall.constructor": notApplicable, - "functionCallee.constructor": notApplicable, "argument.actual.constructor.singleLine": notApplicable, "argument.actual.constructor.multiLine": notApplicable, "argument.actual.constructor.iteration": notApplicable, @@ -83,6 +81,8 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.constructor.iteration": notApplicable, "value.argument.formal.constructor": notApplicable, "value.argument.formal.constructor.iteration": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, // Method "statement.method": notApplicable, @@ -107,6 +107,8 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method.iteration": notApplicable, "value.argument.formal.method": notApplicable, "value.argument.formal.method.iteration": notApplicable, + "functionCall.method": notApplicable, + "functionCallee.method": notApplicable, // Function namedFunction: notApplicable, From 18263923c4f16dca01be254cba1f03fa3f1c2252 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 15:19:16 +0200 Subject: [PATCH 16/18] Update function callee domains --- .../scopes/java/functionCallee.constructor.scope | 4 ++-- .../scopes/java/functionCallee.method.scope | 4 ++-- data/fixtures/scopes/java/functionCallee.scope | 4 ++-- data/fixtures/scopes/lua/ifStatement.scope | 14 ++++---------- data/fixtures/scopes/lua/statement.if.scope | 14 ++++---------- data/fixtures/scopes/r/functionCallee.method.scope | 7 +++++-- data/fixtures/scopes/r/functionCallee.scope | 7 +++++-- queries/java.scm | 10 ++++------ queries/lua.scm | 2 +- queries/r.scm | 2 +- 10 files changed, 30 insertions(+), 38 deletions(-) diff --git a/data/fixtures/scopes/java/functionCallee.constructor.scope b/data/fixtures/scopes/java/functionCallee.constructor.scope index e23818aa3d..81ac744168 100644 --- a/data/fixtures/scopes/java/functionCallee.constructor.scope +++ b/data/fixtures/scopes/java/functionCallee.constructor.scope @@ -6,8 +6,8 @@ new Foo(); >-------< 0| new Foo(); -[Domain] = 0:0-0:10 - >----------< +[Domain] = 0:0-0:9 + >---------< 0| new Foo(); [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/functionCallee.method.scope b/data/fixtures/scopes/java/functionCallee.method.scope index 51400cfb94..f30f0f7536 100644 --- a/data/fixtures/scopes/java/functionCallee.method.scope +++ b/data/fixtures/scopes/java/functionCallee.method.scope @@ -6,8 +6,8 @@ foo.bar(); >-------< 0| foo.bar(); -[Domain] = 0:0-0:10 - >----------< +[Domain] = 0:0-0:9 + >---------< 0| foo.bar(); [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/functionCallee.scope b/data/fixtures/scopes/java/functionCallee.scope index 0dbddcd146..3071a48ae9 100644 --- a/data/fixtures/scopes/java/functionCallee.scope +++ b/data/fixtures/scopes/java/functionCallee.scope @@ -6,8 +6,8 @@ foo(); >---< 0| foo(); -[Domain] = 0:0-0:6 - >------< +[Domain] = 0:0-0:5 + >-----< 0| foo(); [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/lua/ifStatement.scope b/data/fixtures/scopes/lua/ifStatement.scope index f92c2b599b..6b4ce6eac9 100644 --- a/data/fixtures/scopes/lua/ifStatement.scope +++ b/data/fixtures/scopes/lua/ifStatement.scope @@ -1,23 +1,17 @@ if true then - a = 1 elseif false then - a = 2 else - a = 3 end --- [Content] = [Removal] = -[Domain] = 0:0-6:3 +[Domain] = 0:0-3:3 >------------ 0| if true then -1| a = 1 -2| elseif false then -3| a = 2 -4| else -5| a = 3 -6| end +1| elseif false then +2| else +3| end ---< [Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/lua/statement.if.scope b/data/fixtures/scopes/lua/statement.if.scope index f92c2b599b..6b4ce6eac9 100644 --- a/data/fixtures/scopes/lua/statement.if.scope +++ b/data/fixtures/scopes/lua/statement.if.scope @@ -1,23 +1,17 @@ if true then - a = 1 elseif false then - a = 2 else - a = 3 end --- [Content] = [Removal] = -[Domain] = 0:0-6:3 +[Domain] = 0:0-3:3 >------------ 0| if true then -1| a = 1 -2| elseif false then -3| a = 2 -4| else -5| a = 3 -6| end +1| elseif false then +2| else +3| end ---< [Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/r/functionCallee.method.scope b/data/fixtures/scopes/r/functionCallee.method.scope index 2afce1289c..e77bc361ec 100644 --- a/data/fixtures/scopes/r/functionCallee.method.scope +++ b/data/fixtures/scopes/r/functionCallee.method.scope @@ -2,9 +2,12 @@ foo.bar() --- [Content] = -[Removal] = -[Domain] = 0:0-0:7 +[Removal] = 0:0-0:7 >-------< 0| foo.bar() +[Domain] = 0:0-0:9 + >---------< +0| foo.bar() + [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/r/functionCallee.scope b/data/fixtures/scopes/r/functionCallee.scope index 1db3ea550d..2b075b5c33 100644 --- a/data/fixtures/scopes/r/functionCallee.scope +++ b/data/fixtures/scopes/r/functionCallee.scope @@ -2,9 +2,12 @@ foo() --- [Content] = -[Removal] = -[Domain] = 0:0-0:3 +[Removal] = 0:0-0:3 >---< 0| foo() +[Domain] = 0:0-0:5 + >-----< +0| foo() + [Insertion delimiter] = " " diff --git a/queries/java.scm b/queries/java.scm index 09a72a2a4a..7fe3ba595b 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -397,22 +397,20 @@ ;;!! new test(); ;;! ^^^^^^^^ -;;! ----------- +;;! ---------- (_ (object_creation_expression (argument_list) @functionCallee.end.startOf - ) @functionCallee.start.startOf @_.domain.start - ";"? @_.domain.end + ) @functionCallee.start.startOf @_.domain ) ;;!! new test().bar(); ;;! ^^^^^^^^^^^^^^ -;;! ----------------- +;;! ---------------- (_ (method_invocation (argument_list) @functionCallee.end.startOf - ) @functionCallee.start.startOf @_.domain.start - ";"? @_.domain.end + ) @functionCallee.start.startOf @_.domain ) ;;!! super(); diff --git a/queries/lua.scm b/queries/lua.scm index 934614788d..ed6c682f60 100644 --- a/queries/lua.scm +++ b/queries/lua.scm @@ -51,7 +51,7 @@ (if_statement "if" @interior.domain.start condition: (_) @condition - consequence: (_) @interior @interior.domain.end + consequence: (_)? @interior @interior.domain.end ) @ifStatement @condition.domain @branch.iteration ;;!! if true then end diff --git a/queries/r.scm b/queries/r.scm index c5ea2c3109..0de9ecff10 100644 --- a/queries/r.scm +++ b/queries/r.scm @@ -142,7 +142,7 @@ ;;! ----- (call (identifier) @functionCallee -) +) @_.domain ;; Technically lists and arrays are just calls to the function `list` or `c` ;;!! list(1, 2, 3) From 35e1830d0f2bfb1ef57f306cebb77bf0ce53bfa8 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 15:25:44 +0200 Subject: [PATCH 17/18] Sort iteration scopes last --- .../src/docs/components/ScopeVisualizer.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/cursorless-org-docs/src/docs/components/ScopeVisualizer.tsx b/packages/cursorless-org-docs/src/docs/components/ScopeVisualizer.tsx index 9a658a2661..1d8653af02 100644 --- a/packages/cursorless-org-docs/src/docs/components/ScopeVisualizer.tsx +++ b/packages/cursorless-org-docs/src/docs/components/ScopeVisualizer.tsx @@ -292,7 +292,7 @@ function getScopeFixtures( Object.values(scopeMap) .sort(nameComparator) .forEach((scope) => { - scope.facets.sort(nameComparator); + scope.facets.sort(facetComparator); scope.facets.forEach((f) => f.fixtures.sort(nameComparator)); if (scopeTypeType == null && isScopeInternal(scope.scopeTypeType)) { result.internal.push(scope); @@ -303,3 +303,13 @@ function getScopeFixtures( return result; } + +export function facetComparator(a: Facet, b: Facet): number { + if (a.info.isIteration && !b.info.isIteration) { + return 1; + } + if (!a.info.isIteration && b.info.isIteration) { + return -1; + } + return nameComparator(a, b); +} From 0dfed5ac6918da1def064b7262e42c095b5a55e2 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 15 Jul 2025 15:31:51 +0200 Subject: [PATCH 18/18] Remove pass from statements --- .../python/statement/statement.class.scope | 24 ++------ .../python/statement/statement.class2.scope | 24 ++------ .../statement/statement.constructor.scope | 16 ------ .../python/statement/statement.foreach.scope | 24 ++------ .../python/statement/statement.function.scope | 24 ++------ .../statement/statement.function2.scope | 24 ++------ .../python/statement/statement.if.scope | 56 ++----------------- .../python/statement/statement.method.scope | 16 ------ .../python/statement/statement.misc.scope | 10 ---- .../python/statement/statement.resource.scope | 24 ++------ .../python/statement/statement.try.scope | 56 ++----------------- .../python/statement/statement.while.scope | 24 ++------ .../common/src/scopeSupportFacets/python.ts | 2 +- queries/python.scm | 3 +- 14 files changed, 39 insertions(+), 288 deletions(-) delete mode 100644 data/fixtures/scopes/python/statement/statement.misc.scope diff --git a/data/fixtures/scopes/python/statement/statement.class.scope b/data/fixtures/scopes/python/statement/statement.class.scope index 6e714329a2..d9d94dbe6b 100644 --- a/data/fixtures/scopes/python/statement/statement.class.scope +++ b/data/fixtures/scopes/python/statement/statement.class.scope @@ -1,26 +1,10 @@ class Foo: pass --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-0:15 +[Content] = +[Removal] = +[Domain] = 0:0-0:15 >---------------< 0| class Foo: pass -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 0:11-0:15 - >----< -0| class Foo: pass - -[#2 Removal] = 0:10-0:15 - >-----< -0| class Foo: pass - -[#2 Leading delimiter] = 0:10-0:11 - >-< -0| class Foo: pass - -[#2 Insertion delimiter] = "\n" +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.class2.scope b/data/fixtures/scopes/python/statement/statement.class2.scope index e0bce1d5d0..8c1d393c2e 100644 --- a/data/fixtures/scopes/python/statement/statement.class2.scope +++ b/data/fixtures/scopes/python/statement/statement.class2.scope @@ -2,28 +2,12 @@ class Foo: pass --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-1:15 +[Content] = +[Removal] = +[Domain] = 0:0-1:15 >---- 0| @bar 1| class Foo: pass ---------------< -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 1:11-1:15 - >----< -1| class Foo: pass - -[#2 Removal] = 1:10-1:15 - >-----< -1| class Foo: pass - -[#2 Leading delimiter] = 1:10-1:11 - >-< -1| class Foo: pass - -[#2 Insertion delimiter] = "\n" +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.constructor.scope b/data/fixtures/scopes/python/statement/statement.constructor.scope index d7f995ea57..e07371db71 100644 --- a/data/fixtures/scopes/python/statement/statement.constructor.scope +++ b/data/fixtures/scopes/python/statement/statement.constructor.scope @@ -29,19 +29,3 @@ class Foo: 1| def __init__(self): pass [#2 Insertion delimiter] = "\n" - - -[#3 Content] = -[#3 Domain] = 1:24-1:28 - >----< -1| def __init__(self): pass - -[#3 Removal] = 1:23-1:28 - >-----< -1| def __init__(self): pass - -[#3 Leading delimiter] = 1:23-1:24 - >-< -1| def __init__(self): pass - -[#3 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.foreach.scope b/data/fixtures/scopes/python/statement/statement.foreach.scope index d1a78f3b11..a37c516a89 100644 --- a/data/fixtures/scopes/python/statement/statement.foreach.scope +++ b/data/fixtures/scopes/python/statement/statement.foreach.scope @@ -1,26 +1,10 @@ for v in values: pass --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-0:21 +[Content] = +[Removal] = +[Domain] = 0:0-0:21 >---------------------< 0| for v in values: pass -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 0:17-0:21 - >----< -0| for v in values: pass - -[#2 Removal] = 0:16-0:21 - >-----< -0| for v in values: pass - -[#2 Leading delimiter] = 0:16-0:17 - >-< -0| for v in values: pass - -[#2 Insertion delimiter] = "\n" +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.function.scope b/data/fixtures/scopes/python/statement/statement.function.scope index 852827d460..3b29fb8bb6 100644 --- a/data/fixtures/scopes/python/statement/statement.function.scope +++ b/data/fixtures/scopes/python/statement/statement.function.scope @@ -1,26 +1,10 @@ def foo(): pass --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-0:15 +[Content] = +[Removal] = +[Domain] = 0:0-0:15 >---------------< 0| def foo(): pass -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 0:11-0:15 - >----< -0| def foo(): pass - -[#2 Removal] = 0:10-0:15 - >-----< -0| def foo(): pass - -[#2 Leading delimiter] = 0:10-0:11 - >-< -0| def foo(): pass - -[#2 Insertion delimiter] = "\n" +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.function2.scope b/data/fixtures/scopes/python/statement/statement.function2.scope index 8c51f4b225..7fd1a0645e 100644 --- a/data/fixtures/scopes/python/statement/statement.function2.scope +++ b/data/fixtures/scopes/python/statement/statement.function2.scope @@ -2,28 +2,12 @@ def foo(): pass --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-1:15 +[Content] = +[Removal] = +[Domain] = 0:0-1:15 >---- 0| @bar 1| def foo(): pass ---------------< -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 1:11-1:15 - >----< -1| def foo(): pass - -[#2 Removal] = 1:10-1:15 - >-----< -1| def foo(): pass - -[#2 Leading delimiter] = 1:10-1:11 - >-< -1| def foo(): pass - -[#2 Insertion delimiter] = "\n" +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.if.scope b/data/fixtures/scopes/python/statement/statement.if.scope index 42b3b554e0..16b00e99dc 100644 --- a/data/fixtures/scopes/python/statement/statement.if.scope +++ b/data/fixtures/scopes/python/statement/statement.if.scope @@ -3,61 +3,13 @@ elif False: pass else: pass --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-2:10 +[Content] = +[Removal] = +[Domain] = 0:0-2:10 >------------- 0| if True: pass 1| elif False: pass 2| else: pass ----------< -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 0:9-0:13 - >----< -0| if True: pass - -[#2 Removal] = 0:8-0:13 - >-----< -0| if True: pass - -[#2 Leading delimiter] = 0:8-0:9 - >-< -0| if True: pass - -[#2 Insertion delimiter] = "\n" - - -[#3 Content] = -[#3 Domain] = 1:12-1:16 - >----< -1| elif False: pass - -[#3 Removal] = 1:11-1:16 - >-----< -1| elif False: pass - -[#3 Leading delimiter] = 1:11-1:12 - >-< -1| elif False: pass - -[#3 Insertion delimiter] = "\n" - - -[#4 Content] = -[#4 Domain] = 2:6-2:10 - >----< -2| else: pass - -[#4 Removal] = 2:5-2:10 - >-----< -2| else: pass - -[#4 Leading delimiter] = 2:5-2:6 - >-< -2| else: pass - -[#4 Insertion delimiter] = "\n" +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.method.scope b/data/fixtures/scopes/python/statement/statement.method.scope index 347fde98a6..c2c7e6ff5a 100644 --- a/data/fixtures/scopes/python/statement/statement.method.scope +++ b/data/fixtures/scopes/python/statement/statement.method.scope @@ -29,19 +29,3 @@ class Foo: 1| def bar(): pass [#2 Insertion delimiter] = "\n" - - -[#3 Content] = -[#3 Domain] = 1:15-1:19 - >----< -1| def bar(): pass - -[#3 Removal] = 1:14-1:19 - >-----< -1| def bar(): pass - -[#3 Leading delimiter] = 1:14-1:15 - >-< -1| def bar(): pass - -[#3 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.misc.scope b/data/fixtures/scopes/python/statement/statement.misc.scope deleted file mode 100644 index c6258214b4..0000000000 --- a/data/fixtures/scopes/python/statement/statement.misc.scope +++ /dev/null @@ -1,10 +0,0 @@ -pass ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:4 - >----< -0| pass - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.resource.scope b/data/fixtures/scopes/python/statement/statement.resource.scope index 143737dd0f..a2280cc5e3 100644 --- a/data/fixtures/scopes/python/statement/statement.resource.scope +++ b/data/fixtures/scopes/python/statement/statement.resource.scope @@ -1,26 +1,10 @@ with foo as bar: pass --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-0:21 +[Content] = +[Removal] = +[Domain] = 0:0-0:21 >---------------------< 0| with foo as bar: pass -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 0:17-0:21 - >----< -0| with foo as bar: pass - -[#2 Removal] = 0:16-0:21 - >-----< -0| with foo as bar: pass - -[#2 Leading delimiter] = 0:16-0:17 - >-< -0| with foo as bar: pass - -[#2 Insertion delimiter] = "\n" +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.try.scope b/data/fixtures/scopes/python/statement/statement.try.scope index 86972af94e..fb84ec8b94 100644 --- a/data/fixtures/scopes/python/statement/statement.try.scope +++ b/data/fixtures/scopes/python/statement/statement.try.scope @@ -3,61 +3,13 @@ except: pass finally: pass --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-2:13 +[Content] = +[Removal] = +[Domain] = 0:0-2:13 >--------- 0| try: pass 1| except: pass 2| finally: pass -------------< -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 0:5-0:9 - >----< -0| try: pass - -[#2 Removal] = 0:4-0:9 - >-----< -0| try: pass - -[#2 Leading delimiter] = 0:4-0:5 - >-< -0| try: pass - -[#2 Insertion delimiter] = "\n" - - -[#3 Content] = -[#3 Domain] = 1:8-1:12 - >----< -1| except: pass - -[#3 Removal] = 1:7-1:12 - >-----< -1| except: pass - -[#3 Leading delimiter] = 1:7-1:8 - >-< -1| except: pass - -[#3 Insertion delimiter] = "\n" - - -[#4 Content] = -[#4 Domain] = 2:9-2:13 - >----< -2| finally: pass - -[#4 Removal] = 2:8-2:13 - >-----< -2| finally: pass - -[#4 Leading delimiter] = 2:8-2:9 - >-< -2| finally: pass - -[#4 Insertion delimiter] = "\n" +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/statement/statement.while.scope b/data/fixtures/scopes/python/statement/statement.while.scope index bef9c5c662..8e1548fe9d 100644 --- a/data/fixtures/scopes/python/statement/statement.while.scope +++ b/data/fixtures/scopes/python/statement/statement.while.scope @@ -1,26 +1,10 @@ while True: pass --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-0:16 +[Content] = +[Removal] = +[Domain] = 0:0-0:16 >----------------< 0| while True: pass -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 0:12-0:16 - >----< -0| while True: pass - -[#2 Removal] = 0:11-0:16 - >-----< -0| while True: pass - -[#2 Leading delimiter] = 0:11-0:12 - >-< -0| while True: pass - -[#2 Insertion delimiter] = "\n" +[Insertion delimiter] = "\n" diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index c11b80da54..c28fb6a87d 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -193,7 +193,6 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { "statement.break": supported, "statement.continue": supported, "statement.resource": supported, - "statement.misc": supported, "statement.iteration.document": supported, "statement.iteration.class": supported, "statement.iteration.block": supported, @@ -300,6 +299,7 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { "statement.static": notApplicable, // Miscellaneous + "statement.misc": notApplicable, environment: notApplicable, regularExpression: notApplicable, selector: notApplicable, diff --git a/queries/python.scm b/queries/python.scm index d5a6c99c5c..896f05f81c 100644 --- a/queries/python.scm +++ b/queries/python.scm @@ -20,13 +20,14 @@ (import_statement) (match_statement) (nonlocal_statement) - (pass_statement) (print_statement) (raise_statement) (return_statement) (try_statement) (while_statement) (with_statement) + ;; Disabled on purpose. We don't think this is a statement. + ;; (pass_statement) ;; Disabled on purpose. We have a better definition for these below. ;; (class_definition) ;; (function_definition)