From 4aff72ea8c026f0fbe5555310f3c8b570a3b5adb Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 30 Jun 2025 11:52:54 +0200 Subject: [PATCH 1/7] Condition --- .../fixtures/scopes/csharp/condition.if.scope | 35 +++++++++---- data/fixtures/scopes/java/condition.if.scope | 35 +++++++++---- .../scopes/javascript.core/condition.if.scope | 38 +++++++++----- .../fixtures/scopes/python/condition.if.scope | 51 +++++++++++++------ data/fixtures/scopes/scss/condition.if.scope | 40 +++++++-------- queries/csharp.scm | 14 +++-- 6 files changed, 142 insertions(+), 71 deletions(-) diff --git a/data/fixtures/scopes/csharp/condition.if.scope b/data/fixtures/scopes/csharp/condition.if.scope index 1c6f3662ee..4f5ac14fc6 100644 --- a/data/fixtures/scopes/csharp/condition.if.scope +++ b/data/fixtures/scopes/csharp/condition.if.scope @@ -1,13 +1,30 @@ -if (1 < 5) { } +if (true) {} +else if (false) {} +else {} --- -[Content] = -[Removal] = 0:4-0:9 - >-----< -0| if (1 < 5) { } +[#1 Content] = +[#1 Removal] = 0:4-0:8 + >----< +0| if (true) {} -[Domain] = 0:0-0:14 - >--------------< -0| if (1 < 5) { } +[#1 Domain] = 0:0-2:7 + >------------ +0| if (true) {} +1| else if (false) {} +2| else {} + -------< -[Insertion delimiter] = " " +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 1:9-1:14 + >-----< +1| else if (false) {} + +[#2 Domain] = 1:0-1:18 + >------------------< +1| else if (false) {} + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/condition.if.scope b/data/fixtures/scopes/java/condition.if.scope index b1ee077a52..4f5ac14fc6 100644 --- a/data/fixtures/scopes/java/condition.if.scope +++ b/data/fixtures/scopes/java/condition.if.scope @@ -1,13 +1,30 @@ -if (value != null) { } +if (true) {} +else if (false) {} +else {} --- -[Content] = -[Removal] = 0:4-0:17 - >-------------< -0| if (value != null) { } +[#1 Content] = +[#1 Removal] = 0:4-0:8 + >----< +0| if (true) {} -[Domain] = 0:0-0:22 - >----------------------< -0| if (value != null) { } +[#1 Domain] = 0:0-2:7 + >------------ +0| if (true) {} +1| else if (false) {} +2| else {} + -------< -[Insertion delimiter] = " " +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 1:9-1:14 + >-----< +1| else if (false) {} + +[#2 Domain] = 1:0-1:18 + >------------------< +1| else if (false) {} + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/condition.if.scope b/data/fixtures/scopes/javascript.core/condition.if.scope index 6c1a02e37f..4f5ac14fc6 100644 --- a/data/fixtures/scopes/javascript.core/condition.if.scope +++ b/data/fixtures/scopes/javascript.core/condition.if.scope @@ -1,18 +1,30 @@ -if (true) { - -} +if (true) {} +else if (false) {} +else {} --- -[Content] = -[Removal] = 0:4-0:8 +[#1 Content] = +[#1 Removal] = 0:4-0:8 >----< -0| if (true) { +0| if (true) {} + +[#1 Domain] = 0:0-2:7 + >------------ +0| if (true) {} +1| else if (false) {} +2| else {} + -------< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 1:9-1:14 + >-----< +1| else if (false) {} -[Domain] = 0:0-2:1 - >----------- -0| if (true) { -1| -2| } - -< +[#2 Domain] = 1:0-1:18 + >------------------< +1| else if (false) {} -[Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/condition.if.scope b/data/fixtures/scopes/python/condition.if.scope index dca70c6da9..cc5072c278 100644 --- a/data/fixtures/scopes/python/condition.if.scope +++ b/data/fixtures/scopes/python/condition.if.scope @@ -1,23 +1,44 @@ -if value > 0: - pass +if True: pass +elif False: pass +else: pass --- -[Content] = 0:3-0:12 - >---------< -0| if value > 0: +[#1 Content] = 0:3-0:7 + >----< +0| if True: pass -[Removal] = 0:2-0:12 - >----------< -0| if value > 0: +[#1 Removal] = 0:2-0:7 + >-----< +0| if True: pass -[Leading delimiter] = 0:2-0:3 +[#1 Leading delimiter] = 0:2-0:3 >-< -0| if value > 0: +0| if True: pass -[Domain] = 0:0-1:8 +[#1 Domain] = 0:0-2:10 >------------- -0| if value > 0: -1| pass - --------< +0| if True: pass +1| elif False: pass +2| else: pass + ----------< -[Insertion delimiter] = " " +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:5-1:10 + >-----< +1| elif False: pass + +[#2 Removal] = 1:4-1:10 + >------< +1| elif False: pass + +[#2 Leading delimiter] = 1:4-1:5 + >-< +1| elif False: pass + +[#2 Domain] = 1:0-1:16 + >----------------< +1| elif False: pass + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/scss/condition.if.scope b/data/fixtures/scopes/scss/condition.if.scope index 2d5f851b07..acac443f85 100644 --- a/data/fixtures/scopes/scss/condition.if.scope +++ b/data/fixtures/scopes/scss/condition.if.scope @@ -1,52 +1,52 @@ -@if true { } -@else if false { } -@else { } +@if true {} +@else if false {} +@else {} --- [#1 Content] = 0:4-0:8 >----< -0| @if true { } +0| @if true {} [#1 Removal] = 0:4-0:9 >-----< -0| @if true { } +0| @if true {} [#1 Leading delimiter] = 0:3-0:4 >-< -0| @if true { } +0| @if true {} [#1 Trailing delimiter] = 0:8-0:9 >-< -0| @if true { } +0| @if true {} -[#1 Domain] = 0:0-2:9 - >------------ -0| @if true { } -1| @else if false { } -2| @else { } - ---------< +[#1 Domain] = 0:0-2:8 + >----------- +0| @if true {} +1| @else if false {} +2| @else {} + --------< [#1 Insertion delimiter] = " " [#2 Content] = 1:9-1:14 >-----< -1| @else if false { } +1| @else if false {} [#2 Removal] = 1:9-1:15 >------< -1| @else if false { } +1| @else if false {} [#2 Leading delimiter] = 1:8-1:9 >-< -1| @else if false { } +1| @else if false {} [#2 Trailing delimiter] = 1:14-1:15 >-< -1| @else if false { } +1| @else if false {} -[#2 Domain] = 1:0-1:18 - >------------------< -1| @else if false { } +[#2 Domain] = 1:0-1:17 + >-----------------< +1| @else if false {} [#2 Insertion delimiter] = " " diff --git a/queries/csharp.scm b/queries/csharp.scm index 8ce523b471..df1ff49428 100644 --- a/queries/csharp.scm +++ b/queries/csharp.scm @@ -48,8 +48,6 @@ (yield_statement) ] @statement -(if_statement) @ifStatement - ( (compilation_unit) @statement.iteration @class.iteration @className.iteration (#document-range! @statement.iteration @class.iteration @className.iteration) @@ -67,6 +65,10 @@ ) ) +;;!! if () {} +;;! ^^^^^^^^ +(if_statement) @ifStatement + ;;!! if () {} ;;! ^^^^^^^^ ( @@ -75,7 +77,7 @@ consequence: (_) @branch.end.endOf @branch.removal.end.endOf alternative: (_)? @branch.removal.end.startOf ) @branch.start.startOf @branch.removal.start.startOf @condition.domain - (#not-parent-type? @condition.domain "if_statement") + (#not-parent-type? @condition.domain if_statement) ) ( (if_statement @@ -84,7 +86,7 @@ "}" @interior.end.startOf ) @interior.domain.end.endOf ) @interior.domain.start.startOf - (#not-parent-type? @interior.domain.start.startOf "if_statement") + (#not-parent-type? @interior.domain.start.startOf if_statement) ) ;;!! else if () {} @@ -114,7 +116,7 @@ ;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ( (if_statement) @branch.iteration - (#not-parent-type? @branch.iteration "if_statement") + (#not-parent-type? @branch.iteration if_statement) ) ;;!! try () {} @@ -290,7 +292,9 @@ (_ condition: (_) @condition + (#not-parent-type? @condition if_statement) ) @_.domain + (while_statement . (_) @condition From befb903553453a37816fe32afece4ee68f79b1de Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 30 Jun 2025 12:26:29 +0200 Subject: [PATCH 2/7] unit and selector --- data/fixtures/scopes/css/selector.scope | 20 ++++ data/fixtures/scopes/css/selector2.scope | 20 ++++ data/fixtures/scopes/css/selector3.scope | 20 ++++ data/fixtures/scopes/css/selector4.scope | 20 ++++ data/fixtures/scopes/css/selector5.scope | 20 ++++ data/fixtures/scopes/css/selector6.scope | 20 ++++ data/fixtures/scopes/css/selector7.scope | 20 ++++ data/fixtures/scopes/css/unit.scope | 108 ++++++++++++++++++ data/fixtures/scopes/css/unit2.scope | 27 +++++ data/fixtures/scopes/css/unit3.scope | 27 +++++ data/fixtures/scopes/css/unit4.scope | 27 +++++ data/fixtures/scopes/css/unit5.scope | 27 +++++ packages/common/src/scopeSupportFacets/c.ts | 2 + .../common/src/scopeSupportFacets/csharp.ts | 2 + packages/common/src/scopeSupportFacets/css.ts | 3 + .../common/src/scopeSupportFacets/html.ts | 2 + .../common/src/scopeSupportFacets/java.ts | 2 + .../src/scopeSupportFacets/javascript.ts | 2 + .../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 | 8 ++ .../scopeSupportFacets.types.ts | 6 +- .../common/src/scopeSupportFacets/talon.ts | 2 + packages/common/src/scopeSupportFacets/xml.ts | 2 + .../common/src/scopeSupportFacets/yaml.ts | 2 + 27 files changed, 393 insertions(+), 4 deletions(-) create mode 100644 data/fixtures/scopes/css/selector.scope create mode 100644 data/fixtures/scopes/css/selector2.scope create mode 100644 data/fixtures/scopes/css/selector3.scope create mode 100644 data/fixtures/scopes/css/selector4.scope create mode 100644 data/fixtures/scopes/css/selector5.scope create mode 100644 data/fixtures/scopes/css/selector6.scope create mode 100644 data/fixtures/scopes/css/selector7.scope create mode 100644 data/fixtures/scopes/css/unit.scope create mode 100644 data/fixtures/scopes/css/unit2.scope create mode 100644 data/fixtures/scopes/css/unit3.scope create mode 100644 data/fixtures/scopes/css/unit4.scope create mode 100644 data/fixtures/scopes/css/unit5.scope diff --git a/data/fixtures/scopes/css/selector.scope b/data/fixtures/scopes/css/selector.scope new file mode 100644 index 0000000000..0a755d322b --- /dev/null +++ b/data/fixtures/scopes/css/selector.scope @@ -0,0 +1,20 @@ +* {} +--- + +[Content] = 0:0-0:1 + >-< +0| * {} + +[Removal] = 0:0-0:2 + >--< +0| * {} + +[Trailing delimiter] = 0:1-0:2 + >-< +0| * {} + +[Domain] = 0:0-0:4 + >----< +0| * {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/selector2.scope b/data/fixtures/scopes/css/selector2.scope new file mode 100644 index 0000000000..65b53db506 --- /dev/null +++ b/data/fixtures/scopes/css/selector2.scope @@ -0,0 +1,20 @@ +body {} +--- + +[Content] = 0:0-0:4 + >----< +0| body {} + +[Removal] = 0:0-0:5 + >-----< +0| body {} + +[Trailing delimiter] = 0:4-0:5 + >-< +0| body {} + +[Domain] = 0:0-0:7 + >-------< +0| body {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/selector3.scope b/data/fixtures/scopes/css/selector3.scope new file mode 100644 index 0000000000..5bdf99f533 --- /dev/null +++ b/data/fixtures/scopes/css/selector3.scope @@ -0,0 +1,20 @@ +.foo {} +--- + +[Content] = 0:0-0:4 + >----< +0| .foo {} + +[Removal] = 0:0-0:5 + >-----< +0| .foo {} + +[Trailing delimiter] = 0:4-0:5 + >-< +0| .foo {} + +[Domain] = 0:0-0:7 + >-------< +0| .foo {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/selector4.scope b/data/fixtures/scopes/css/selector4.scope new file mode 100644 index 0000000000..8e424f1012 --- /dev/null +++ b/data/fixtures/scopes/css/selector4.scope @@ -0,0 +1,20 @@ +#foo {} +--- + +[Content] = 0:0-0:4 + >----< +0| #foo {} + +[Removal] = 0:0-0:5 + >-----< +0| #foo {} + +[Trailing delimiter] = 0:4-0:5 + >-< +0| #foo {} + +[Domain] = 0:0-0:7 + >-------< +0| #foo {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/selector5.scope b/data/fixtures/scopes/css/selector5.scope new file mode 100644 index 0000000000..8f366cc38e --- /dev/null +++ b/data/fixtures/scopes/css/selector5.scope @@ -0,0 +1,20 @@ +body > div {} +--- + +[Content] = 0:0-0:10 + >----------< +0| body > div {} + +[Removal] = 0:0-0:11 + >-----------< +0| body > div {} + +[Trailing delimiter] = 0:10-0:11 + >-< +0| body > div {} + +[Domain] = 0:0-0:13 + >-------------< +0| body > div {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/selector6.scope b/data/fixtures/scopes/css/selector6.scope new file mode 100644 index 0000000000..6f0ec790f5 --- /dev/null +++ b/data/fixtures/scopes/css/selector6.scope @@ -0,0 +1,20 @@ +#foo.bar {} +--- + +[Content] = 0:0-0:8 + >--------< +0| #foo.bar {} + +[Removal] = 0:0-0:9 + >---------< +0| #foo.bar {} + +[Trailing delimiter] = 0:8-0:9 + >-< +0| #foo.bar {} + +[Domain] = 0:0-0:11 + >-----------< +0| #foo.bar {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/selector7.scope b/data/fixtures/scopes/css/selector7.scope new file mode 100644 index 0000000000..2a362c2279 --- /dev/null +++ b/data/fixtures/scopes/css/selector7.scope @@ -0,0 +1,20 @@ +div:hover {} +--- + +[Content] = 0:0-0:9 + >---------< +0| div:hover {} + +[Removal] = 0:0-0:10 + >----------< +0| div:hover {} + +[Trailing delimiter] = 0:9-0:10 + >-< +0| div:hover {} + +[Domain] = 0:0-0:12 + >------------< +0| div:hover {} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/unit.scope b/data/fixtures/scopes/css/unit.scope new file mode 100644 index 0000000000..082ba70e3d --- /dev/null +++ b/data/fixtures/scopes/css/unit.scope @@ -0,0 +1,108 @@ +* { + padding: 25px 50px 75px 100px; +} +--- + +[#1.1 Content] = +[#1.1 Removal] = 1:15-1:17 + >--< +1| padding: 25px 50px 75px 100px; + +[#1.1 Trailing delimiter] = 1:17-1:18 + >-< +1| padding: 25px 50px 75px 100px; + +[#1.1 Insertion delimiter] = " " + +[#1.2 Content] = +[#1.2 Removal] = 1:20-1:22 + >--< +1| padding: 25px 50px 75px 100px; + +[#1.2 Trailing delimiter] = 1:22-1:23 + >-< +1| padding: 25px 50px 75px 100px; + +[#1.2 Insertion delimiter] = " " + +[#1.3 Content] = +[#1.3 Removal] = 1:25-1:27 + >--< +1| padding: 25px 50px 75px 100px; + +[#1.3 Trailing delimiter] = 1:27-1:28 + >-< +1| padding: 25px 50px 75px 100px; + +[#1.3 Insertion delimiter] = " " + +[#1.4 Content] = +[#1.4 Removal] = 1:31-1:33 + >--< +1| padding: 25px 50px 75px 100px; + +[#1.4 Insertion delimiter] = " " + +[#1 Domain] = 1:4-1:34 + >------------------------------< +1| padding: 25px 50px 75px 100px; + + +[#2 Content] = +[#2 Removal] = 1:15-1:17 + >--< +1| padding: 25px 50px 75px 100px; + +[#2 Trailing delimiter] = 1:17-1:18 + >-< +1| padding: 25px 50px 75px 100px; + +[#2 Domain] = 1:13-1:17 + >----< +1| padding: 25px 50px 75px 100px; + +[#2 Insertion delimiter] = " " + + +[#3 Content] = +[#3 Removal] = 1:20-1:22 + >--< +1| padding: 25px 50px 75px 100px; + +[#3 Trailing delimiter] = 1:22-1:23 + >-< +1| padding: 25px 50px 75px 100px; + +[#3 Domain] = 1:18-1:22 + >----< +1| padding: 25px 50px 75px 100px; + +[#3 Insertion delimiter] = " " + + +[#4 Content] = +[#4 Removal] = 1:25-1:27 + >--< +1| padding: 25px 50px 75px 100px; + +[#4 Trailing delimiter] = 1:27-1:28 + >-< +1| padding: 25px 50px 75px 100px; + +[#4 Domain] = 1:23-1:27 + >----< +1| padding: 25px 50px 75px 100px; + +[#4 Insertion delimiter] = " " + + +[#5 Content] = +[#5 Removal] = 1:31-1:33 + >--< +1| padding: 25px 50px 75px 100px; + +[#5 Domain] = 1:28-1:33 + >-----< +1| padding: 25px 50px 75px 100px; + +[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/unit2.scope b/data/fixtures/scopes/css/unit2.scope new file mode 100644 index 0000000000..d82e7e3902 --- /dev/null +++ b/data/fixtures/scopes/css/unit2.scope @@ -0,0 +1,27 @@ +* { + padding: 10px; +} +--- + +[#1 Content] = +[#1 Removal] = 1:15-1:17 + >--< +1| padding: 10px; + +[#1 Domain] = 1:4-1:18 + >--------------< +1| padding: 10px; + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 1:15-1:17 + >--< +1| padding: 10px; + +[#2 Domain] = 1:13-1:17 + >----< +1| padding: 10px; + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/unit3.scope b/data/fixtures/scopes/css/unit3.scope new file mode 100644 index 0000000000..ec9523cf24 --- /dev/null +++ b/data/fixtures/scopes/css/unit3.scope @@ -0,0 +1,27 @@ +* { + padding: 1rem; +} +--- + +[#1 Content] = +[#1 Removal] = 1:14-1:17 + >---< +1| padding: 1rem; + +[#1 Domain] = 1:4-1:18 + >--------------< +1| padding: 1rem; + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 1:14-1:17 + >---< +1| padding: 1rem; + +[#2 Domain] = 1:13-1:17 + >----< +1| padding: 1rem; + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/unit4.scope b/data/fixtures/scopes/css/unit4.scope new file mode 100644 index 0000000000..8ddfa4361e --- /dev/null +++ b/data/fixtures/scopes/css/unit4.scope @@ -0,0 +1,27 @@ +* { + padding: 1em; +} +--- + +[#1 Content] = +[#1 Removal] = 1:14-1:16 + >--< +1| padding: 1em; + +[#1 Domain] = 1:4-1:17 + >-------------< +1| padding: 1em; + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 1:14-1:16 + >--< +1| padding: 1em; + +[#2 Domain] = 1:13-1:16 + >---< +1| padding: 1em; + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/css/unit5.scope b/data/fixtures/scopes/css/unit5.scope new file mode 100644 index 0000000000..6bc112d4cb --- /dev/null +++ b/data/fixtures/scopes/css/unit5.scope @@ -0,0 +1,27 @@ +* { + padding: 50%; +} +--- + +[#1 Content] = +[#1 Removal] = 1:15-1:16 + >-< +1| padding: 50%; + +[#1 Domain] = 1:4-1:17 + >-------------< +1| padding: 50%; + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = 1:15-1:16 + >-< +1| padding: 50%; + +[#2 Domain] = 1:13-1:16 + >---< +1| padding: 50%; + +[#2 Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/c.ts b/packages/common/src/scopeSupportFacets/c.ts index 2b9cfc5ff1..34bcba7a1a 100644 --- a/packages/common/src/scopeSupportFacets/c.ts +++ b/packages/common/src/scopeSupportFacets/c.ts @@ -184,6 +184,8 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { environment: notApplicable, pairDelimiter: notApplicable, regularExpression: notApplicable, + selector: notApplicable, + unit: notApplicable, }; export const cScopeSupport: LanguageScopeSupportFacetMap = { diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index 867017c1e9..770d826fc1 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -236,4 +236,6 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { environment: notApplicable, pairDelimiter: notApplicable, regularExpression: notApplicable, + selector: notApplicable, + unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/css.ts b/packages/common/src/scopeSupportFacets/css.ts index 93312a6cd5..7d9c0a124c 100644 --- a/packages/common/src/scopeSupportFacets/css.ts +++ b/packages/common/src/scopeSupportFacets/css.ts @@ -37,6 +37,9 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { statement: supported, "statement.iteration.document": supported, + selector: supported, + unit: supported, + // Not applicable anonymousFunction: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/html.ts b/packages/common/src/scopeSupportFacets/html.ts index 010990d29c..969e79a06b 100644 --- a/packages/common/src/scopeSupportFacets/html.ts +++ b/packages/common/src/scopeSupportFacets/html.ts @@ -193,4 +193,6 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { section: notApplicable, statement: notApplicable, switchStatementSubject: notApplicable, + selector: notApplicable, + unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/java.ts b/packages/common/src/scopeSupportFacets/java.ts index 34c9132393..27a6bf0a80 100644 --- a/packages/common/src/scopeSupportFacets/java.ts +++ b/packages/common/src/scopeSupportFacets/java.ts @@ -238,4 +238,6 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { pairDelimiter: notApplicable, regularExpression: notApplicable, environment: notApplicable, + selector: notApplicable, + unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index 140122842d..914040f143 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -202,6 +202,8 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { // Miscellaneous environment: notApplicable, + selector: notApplicable, + unit: notApplicable, }; export const javascriptJsxScopeSupport: LanguageScopeSupportFacetMap = { diff --git a/packages/common/src/scopeSupportFacets/json.ts b/packages/common/src/scopeSupportFacets/json.ts index 2f3bdd55d0..b1b06d1084 100644 --- a/packages/common/src/scopeSupportFacets/json.ts +++ b/packages/common/src/scopeSupportFacets/json.ts @@ -197,4 +197,6 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "value.variable": notApplicable, "value.variable.pattern": notApplicable, "value.yield": notApplicable, + selector: notApplicable, + unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/markdown.ts b/packages/common/src/scopeSupportFacets/markdown.ts index b597435271..194445e1da 100644 --- a/packages/common/src/scopeSupportFacets/markdown.ts +++ b/packages/common/src/scopeSupportFacets/markdown.ts @@ -196,4 +196,6 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "value.variable": notApplicable, "value.variable.pattern": notApplicable, "value.yield": notApplicable, + selector: notApplicable, + unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index e99ff5eb3b..404b3827eb 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -214,4 +214,6 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { section: notApplicable, startTag: notApplicable, tags: notApplicable, + selector: notApplicable, + unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/scm.ts b/packages/common/src/scopeSupportFacets/scm.ts index 3eabe723d0..67f0854376 100644 --- a/packages/common/src/scopeSupportFacets/scm.ts +++ b/packages/common/src/scopeSupportFacets/scm.ts @@ -197,4 +197,6 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "value.variable": notApplicable, "value.variable.pattern": notApplicable, "value.yield": notApplicable, + selector: notApplicable, + unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index 3cbdcc53eb..a69be4f7dd 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -890,4 +890,12 @@ export const scopeSupportFacetInfos: Record< description: "A cell in a notebook or a markdown code block", scopeType: "notebookCell", }, + selector: { + description: "A selector in a css rule set", + scopeType: "selector", + }, + unit: { + description: "A unit in a css rule set", + scopeType: "unit", + }, }; diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index eaed8cfa75..81762abef5 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -216,10 +216,8 @@ export const scopeSupportFacets = [ "interior.resource", "notebookCell", - - // FIXME: Still in legacy - // selector - // unit + "selector", + "unit", ] as const; export interface ScopeSupportFacetInfo { diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index 08684f491f..b7655d726b 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -205,4 +205,6 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "value.yield": notApplicable, "string.multiLine": notApplicable, "textFragment.string.multiLine": notApplicable, + selector: notApplicable, + unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/xml.ts b/packages/common/src/scopeSupportFacets/xml.ts index 7a7f80c565..5b451504f9 100644 --- a/packages/common/src/scopeSupportFacets/xml.ts +++ b/packages/common/src/scopeSupportFacets/xml.ts @@ -193,4 +193,6 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "value.variable": notApplicable, "value.variable.pattern": notApplicable, "value.yield": notApplicable, + selector: notApplicable, + unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/yaml.ts b/packages/common/src/scopeSupportFacets/yaml.ts index c869b9bd71..a6ea502392 100644 --- a/packages/common/src/scopeSupportFacets/yaml.ts +++ b/packages/common/src/scopeSupportFacets/yaml.ts @@ -200,4 +200,6 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "value.variable": notApplicable, "value.variable.pattern": notApplicable, "value.yield": notApplicable, + selector: notApplicable, + unit: notApplicable, }; From 714349db8f83710a7eadb2a11beb81af75d23cb6 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 30 Jun 2025 13:29:06 +0200 Subject: [PATCH 3/7] value return lambda --- .../scopes/cpp/value.return.lambda.scope | 22 ------------------- .../scopes/csharp/value.return.lambda.scope | 10 ++++----- .../scopes/csharp/value.return.lambda2.scope | 22 ------------------- .../scopes/java/value.return.lambda.scope | 22 +++++++++---------- .../scopes/python/value.return.lambda.scope | 22 +++++++++---------- packages/common/src/scopeSupportFacets/cpp.ts | 2 +- 6 files changed, 28 insertions(+), 72 deletions(-) delete mode 100644 data/fixtures/scopes/cpp/value.return.lambda.scope delete mode 100644 data/fixtures/scopes/csharp/value.return.lambda2.scope diff --git a/data/fixtures/scopes/cpp/value.return.lambda.scope b/data/fixtures/scopes/cpp/value.return.lambda.scope deleted file mode 100644 index a7a8d0d82c..0000000000 --- a/data/fixtures/scopes/cpp/value.return.lambda.scope +++ /dev/null @@ -1,22 +0,0 @@ -[]() { - return 0; -} ---- - -[Content] = 1:11-1:12 - >-< -1| return 0; - -[Removal] = 1:10-1:12 - >--< -1| return 0; - -[Leading delimiter] = 1:10-1:11 - >-< -1| return 0; - -[Domain] = 1:4-1:13 - >---------< -1| return 0; - -[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/value.return.lambda.scope b/data/fixtures/scopes/csharp/value.return.lambda.scope index 0d759fd8d3..80775d6bf7 100644 --- a/data/fixtures/scopes/csharp/value.return.lambda.scope +++ b/data/fixtures/scopes/csharp/value.return.lambda.scope @@ -1,20 +1,20 @@ -() => 2; +() => 0; --- [Content] = 0:6-0:7 >-< -0| () => 2; +0| () => 0; [Removal] = 0:5-0:7 >--< -0| () => 2; +0| () => 0; [Leading delimiter] = 0:5-0:6 >-< -0| () => 2; +0| () => 0; [Domain] = 0:0-0:7 >-------< -0| () => 2; +0| () => 0; [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/value.return.lambda2.scope b/data/fixtures/scopes/csharp/value.return.lambda2.scope deleted file mode 100644 index 5dc35f18ef..0000000000 --- a/data/fixtures/scopes/csharp/value.return.lambda2.scope +++ /dev/null @@ -1,22 +0,0 @@ -() => { - return 2; -}; ---- - -[Content] = 1:11-1:12 - >-< -1| return 2; - -[Removal] = 1:10-1:12 - >--< -1| return 2; - -[Leading delimiter] = 1:10-1:11 - >-< -1| return 2; - -[Domain] = 1:4-1:13 - >---------< -1| return 2; - -[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/value.return.lambda.scope b/data/fixtures/scopes/java/value.return.lambda.scope index 92aec8abee..c95330d977 100644 --- a/data/fixtures/scopes/java/value.return.lambda.scope +++ b/data/fixtures/scopes/java/value.return.lambda.scope @@ -1,20 +1,20 @@ -() -> 123 +() -> 0; --- -[Content] = 0:6-0:9 - >---< -0| () -> 123 +[Content] = 0:6-0:7 + >-< +0| () -> 0; -[Removal] = 0:5-0:9 - >----< -0| () -> 123 +[Removal] = 0:5-0:7 + >--< +0| () -> 0; [Leading delimiter] = 0:5-0:6 >-< -0| () -> 123 +0| () -> 0; -[Domain] = 0:0-0:9 - >---------< -0| () -> 123 +[Domain] = 0:0-0:7 + >-------< +0| () -> 0; [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/value.return.lambda.scope b/data/fixtures/scopes/python/value.return.lambda.scope index 5d7701938a..885fbb5c78 100644 --- a/data/fixtures/scopes/python/value.return.lambda.scope +++ b/data/fixtures/scopes/python/value.return.lambda.scope @@ -1,20 +1,20 @@ -lambda: 123 +lambda: 0 --- -[Content] = 0:8-0:11 - >---< -0| lambda: 123 +[Content] = 0:8-0:9 + >-< +0| lambda: 0 -[Removal] = 0:7-0:11 - >----< -0| lambda: 123 +[Removal] = 0:7-0:9 + >--< +0| lambda: 0 [Leading delimiter] = 0:7-0:8 >-< -0| lambda: 123 +0| lambda: 0 -[Domain] = 0:0-0:11 - >-----------< -0| lambda: 123 +[Domain] = 0:0-0:9 + >---------< +0| lambda: 0 [Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/cpp.ts b/packages/common/src/scopeSupportFacets/cpp.ts index 8b9186c484..8a4d7113c6 100644 --- a/packages/common/src/scopeSupportFacets/cpp.ts +++ b/packages/common/src/scopeSupportFacets/cpp.ts @@ -61,7 +61,6 @@ export const cppScopeSupport: LanguageScopeSupportFacetMap = { "value.argument.formal.constructor": supported, "value.argument.formal.constructor.iteration": supported, "value.foreach": supported, - "value.return.lambda": supported, "value.field": supported, "type.argument.formal.method": supported, @@ -82,4 +81,5 @@ export const cppScopeSupport: LanguageScopeSupportFacetMap = { /* NOT APPLICABLE */ "interior.lambda.expression": notApplicable, + "value.return.lambda": notApplicable, }; From 99fffa374e5469aa1e87dfa184630b18d087cd3b Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 30 Jun 2025 13:38:39 +0200 Subject: [PATCH 4/7] branch.loop --- data/fixtures/scopes/c/branch.loop.scope | 10 ---------- data/fixtures/scopes/c/branch.loop2.scope | 10 ---------- data/fixtures/scopes/c/branch.loop3.scope | 10 ---------- data/fixtures/scopes/csharp/branch.loop.scope | 10 ---------- data/fixtures/scopes/csharp/branch.loop2.scope | 10 ---------- data/fixtures/scopes/csharp/branch.loop3.scope | 10 ---------- data/fixtures/scopes/csharp/branch.loop4.scope | 10 ---------- data/fixtures/scopes/java/branch.loop.scope | 10 ---------- data/fixtures/scopes/java/branch.loop2.scope | 10 ---------- data/fixtures/scopes/java/branch.loop3.scope | 10 ---------- data/fixtures/scopes/java/branch.loop4.scope | 10 ---------- .../scopes/javascript.core/branch.loop.scope | 10 ---------- .../scopes/javascript.core/branch.loop2.scope | 10 ---------- .../scopes/javascript.core/branch.loop3.scope | 10 ---------- .../scopes/javascript.core/branch.loop4.scope | 10 ---------- .../scopes/python/branch.loop.iteration.scope | 14 ++++++++++++++ .../scopes/python/branch.loop.iteration2.scope | 14 ++++++++++++++ data/fixtures/scopes/python/branch.loop2.scope | 10 +++++----- .../scopeSupportFacets/scopeSupportFacetInfos.ts | 13 +++++++++---- .../scopeSupportFacets/scopeSupportFacets.types.ts | 1 + 20 files changed, 43 insertions(+), 159 deletions(-) delete mode 100644 data/fixtures/scopes/c/branch.loop.scope delete mode 100644 data/fixtures/scopes/c/branch.loop2.scope delete mode 100644 data/fixtures/scopes/c/branch.loop3.scope delete mode 100644 data/fixtures/scopes/csharp/branch.loop.scope delete mode 100644 data/fixtures/scopes/csharp/branch.loop2.scope delete mode 100644 data/fixtures/scopes/csharp/branch.loop3.scope delete mode 100644 data/fixtures/scopes/csharp/branch.loop4.scope delete mode 100644 data/fixtures/scopes/java/branch.loop.scope delete mode 100644 data/fixtures/scopes/java/branch.loop2.scope delete mode 100644 data/fixtures/scopes/java/branch.loop3.scope delete mode 100644 data/fixtures/scopes/java/branch.loop4.scope delete mode 100644 data/fixtures/scopes/javascript.core/branch.loop.scope delete mode 100644 data/fixtures/scopes/javascript.core/branch.loop2.scope delete mode 100644 data/fixtures/scopes/javascript.core/branch.loop3.scope delete mode 100644 data/fixtures/scopes/javascript.core/branch.loop4.scope create mode 100644 data/fixtures/scopes/python/branch.loop.iteration.scope create mode 100644 data/fixtures/scopes/python/branch.loop.iteration2.scope diff --git a/data/fixtures/scopes/c/branch.loop.scope b/data/fixtures/scopes/c/branch.loop.scope deleted file mode 100644 index b17e514454..0000000000 --- a/data/fixtures/scopes/c/branch.loop.scope +++ /dev/null @@ -1,10 +0,0 @@ -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/branch.loop2.scope b/data/fixtures/scopes/c/branch.loop2.scope deleted file mode 100644 index 5aaf57be8f..0000000000 --- a/data/fixtures/scopes/c/branch.loop2.scope +++ /dev/null @@ -1,10 +0,0 @@ -while (true) {} ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:15 - >---------------< -0| while (true) {} - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/c/branch.loop3.scope b/data/fixtures/scopes/c/branch.loop3.scope deleted file mode 100644 index e1e74c9153..0000000000 --- a/data/fixtures/scopes/c/branch.loop3.scope +++ /dev/null @@ -1,10 +0,0 @@ -do {} while (true); ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:19 - >-------------------< -0| do {} while (true); - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.loop.scope b/data/fixtures/scopes/csharp/branch.loop.scope deleted file mode 100644 index 993264e193..0000000000 --- a/data/fixtures/scopes/csharp/branch.loop.scope +++ /dev/null @@ -1,10 +0,0 @@ -while (true) { } ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:16 - >----------------< -0| while (true) { } - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.loop2.scope b/data/fixtures/scopes/csharp/branch.loop2.scope deleted file mode 100644 index de7560026d..0000000000 --- a/data/fixtures/scopes/csharp/branch.loop2.scope +++ /dev/null @@ -1,10 +0,0 @@ -do { } while (true); ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:20 - >--------------------< -0| do { } while (true); - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.loop3.scope b/data/fixtures/scopes/csharp/branch.loop3.scope deleted file mode 100644 index 2d18232ba5..0000000000 --- a/data/fixtures/scopes/csharp/branch.loop3.scope +++ /dev/null @@ -1,10 +0,0 @@ -for (int i = 0; i < size; ++i) { } ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:34 - >----------------------------------< -0| for (int i = 0; i < size; ++i) { } - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/csharp/branch.loop4.scope b/data/fixtures/scopes/csharp/branch.loop4.scope deleted file mode 100644 index 8ccc856579..0000000000 --- a/data/fixtures/scopes/csharp/branch.loop4.scope +++ /dev/null @@ -1,10 +0,0 @@ -foreach (int v in values) { } ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:29 - >-----------------------------< -0| foreach (int v in values) { } - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/branch.loop.scope b/data/fixtures/scopes/java/branch.loop.scope deleted file mode 100644 index 2d18232ba5..0000000000 --- a/data/fixtures/scopes/java/branch.loop.scope +++ /dev/null @@ -1,10 +0,0 @@ -for (int i = 0; i < size; ++i) { } ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:34 - >----------------------------------< -0| for (int i = 0; i < size; ++i) { } - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/branch.loop2.scope b/data/fixtures/scopes/java/branch.loop2.scope deleted file mode 100644 index a7e3be936d..0000000000 --- a/data/fixtures/scopes/java/branch.loop2.scope +++ /dev/null @@ -1,10 +0,0 @@ -for (final int v : values) { } ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:30 - >------------------------------< -0| for (final int v : values) { } - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/branch.loop3.scope b/data/fixtures/scopes/java/branch.loop3.scope deleted file mode 100644 index 5beb4d4731..0000000000 --- a/data/fixtures/scopes/java/branch.loop3.scope +++ /dev/null @@ -1,10 +0,0 @@ -while(true) { } ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:15 - >---------------< -0| while(true) { } - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/branch.loop4.scope b/data/fixtures/scopes/java/branch.loop4.scope deleted file mode 100644 index 25f6d347bf..0000000000 --- a/data/fixtures/scopes/java/branch.loop4.scope +++ /dev/null @@ -1,10 +0,0 @@ -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/branch.loop.scope b/data/fixtures/scopes/javascript.core/branch.loop.scope deleted file mode 100644 index 2309add85a..0000000000 --- a/data/fixtures/scopes/javascript.core/branch.loop.scope +++ /dev/null @@ -1,10 +0,0 @@ -for (let i = 0; i < size; ++i) { } ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:34 - >----------------------------------< -0| for (let i = 0; i < size; ++i) { } - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/branch.loop2.scope b/data/fixtures/scopes/javascript.core/branch.loop2.scope deleted file mode 100644 index 23da216aa5..0000000000 --- a/data/fixtures/scopes/javascript.core/branch.loop2.scope +++ /dev/null @@ -1,10 +0,0 @@ -for (const v of values) { } ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:27 - >---------------------------< -0| for (const v of values) { } - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/branch.loop3.scope b/data/fixtures/scopes/javascript.core/branch.loop3.scope deleted file mode 100644 index 5beb4d4731..0000000000 --- a/data/fixtures/scopes/javascript.core/branch.loop3.scope +++ /dev/null @@ -1,10 +0,0 @@ -while(true) { } ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:15 - >---------------< -0| while(true) { } - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/branch.loop4.scope b/data/fixtures/scopes/javascript.core/branch.loop4.scope deleted file mode 100644 index 25f6d347bf..0000000000 --- a/data/fixtures/scopes/javascript.core/branch.loop4.scope +++ /dev/null @@ -1,10 +0,0 @@ -do { } while(true); ---- - -[Content] = -[Removal] = -[Domain] = 0:0-0:19 - >-------------------< -0| do { } while(true); - -[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/branch.loop.iteration.scope b/data/fixtures/scopes/python/branch.loop.iteration.scope new file mode 100644 index 0000000000..d18e9c41e4 --- /dev/null +++ b/data/fixtures/scopes/python/branch.loop.iteration.scope @@ -0,0 +1,14 @@ +while True: + pass +else: + pass +--- + +[Range] = +[Domain] = 0:0-3:8 + >----------- +0| while True: +1| pass +2| else: +3| pass + --------< diff --git a/data/fixtures/scopes/python/branch.loop.iteration2.scope b/data/fixtures/scopes/python/branch.loop.iteration2.scope new file mode 100644 index 0000000000..56f8870a5a --- /dev/null +++ b/data/fixtures/scopes/python/branch.loop.iteration2.scope @@ -0,0 +1,14 @@ +for v in values: + pass +else: + pass +--- + +[Range] = +[Domain] = 0:0-3:8 + >---------------- +0| for v in values: +1| pass +2| else: +3| pass + --------< diff --git a/data/fixtures/scopes/python/branch.loop2.scope b/data/fixtures/scopes/python/branch.loop2.scope index 39b2df2d04..2258b74d83 100644 --- a/data/fixtures/scopes/python/branch.loop2.scope +++ b/data/fixtures/scopes/python/branch.loop2.scope @@ -1,4 +1,4 @@ -for aaa in bbb: +for v in values: pass else: pass @@ -6,14 +6,14 @@ else: [#1 Content] = [#1 Domain] = 0:0-1:8 - >--------------- -0| for aaa in bbb: + >---------------- +0| for v in values: 1| pass --------< [#1 Removal] = 0:0-2:0 - >--------------- -0| for aaa in bbb: + >---------------- +0| for v in values: 1| pass 2| else: < diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index eb46a9697a..bb60c0b61d 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -446,15 +446,20 @@ export const scopeSupportFacetInfos: Record< description: "An if/elif/else branch", scopeType: "branch", }, + "branch.if.iteration": { + description: + "Iteration scope for if/elif/else branch; should be the entire if-else statement", + scopeType: "branch", + isIteration: true, + }, "branch.loop": { description: - "A for / while loop branch. For most languages there will just be one branch for the entire loop, but eg in Python you can have an else branch for a loop.", + "A for / while loop branch. For most languages this is not supported, but eg in Python you can have an else branch for a loop.", scopeType: "branch", }, - - "branch.if.iteration": { + "branch.loop.iteration": { description: - "Iteration scope for if/elif/else branch; should be the entire if-else statement", + "Iteration scope for loop branch; should be the entire loop statement", scopeType: "branch", isIteration: true, }, diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index acfa17217d..9acbcc1212 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -119,6 +119,7 @@ export const scopeSupportFacets = [ "branch.switchCase.iteration", "branch.ternary", "branch.loop", + "branch.loop.iteration", "collectionItem.unenclosed", "collectionItem.unenclosed.iteration", From bce80673cc6b2678252e265aba33cf91ba72e423 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 30 Jun 2025 14:23:29 +0200 Subject: [PATCH 5/7] branch.ternary --- .../scopes/c/branch.ternary.iteration.scope | 7 +++ .../csharp/branch.ternary.iteration.scope | 7 +++ .../scopes/csharp/branch.ternary.scope | 44 +++++++++---------- .../java/branch.ternary.iteration.scope | 7 +++ .../fixtures/scopes/java/branch.ternary.scope | 44 +++++++++---------- .../branch.ternary.iteration.scope | 7 +++ .../javascript.core/branch.ternary.scope | 44 +++++++++---------- .../python/branch.ternary.iteration.scope | 7 +++ .../scopes/python/branch.ternary.scope | 42 ++++++++---------- packages/common/src/scopeSupportFacets/c.ts | 4 +- .../common/src/scopeSupportFacets/csharp.ts | 4 +- packages/common/src/scopeSupportFacets/css.ts | 2 + .../common/src/scopeSupportFacets/html.ts | 2 + .../common/src/scopeSupportFacets/java.ts | 5 ++- .../src/scopeSupportFacets/javascript.ts | 4 +- .../common/src/scopeSupportFacets/json.ts | 2 + .../common/src/scopeSupportFacets/markdown.ts | 2 + .../common/src/scopeSupportFacets/python.ts | 2 + packages/common/src/scopeSupportFacets/r.ts | 5 ++- packages/common/src/scopeSupportFacets/scm.ts | 2 + .../scopeSupportFacetInfos.ts | 8 +++- .../scopeSupportFacets.types.ts | 1 + .../common/src/scopeSupportFacets/talon.ts | 2 + packages/common/src/scopeSupportFacets/xml.ts | 2 + .../common/src/scopeSupportFacets/yaml.ts | 2 + queries/c.scm | 2 +- queries/csharp.scm | 4 +- queries/javascript.core.scm | 3 +- 28 files changed, 167 insertions(+), 100 deletions(-) create mode 100644 data/fixtures/scopes/c/branch.ternary.iteration.scope create mode 100644 data/fixtures/scopes/csharp/branch.ternary.iteration.scope create mode 100644 data/fixtures/scopes/java/branch.ternary.iteration.scope create mode 100644 data/fixtures/scopes/javascript.core/branch.ternary.iteration.scope create mode 100644 data/fixtures/scopes/python/branch.ternary.iteration.scope diff --git a/data/fixtures/scopes/c/branch.ternary.iteration.scope b/data/fixtures/scopes/c/branch.ternary.iteration.scope new file mode 100644 index 0000000000..7c4fa798f9 --- /dev/null +++ b/data/fixtures/scopes/c/branch.ternary.iteration.scope @@ -0,0 +1,7 @@ +true ? 0 : 1; +--- + +[Range] = +[Domain] = 0:0-0:12 + >------------< +0| true ? 0 : 1; diff --git a/data/fixtures/scopes/csharp/branch.ternary.iteration.scope b/data/fixtures/scopes/csharp/branch.ternary.iteration.scope new file mode 100644 index 0000000000..7c4fa798f9 --- /dev/null +++ b/data/fixtures/scopes/csharp/branch.ternary.iteration.scope @@ -0,0 +1,7 @@ +true ? 0 : 1; +--- + +[Range] = +[Domain] = 0:0-0:12 + >------------< +0| true ? 0 : 1; diff --git a/data/fixtures/scopes/csharp/branch.ternary.scope b/data/fixtures/scopes/csharp/branch.ternary.scope index d96d24ff5b..9d12750feb 100644 --- a/data/fixtures/scopes/csharp/branch.ternary.scope +++ b/data/fixtures/scopes/csharp/branch.ternary.scope @@ -1,37 +1,37 @@ -value ? 1 : 2; +true ? 0 : 1; --- [#1 Content] = -[#1 Domain] = 0:8-0:9 - >-< -0| value ? 1 : 2; +[#1 Domain] = 0:7-0:8 + >-< +0| true ? 0 : 1; -[#1 Removal] = 0:8-0:10 - >--< -0| value ? 1 : 2; +[#1 Removal] = 0:7-0:9 + >--< +0| true ? 0 : 1; -[#1 Leading delimiter] = 0:7-0:8 - >-< -0| value ? 1 : 2; +[#1 Leading delimiter] = 0:6-0:7 + >-< +0| true ? 0 : 1; -[#1 Trailing delimiter] = 0:9-0:10 - >-< -0| value ? 1 : 2; +[#1 Trailing delimiter] = 0:8-0:9 + >-< +0| true ? 0 : 1; [#1 Insertion delimiter] = "\n" [#2 Content] = -[#2 Domain] = 0:12-0:13 - >-< -0| value ? 1 : 2; +[#2 Domain] = 0:11-0:12 + >-< +0| true ? 0 : 1; -[#2 Removal] = 0:11-0:13 - >--< -0| value ? 1 : 2; +[#2 Removal] = 0:10-0:12 + >--< +0| true ? 0 : 1; -[#2 Leading delimiter] = 0:11-0:12 - >-< -0| value ? 1 : 2; +[#2 Leading delimiter] = 0:10-0:11 + >-< +0| true ? 0 : 1; [#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/java/branch.ternary.iteration.scope b/data/fixtures/scopes/java/branch.ternary.iteration.scope new file mode 100644 index 0000000000..7c4fa798f9 --- /dev/null +++ b/data/fixtures/scopes/java/branch.ternary.iteration.scope @@ -0,0 +1,7 @@ +true ? 0 : 1; +--- + +[Range] = +[Domain] = 0:0-0:12 + >------------< +0| true ? 0 : 1; diff --git a/data/fixtures/scopes/java/branch.ternary.scope b/data/fixtures/scopes/java/branch.ternary.scope index 75fa5f5e2b..9d12750feb 100644 --- a/data/fixtures/scopes/java/branch.ternary.scope +++ b/data/fixtures/scopes/java/branch.ternary.scope @@ -1,37 +1,37 @@ -value != null ? value : -1; +true ? 0 : 1; --- [#1 Content] = -[#1 Domain] = 0:16-0:21 - >-----< -0| value != null ? value : -1; +[#1 Domain] = 0:7-0:8 + >-< +0| true ? 0 : 1; -[#1 Removal] = 0:16-0:22 - >------< -0| value != null ? value : -1; +[#1 Removal] = 0:7-0:9 + >--< +0| true ? 0 : 1; -[#1 Leading delimiter] = 0:15-0:16 - >-< -0| value != null ? value : -1; +[#1 Leading delimiter] = 0:6-0:7 + >-< +0| true ? 0 : 1; -[#1 Trailing delimiter] = 0:21-0:22 - >-< -0| value != null ? value : -1; +[#1 Trailing delimiter] = 0:8-0:9 + >-< +0| true ? 0 : 1; [#1 Insertion delimiter] = "\n" [#2 Content] = -[#2 Domain] = 0:24-0:26 - >--< -0| value != null ? value : -1; +[#2 Domain] = 0:11-0:12 + >-< +0| true ? 0 : 1; -[#2 Removal] = 0:23-0:26 - >---< -0| value != null ? value : -1; +[#2 Removal] = 0:10-0:12 + >--< +0| true ? 0 : 1; -[#2 Leading delimiter] = 0:23-0:24 - >-< -0| value != null ? value : -1; +[#2 Leading delimiter] = 0:10-0:11 + >-< +0| true ? 0 : 1; [#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/branch.ternary.iteration.scope b/data/fixtures/scopes/javascript.core/branch.ternary.iteration.scope new file mode 100644 index 0000000000..195e37b047 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/branch.ternary.iteration.scope @@ -0,0 +1,7 @@ +true ? 0 : 1 +--- + +[Range] = +[Domain] = 0:0-0:12 + >------------< +0| true ? 0 : 1 diff --git a/data/fixtures/scopes/javascript.core/branch.ternary.scope b/data/fixtures/scopes/javascript.core/branch.ternary.scope index 92e00b0f68..d52a64d3ee 100644 --- a/data/fixtures/scopes/javascript.core/branch.ternary.scope +++ b/data/fixtures/scopes/javascript.core/branch.ternary.scope @@ -1,37 +1,37 @@ -aaa ? bbb : ccc; +true ? 0 : 1 --- [#1 Content] = -[#1 Domain] = 0:6-0:9 - >---< -0| aaa ? bbb : ccc; +[#1 Domain] = 0:7-0:8 + >-< +0| true ? 0 : 1 -[#1 Removal] = 0:6-0:10 - >----< -0| aaa ? bbb : ccc; +[#1 Removal] = 0:7-0:9 + >--< +0| true ? 0 : 1 -[#1 Leading delimiter] = 0:5-0:6 - >-< -0| aaa ? bbb : ccc; +[#1 Leading delimiter] = 0:6-0:7 + >-< +0| true ? 0 : 1 -[#1 Trailing delimiter] = 0:9-0:10 - >-< -0| aaa ? bbb : ccc; +[#1 Trailing delimiter] = 0:8-0:9 + >-< +0| true ? 0 : 1 [#1 Insertion delimiter] = "\n" [#2 Content] = -[#2 Domain] = 0:12-0:15 - >---< -0| aaa ? bbb : ccc; +[#2 Domain] = 0:11-0:12 + >-< +0| true ? 0 : 1 -[#2 Removal] = 0:11-0:15 - >----< -0| aaa ? bbb : ccc; +[#2 Removal] = 0:10-0:12 + >--< +0| true ? 0 : 1 -[#2 Leading delimiter] = 0:11-0:12 - >-< -0| aaa ? bbb : ccc; +[#2 Leading delimiter] = 0:10-0:11 + >-< +0| true ? 0 : 1 [#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/python/branch.ternary.iteration.scope b/data/fixtures/scopes/python/branch.ternary.iteration.scope new file mode 100644 index 0000000000..c902f61ed2 --- /dev/null +++ b/data/fixtures/scopes/python/branch.ternary.iteration.scope @@ -0,0 +1,7 @@ +0 if True else 1 +--- + +[Range] = +[Domain] = 0:0-0:16 + >----------------< +0| 0 if True else 1 diff --git a/data/fixtures/scopes/python/branch.ternary.scope b/data/fixtures/scopes/python/branch.ternary.scope index ccd4db7038..e4623d2d08 100644 --- a/data/fixtures/scopes/python/branch.ternary.scope +++ b/data/fixtures/scopes/python/branch.ternary.scope @@ -1,37 +1,33 @@ -aaa = bbb if ccc else ddd +0 if True else 1 --- [#1 Content] = -[#1 Domain] = 0:6-0:9 - >---< -0| aaa = bbb if ccc else ddd +[#1 Domain] = 0:0-0:1 + >-< +0| 0 if True else 1 -[#1 Removal] = 0:6-0:10 - >----< -0| aaa = bbb if ccc else ddd +[#1 Removal] = 0:0-0:2 + >--< +0| 0 if True else 1 -[#1 Leading delimiter] = 0:5-0:6 - >-< -0| aaa = bbb if ccc else ddd - -[#1 Trailing delimiter] = 0:9-0:10 - >-< -0| aaa = bbb if ccc else ddd +[#1 Trailing delimiter] = 0:1-0:2 + >-< +0| 0 if True else 1 [#1 Insertion delimiter] = "\n" [#2 Content] = -[#2 Domain] = 0:22-0:25 - >---< -0| aaa = bbb if ccc else ddd +[#2 Domain] = 0:15-0:16 + >-< +0| 0 if True else 1 -[#2 Removal] = 0:21-0:25 - >----< -0| aaa = bbb if ccc else ddd +[#2 Removal] = 0:14-0:16 + >--< +0| 0 if True else 1 -[#2 Leading delimiter] = 0:21-0:22 - >-< -0| aaa = bbb if ccc else ddd +[#2 Leading delimiter] = 0:14-0:15 + >-< +0| 0 if True else 1 [#2 Insertion delimiter] = "\n" diff --git a/packages/common/src/scopeSupportFacets/c.ts b/packages/common/src/scopeSupportFacets/c.ts index 141ee39afd..043cdb4530 100644 --- a/packages/common/src/scopeSupportFacets/c.ts +++ b/packages/common/src/scopeSupportFacets/c.ts @@ -52,7 +52,7 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { "branch.switchCase": supported, "branch.switchCase.iteration": supported, "branch.ternary": supported, - "branch.loop": supported, + "branch.ternary.iteration": supported, "comment.line": supported, "comment.block": supported, @@ -185,6 +185,8 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { "value.yield": notApplicable, "value.field": notApplicable, "interior.static": notApplicable, + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, environment: notApplicable, pairDelimiter: notApplicable, regularExpression: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index ad1cdd9cd2..694b646fcd 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -46,7 +46,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "branch.switchCase": supported, "branch.switchCase.iteration": supported, "branch.ternary": supported, - "branch.loop": supported, + "branch.ternary.iteration": supported, "condition.for": supported, "condition.while": supported, @@ -247,4 +247,6 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { unit: notApplicable, "interior.namespace": notApplicable, "interior.static": notApplicable, + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/css.ts b/packages/common/src/scopeSupportFacets/css.ts index 42b8304cdb..c83713a31b 100644 --- a/packages/common/src/scopeSupportFacets/css.ts +++ b/packages/common/src/scopeSupportFacets/css.ts @@ -77,9 +77,11 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "branch.if.iteration": notApplicable, "branch.if": notApplicable, "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, "branch.switchCase.iteration": notApplicable, "branch.switchCase": notApplicable, "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, "branch.try.iteration": notApplicable, "branch.try": notApplicable, "class.iteration.block": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/html.ts b/packages/common/src/scopeSupportFacets/html.ts index cc3c059c76..ab54051073 100644 --- a/packages/common/src/scopeSupportFacets/html.ts +++ b/packages/common/src/scopeSupportFacets/html.ts @@ -58,9 +58,11 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { "branch.if.iteration": notApplicable, "branch.if": notApplicable, "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, "branch.switchCase.iteration": notApplicable, "branch.switchCase": notApplicable, "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, "branch.try.iteration": notApplicable, "branch.try": notApplicable, "class.iteration.block": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/java.ts b/packages/common/src/scopeSupportFacets/java.ts index d2bb6530c5..ac3a3b1f3a 100644 --- a/packages/common/src/scopeSupportFacets/java.ts +++ b/packages/common/src/scopeSupportFacets/java.ts @@ -48,11 +48,10 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "branch.if.iteration": supported, "branch.try": supported, "branch.try.iteration": supported, - "branch.switchCase": supported, "branch.switchCase.iteration": supported, "branch.ternary": supported, - "branch.loop": supported, + "branch.ternary.iteration": supported, class: supported, "class.iteration.block": supported, @@ -244,6 +243,8 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { // Miscellaneous "value.yield": notApplicable, "interior.namespace": notApplicable, + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, pairDelimiter: notApplicable, regularExpression: notApplicable, environment: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index b2ff7e022b..b1f9622fb6 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -102,7 +102,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "branch.switchCase": supported, "branch.switchCase.iteration": supported, "branch.ternary": supported, - "branch.loop": supported, + "branch.ternary.iteration": supported, "condition.if": supported, "condition.while": supported, @@ -213,6 +213,8 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { selector: notApplicable, unit: notApplicable, "interior.namespace": notApplicable, + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, }; export const javascriptJsxScopeSupport: LanguageScopeSupportFacetMap = { diff --git a/packages/common/src/scopeSupportFacets/json.ts b/packages/common/src/scopeSupportFacets/json.ts index 57651cfab2..845c192dba 100644 --- a/packages/common/src/scopeSupportFacets/json.ts +++ b/packages/common/src/scopeSupportFacets/json.ts @@ -63,9 +63,11 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "branch.if": notApplicable, "branch.if.iteration": notApplicable, "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, class: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/markdown.ts b/packages/common/src/scopeSupportFacets/markdown.ts index 029bac5e8d..a718d038a3 100644 --- a/packages/common/src/scopeSupportFacets/markdown.ts +++ b/packages/common/src/scopeSupportFacets/markdown.ts @@ -59,9 +59,11 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "branch.if": notApplicable, "branch.if.iteration": notApplicable, "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, class: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index 0ed4c4c8ce..37b1dcb367 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -119,9 +119,11 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { "branch.switchCase": supported, "branch.switchCase.iteration": supported, "branch.ternary": supported, + "branch.ternary.iteration": supported, "branch.try": supported, "branch.try.iteration": supported, "branch.loop": supported, + "branch.loop.iteration": supported, class: supported, "class.iteration.document": supported, diff --git a/packages/common/src/scopeSupportFacets/r.ts b/packages/common/src/scopeSupportFacets/r.ts index efa3037afc..9771532caa 100644 --- a/packages/common/src/scopeSupportFacets/r.ts +++ b/packages/common/src/scopeSupportFacets/r.ts @@ -38,10 +38,10 @@ export const rScopeSupport: LanguageScopeSupportFacetMap = { "branch.if": unsupported, "branch.if.iteration": unsupported, - "branch.loop": unsupported, "branch.switchCase": unsupported, "branch.switchCase.iteration": unsupported, "branch.ternary": unsupported, + "branch.ternary.iteration": unsupported, "branch.try": unsupported, "branch.try.iteration": unsupported, "condition.for": unsupported, @@ -81,6 +81,9 @@ export const rScopeSupport: LanguageScopeSupportFacetMap = { "interior.command": notApplicable, "interior.element": notApplicable, "name.assignment.pattern": notApplicable, + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, + // Not applicable for base language but might be useful for markdown or quarto "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/scm.ts b/packages/common/src/scopeSupportFacets/scm.ts index c9eb1df64e..259d90c0e2 100644 --- a/packages/common/src/scopeSupportFacets/scm.ts +++ b/packages/common/src/scopeSupportFacets/scm.ts @@ -59,9 +59,11 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "branch.if": notApplicable, "branch.if.iteration": notApplicable, "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, class: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index bb60c0b61d..e849d9ba9b 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -479,7 +479,7 @@ export const scopeSupportFacetInfos: Record< }, "branch.switchCase.iteration": { description: - "Iteration scope for branches in a switch/match statement; should contain all the cases", + "Iteration scope for branches in a switch/match statement; should be the switch statement body", scopeType: "branch", isIteration: true, }, @@ -487,6 +487,12 @@ export const scopeSupportFacetInfos: Record< description: "A branch in a ternary expression", scopeType: "branch", }, + "branch.ternary.iteration": { + description: + "Iteration scope for branches in a ternary expression; should be the entire expression", + scopeType: "branch", + isIteration: true, + }, "collectionItem.unenclosed": { description: "An item in a comma-separated list without enclosing delimiters. This could be multi-variable declarations, import statements, etc.", diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index 9acbcc1212..de541b19a0 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -118,6 +118,7 @@ export const scopeSupportFacets = [ "branch.switchCase", "branch.switchCase.iteration", "branch.ternary", + "branch.ternary.iteration", "branch.loop", "branch.loop.iteration", diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index 74d0041086..e3668382c0 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -75,9 +75,11 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "branch.if": notApplicable, "branch.if.iteration": notApplicable, "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, class: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/xml.ts b/packages/common/src/scopeSupportFacets/xml.ts index 66f09c9c53..9650905117 100644 --- a/packages/common/src/scopeSupportFacets/xml.ts +++ b/packages/common/src/scopeSupportFacets/xml.ts @@ -59,9 +59,11 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "branch.if": notApplicable, "branch.if.iteration": notApplicable, "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, class: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/yaml.ts b/packages/common/src/scopeSupportFacets/yaml.ts index be4bf13163..faed5596ff 100644 --- a/packages/common/src/scopeSupportFacets/yaml.ts +++ b/packages/common/src/scopeSupportFacets/yaml.ts @@ -69,9 +69,11 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "branch.if": notApplicable, "branch.if.iteration": notApplicable, "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, "branch.switchCase": notApplicable, "branch.switchCase.iteration": notApplicable, "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, "branch.try": notApplicable, "branch.try.iteration": notApplicable, class: notApplicable, diff --git a/queries/c.scm b/queries/c.scm index edc12b7e2e..47956df039 100644 --- a/queries/c.scm +++ b/queries/c.scm @@ -400,7 +400,7 @@ ;;! ^^^^ (conditional_expression condition: (_) @condition @interior -) @condition.domain +) @condition.domain @branch.iteration ;;!! true ? 0 : 1 ;;! ^ diff --git a/queries/csharp.scm b/queries/csharp.scm index df1ff49428..3c89d4caeb 100644 --- a/queries/csharp.scm +++ b/queries/csharp.scm @@ -164,10 +164,12 @@ ;;! ^ ^ (conditional_expression condition: (_) @condition @interior -) @condition.domain +) @condition.domain @branch.iteration + (conditional_expression consequence: (_) @branch @interior ) + (conditional_expression alternative: (_) @branch @interior ) diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index eb8883811a..40d597a380 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -575,8 +575,7 @@ ;;! ------------- (ternary_expression condition: (_) @condition @interior - consequence: (_) @branch -) @condition.domain +) @condition.domain @branch.iteration (ternary_expression consequence: (_) @branch @interior From a7d62ad276345d3a3c3f87ffad825b41aa5a3987 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 30 Jun 2025 14:53:02 +0200 Subject: [PATCH 6/7] name.namespace --- .../scopes/cpp/interior.namespace.scope | 26 +++---- data/fixtures/scopes/cpp/name.class.scope | 48 ++++--------- data/fixtures/scopes/cpp/name.class2.scope | 24 +++++++ data/fixtures/scopes/cpp/name.namespace.scope | 24 +++++++ packages/common/src/scopeSupportFacets/c.ts | 1 + packages/common/src/scopeSupportFacets/cpp.ts | 1 + .../common/src/scopeSupportFacets/csharp.ts | 11 ++- packages/common/src/scopeSupportFacets/css.ts | 1 + .../common/src/scopeSupportFacets/html.ts | 1 + .../common/src/scopeSupportFacets/java.ts | 9 ++- .../src/scopeSupportFacets/javascript.ts | 11 ++- .../common/src/scopeSupportFacets/json.ts | 1 + .../common/src/scopeSupportFacets/markdown.ts | 1 + .../common/src/scopeSupportFacets/python.ts | 71 ++++++++++++------- packages/common/src/scopeSupportFacets/scm.ts | 1 + .../scopeSupportFacetInfos.ts | 4 ++ .../scopeSupportFacets.types.ts | 1 + .../common/src/scopeSupportFacets/talon.ts | 1 + packages/common/src/scopeSupportFacets/xml.ts | 1 + .../common/src/scopeSupportFacets/yaml.ts | 1 + .../contributing/MissingLanguageScopes.tsx | 13 ++-- 21 files changed, 165 insertions(+), 87 deletions(-) create mode 100644 data/fixtures/scopes/cpp/name.class2.scope create mode 100644 data/fixtures/scopes/cpp/name.namespace.scope diff --git a/data/fixtures/scopes/cpp/interior.namespace.scope b/data/fixtures/scopes/cpp/interior.namespace.scope index a1ad98ebff..1f9153248c 100644 --- a/data/fixtures/scopes/cpp/interior.namespace.scope +++ b/data/fixtures/scopes/cpp/interior.namespace.scope @@ -1,25 +1,25 @@ -namespace NS { } +namespace Foo { } --- [#1 Content] = -[#1 Removal] = 0:14-0:15 - >-< -0| namespace NS { } +[#1 Removal] = 0:15-0:16 + >-< +0| namespace Foo { } -[#1 Domain] = 0:0-0:16 - >----------------< -0| namespace NS { } +[#1 Domain] = 0:0-0:17 + >-----------------< +0| namespace Foo { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:14-0:15 - >-< -0| namespace NS { } +[#2 Removal] = 0:15-0:16 + >-< +0| namespace Foo { } -[#2 Domain] = 0:13-0:16 - >---< -0| namespace NS { } +[#2 Domain] = 0:14-0:17 + >---< +0| namespace Foo { } [#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/name.class.scope b/data/fixtures/scopes/cpp/name.class.scope index e7b4b10ca4..d7fe067187 100644 --- a/data/fixtures/scopes/cpp/name.class.scope +++ b/data/fixtures/scopes/cpp/name.class.scope @@ -1,48 +1,24 @@ -class aaa {}; -enum class ccc {}; +class Foo {}; --- -[#1 Content] = 0:6-0:9 +[Content] = 0:6-0:9 >---< -0| class aaa {}; +0| class Foo {}; -[#1 Removal] = 0:6-0:10 +[Removal] = 0:6-0:10 >----< -0| class aaa {}; +0| class Foo {}; -[#1 Leading delimiter] = 0:5-0:6 +[Leading delimiter] = 0:5-0:6 >-< -0| class aaa {}; +0| class Foo {}; -[#1 Trailing delimiter] = 0:9-0:10 +[Trailing delimiter] = 0:9-0:10 >-< -0| class aaa {}; +0| class Foo {}; -[#1 Domain] = 0:0-0:13 +[Domain] = 0:0-0:13 >-------------< -0| class aaa {}; +0| class Foo {}; -[#1 Insertion delimiter] = " " - - -[#2 Content] = 1:11-1:14 - >---< -1| enum class ccc {}; - -[#2 Removal] = 1:11-1:15 - >----< -1| enum class ccc {}; - -[#2 Leading delimiter] = 1:10-1:11 - >-< -1| enum class ccc {}; - -[#2 Trailing delimiter] = 1:14-1:15 - >-< -1| enum class ccc {}; - -[#2 Domain] = 1:0-1:18 - >------------------< -1| enum class ccc {}; - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/name.class2.scope b/data/fixtures/scopes/cpp/name.class2.scope new file mode 100644 index 0000000000..c6442bcc97 --- /dev/null +++ b/data/fixtures/scopes/cpp/name.class2.scope @@ -0,0 +1,24 @@ +enum class Foo {}; +--- + +[Content] = 0:11-0:14 + >---< +0| enum class Foo {}; + +[Removal] = 0:11-0:15 + >----< +0| enum class Foo {}; + +[Leading delimiter] = 0:10-0:11 + >-< +0| enum class Foo {}; + +[Trailing delimiter] = 0:14-0:15 + >-< +0| enum class Foo {}; + +[Domain] = 0:0-0:18 + >------------------< +0| enum class Foo {}; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/name.namespace.scope b/data/fixtures/scopes/cpp/name.namespace.scope new file mode 100644 index 0000000000..12f853ed95 --- /dev/null +++ b/data/fixtures/scopes/cpp/name.namespace.scope @@ -0,0 +1,24 @@ +namespace Foo { } +--- + +[Content] = 0:10-0:13 + >---< +0| namespace Foo { } + +[Removal] = 0:10-0:14 + >----< +0| namespace Foo { } + +[Leading delimiter] = 0:9-0:10 + >-< +0| namespace Foo { } + +[Trailing delimiter] = 0:13-0:14 + >-< +0| namespace Foo { } + +[Domain] = 0:0-0:17 + >-----------------< +0| namespace Foo { } + +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/c.ts b/packages/common/src/scopeSupportFacets/c.ts index 043cdb4530..ed9cdd8004 100644 --- a/packages/common/src/scopeSupportFacets/c.ts +++ b/packages/common/src/scopeSupportFacets/c.ts @@ -272,5 +272,6 @@ export const cScopeSupport: LanguageScopeSupportFacetMap = { "type.typeArgument.iteration": notApplicable, // Namespace + "name.namespace": notApplicable, "interior.namespace": notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/cpp.ts b/packages/common/src/scopeSupportFacets/cpp.ts index 8a4d7113c6..66f765a7db 100644 --- a/packages/common/src/scopeSupportFacets/cpp.ts +++ b/packages/common/src/scopeSupportFacets/cpp.ts @@ -53,6 +53,7 @@ export const cppScopeSupport: LanguageScopeSupportFacetMap = { "name.constructor": supported, "name.foreach": supported, "name.method": supported, + "name.namespace": supported, "value.argument.formal": supported, "value.argument.formal.iteration": supported, diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index 694b646fcd..86c4da63bc 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -239,14 +239,19 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "collectionItem.unenclosed.iteration": notApplicable, "collectionItem.unenclosed": notApplicable, + // Namespace + "name.namespace": notApplicable, + "interior.namespace": notApplicable, + + // Branch loop + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, + // Miscellaneous environment: notApplicable, pairDelimiter: notApplicable, regularExpression: notApplicable, selector: notApplicable, unit: notApplicable, - "interior.namespace": notApplicable, "interior.static": notApplicable, - "branch.loop": notApplicable, - "branch.loop.iteration": notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/css.ts b/packages/common/src/scopeSupportFacets/css.ts index c83713a31b..87546b4a9b 100644 --- a/packages/common/src/scopeSupportFacets/css.ts +++ b/packages/common/src/scopeSupportFacets/css.ts @@ -146,6 +146,7 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "name.assignment.pattern": notApplicable, "name.assignment": notApplicable, "name.class": notApplicable, + "name.namespace": notApplicable, "name.constructor": notApplicable, "name.field": notApplicable, "name.foreach": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/html.ts b/packages/common/src/scopeSupportFacets/html.ts index ab54051073..58818832fa 100644 --- a/packages/common/src/scopeSupportFacets/html.ts +++ b/packages/common/src/scopeSupportFacets/html.ts @@ -130,6 +130,7 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { "name.resource": notApplicable, "name.variable.pattern": notApplicable, "name.variable": notApplicable, + "name.namespace": notApplicable, "namedFunction.constructor": notApplicable, "namedFunction.iteration.block": notApplicable, "namedFunction.iteration.document": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/java.ts b/packages/common/src/scopeSupportFacets/java.ts index ac3a3b1f3a..3eec6e205e 100644 --- a/packages/common/src/scopeSupportFacets/java.ts +++ b/packages/common/src/scopeSupportFacets/java.ts @@ -240,11 +240,16 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "type.resource.iteration": notApplicable, "name.resource.iteration": notApplicable, - // Miscellaneous - "value.yield": notApplicable, + // Namespace + "name.namespace": notApplicable, "interior.namespace": notApplicable, + + // Branch loop "branch.loop": notApplicable, "branch.loop.iteration": notApplicable, + + // Miscellaneous + "value.yield": notApplicable, pairDelimiter: notApplicable, regularExpression: notApplicable, environment: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index b1f9622fb6..63a4f750d3 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -208,13 +208,18 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "functionName.iteration.block": notApplicable, "namedFunction.iteration.block": notApplicable, + // Namespace + "name.namespace": notApplicable, + "interior.namespace": notApplicable, + + // Branch loop + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, + // Miscellaneous environment: notApplicable, selector: notApplicable, unit: notApplicable, - "interior.namespace": notApplicable, - "branch.loop": notApplicable, - "branch.loop.iteration": notApplicable, }; export const javascriptJsxScopeSupport: LanguageScopeSupportFacetMap = { diff --git a/packages/common/src/scopeSupportFacets/json.ts b/packages/common/src/scopeSupportFacets/json.ts index 845c192dba..d7d6930b97 100644 --- a/packages/common/src/scopeSupportFacets/json.ts +++ b/packages/common/src/scopeSupportFacets/json.ts @@ -135,6 +135,7 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "name.assignment": notApplicable, "name.assignment.pattern": notApplicable, "name.class": notApplicable, + "name.namespace": notApplicable, "name.constructor": notApplicable, "name.field": notApplicable, "name.foreach": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/markdown.ts b/packages/common/src/scopeSupportFacets/markdown.ts index a718d038a3..ad507a1a79 100644 --- a/packages/common/src/scopeSupportFacets/markdown.ts +++ b/packages/common/src/scopeSupportFacets/markdown.ts @@ -133,6 +133,7 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "name.assignment": notApplicable, "name.assignment.pattern": notApplicable, "name.class": notApplicable, + "name.namespace": notApplicable, "name.constructor": notApplicable, "name.field": notApplicable, "name.foreach": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index 37b1dcb367..3b8a402399 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -183,29 +183,47 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { pairDelimiter: supported, fieldAccess: supported, - // Not applicable + /* NOT APPLICABLE */ - "argumentList.formal.lambda.multiLine": notApplicable, + // Element and tags + element: notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + "interior.element": notApplicable, + "textFragment.element": notApplicable, + attribute: notApplicable, + "key.attribute": notApplicable, + "value.attribute": notApplicable, + + // Section + section: notApplicable, + "section.iteration.document": notApplicable, + "section.iteration.parent": notApplicable, + + // Command + command: notApplicable, + "interior.command": notApplicable, + + // Namespace + "name.namespace": notApplicable, + "interior.namespace": notApplicable, + + // Nested classes "class.iteration.block": notApplicable, "className.iteration.block": notApplicable, - "comment.block": notApplicable, + + // for and do-while loops "condition.doWhile": notApplicable, "condition.for": notApplicable, - "functionName.iteration.block": notApplicable, - "interior.cell": notApplicable, - "interior.command": notApplicable, - "interior.element": notApplicable, - "interior.lambda.block": notApplicable, "interior.for": notApplicable, "interior.doWhile": notApplicable, - "interior.static": notApplicable, - "interior.namespace": notApplicable, - "key.attribute": notApplicable, + + // Nested functions. Technically supported, but great problem with `every funk` in a method. + "functionName.iteration.block": notApplicable, "namedFunction.iteration.block": notApplicable, - "section.iteration.document": notApplicable, - "section.iteration.parent": notApplicable, - "textFragment.comment.block": notApplicable, - "textFragment.element": notApplicable, + + // Type. Python have some types, but not these. "type.alias": notApplicable, "type.cast": notApplicable, "type.enum": notApplicable, @@ -213,18 +231,23 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { "type.interface": notApplicable, "type.resource.iteration": notApplicable, "type.resource": notApplicable, - "value.attribute": notApplicable, "value.typeAlias": notApplicable, - attribute: notApplicable, - command: notApplicable, - element: notApplicable, - endTag: notApplicable, - environment: notApplicable, + + // Notebook cell notebookCell: notApplicable, + "interior.cell": notApplicable, + + // Multiline lambda + "argumentList.formal.lambda.multiLine": notApplicable, + "interior.lambda.block": notApplicable, + + // Block comments + "comment.block": notApplicable, + "textFragment.comment.block": notApplicable, + + "interior.static": notApplicable, + environment: notApplicable, regularExpression: notApplicable, - section: notApplicable, - startTag: notApplicable, - tags: notApplicable, selector: notApplicable, unit: notApplicable, }; diff --git a/packages/common/src/scopeSupportFacets/scm.ts b/packages/common/src/scopeSupportFacets/scm.ts index 259d90c0e2..2e01eed71a 100644 --- a/packages/common/src/scopeSupportFacets/scm.ts +++ b/packages/common/src/scopeSupportFacets/scm.ts @@ -133,6 +133,7 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "name.assignment": notApplicable, "name.assignment.pattern": notApplicable, "name.class": notApplicable, + "name.namespace": notApplicable, "name.constructor": notApplicable, "name.field": notApplicable, "name.foreach": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index e849d9ba9b..716f3c3b49 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -573,6 +573,10 @@ export const scopeSupportFacetInfos: Record< description: "Name of a class", scopeType: "name", }, + "name.namespace": { + description: "Name of a namespace", + scopeType: "name", + }, "name.field": { description: "Name (LHS) of a field in a class / interface", scopeType: "name", diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index de541b19a0..3aa2462aef 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -142,6 +142,7 @@ export const scopeSupportFacets = [ "name.method", "name.constructor", "name.class", + "name.namespace", "name.field", "name.resource", "name.resource.iteration", diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index e3668382c0..f15b9d5f8a 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -148,6 +148,7 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.formal.method.iteration": notApplicable, "name.assignment.pattern": notApplicable, "name.class": notApplicable, + "name.namespace": notApplicable, "name.constructor": notApplicable, "name.foreach": notApplicable, "name.function": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/xml.ts b/packages/common/src/scopeSupportFacets/xml.ts index 9650905117..cf20a018bf 100644 --- a/packages/common/src/scopeSupportFacets/xml.ts +++ b/packages/common/src/scopeSupportFacets/xml.ts @@ -132,6 +132,7 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "name.assignment": notApplicable, "name.assignment.pattern": notApplicable, "name.class": notApplicable, + "name.namespace": notApplicable, "name.constructor": notApplicable, "name.field": notApplicable, "name.foreach": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/yaml.ts b/packages/common/src/scopeSupportFacets/yaml.ts index faed5596ff..d12e609d85 100644 --- a/packages/common/src/scopeSupportFacets/yaml.ts +++ b/packages/common/src/scopeSupportFacets/yaml.ts @@ -139,6 +139,7 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "name.assignment": notApplicable, "name.assignment.pattern": notApplicable, "name.class": notApplicable, + "name.namespace": notApplicable, "name.constructor": notApplicable, "name.field": notApplicable, "name.foreach": notApplicable, diff --git a/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx b/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx index cf6e328049..b716acd6a7 100644 --- a/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx +++ b/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx @@ -25,7 +25,11 @@ export function MissingLanguageScopes(): React.JSX.Element { {languageIds.map((languageId) => ( - + ))} ); @@ -46,6 +50,7 @@ function Language({ const unspecifiedFacets = scopeSupportFacets.filter( (facet) => scopeSupport[facet] == null, ); + const unsupportedScopes = facetsToScopes(unsupportedFacets, showPrivate); const unspecifiedScopes = facetsToScopes(unspecifiedFacets, showPrivate); @@ -73,11 +78,7 @@ function renderFacets( title: string, scopes: string[], ): React.JSX.Element | null { - const [open, setOpen] = useState(false); - - useEffect(() => { - setOpen(scopes.length < 4); - }, [scopes]); + const [open, setOpen] = useState(scopes.length < 4); if (scopes.length === 0) { return null; From d5491b9cc0dbf6df95a2d91b142d4ee57f3b8b43 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 30 Jun 2025 14:57:01 +0200 Subject: [PATCH 7/7] Remove unused import --- .../src/docs/contributing/MissingLanguageScopes.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx b/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx index b716acd6a7..dd7ef16a07 100644 --- a/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx +++ b/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx @@ -7,7 +7,7 @@ import { type ScopeType, type SimpleScopeTypeType, } from "@cursorless/common"; -import React, { useEffect, useState } from "react"; +import React, { useState } from "react"; export function MissingLanguageScopes(): React.JSX.Element { const [showPrivate, setShowPrivate] = useState(false);