From 1522570d79a3faea1ed6ea5eb6ad71e6306756b5 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 15 Aug 2025 12:32:44 +0200 Subject: [PATCH 1/2] Remove interior.ternary scope facet --- .../scopes/c/interior/interior.ternary.scope | 28 ------------- .../csharp/interior/interior.ternary.scope | 28 ------------- .../java/interior/interior.ternary.scope | 28 ------------- .../interior/interior.ternary.scope | 28 ------------- .../python/interior/interior.ternary.scope | 34 --------------- packages/common/src/scopeSupportFacets/c.ts | 1 - .../common/src/scopeSupportFacets/csharp.ts | 1 - packages/common/src/scopeSupportFacets/css.ts | 1 - .../common/src/scopeSupportFacets/html.ts | 1 - .../common/src/scopeSupportFacets/java.ts | 1 - .../src/scopeSupportFacets/javascript.ts | 1 - .../common/src/scopeSupportFacets/json.ts | 1 - .../common/src/scopeSupportFacets/markdown.ts | 1 - .../common/src/scopeSupportFacets/python.ts | 1 - 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 - queries/c.scm | 15 ++----- queries/csharp.scm | 10 ++--- queries/java.scm | 18 ++++---- queries/javascript.core.scm | 10 ++--- queries/python.scm | 41 ++++++------------- 25 files changed, 29 insertions(+), 229 deletions(-) delete mode 100644 data/fixtures/scopes/c/interior/interior.ternary.scope delete mode 100644 data/fixtures/scopes/csharp/interior/interior.ternary.scope delete mode 100644 data/fixtures/scopes/java/interior/interior.ternary.scope delete mode 100644 data/fixtures/scopes/javascript.core/interior/interior.ternary.scope delete mode 100644 data/fixtures/scopes/python/interior/interior.ternary.scope diff --git a/data/fixtures/scopes/c/interior/interior.ternary.scope b/data/fixtures/scopes/c/interior/interior.ternary.scope deleted file mode 100644 index 486ca84b01..0000000000 --- a/data/fixtures/scopes/c/interior/interior.ternary.scope +++ /dev/null @@ -1,28 +0,0 @@ -true ? 0 : 1 ---- - -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-0:4 - >----< -0| true ? 0 : 1 - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:7-0:8 - >-< -0| true ? 0 : 1 - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 0:11-0:12 - >-< -0| true ? 0 : 1 - -[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.ternary.scope b/data/fixtures/scopes/csharp/interior/interior.ternary.scope deleted file mode 100644 index 79ef01735b..0000000000 --- a/data/fixtures/scopes/csharp/interior/interior.ternary.scope +++ /dev/null @@ -1,28 +0,0 @@ -true ? 1 : 0; ---- - -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-0:4 - >----< -0| true ? 1 : 0; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:7-0:8 - >-< -0| true ? 1 : 0; - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 0:11-0:12 - >-< -0| true ? 1 : 0; - -[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.ternary.scope b/data/fixtures/scopes/java/interior/interior.ternary.scope deleted file mode 100644 index 79ef01735b..0000000000 --- a/data/fixtures/scopes/java/interior/interior.ternary.scope +++ /dev/null @@ -1,28 +0,0 @@ -true ? 1 : 0; ---- - -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-0:4 - >----< -0| true ? 1 : 0; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:7-0:8 - >-< -0| true ? 1 : 0; - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 0:11-0:12 - >-< -0| true ? 1 : 0; - -[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.ternary.scope b/data/fixtures/scopes/javascript.core/interior/interior.ternary.scope deleted file mode 100644 index 79ef01735b..0000000000 --- a/data/fixtures/scopes/javascript.core/interior/interior.ternary.scope +++ /dev/null @@ -1,28 +0,0 @@ -true ? 1 : 0; ---- - -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-0:4 - >----< -0| true ? 1 : 0; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:7-0:8 - >-< -0| true ? 1 : 0; - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 0:11-0:12 - >-< -0| true ? 1 : 0; - -[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.ternary.scope b/data/fixtures/scopes/python/interior/interior.ternary.scope deleted file mode 100644 index 5064299d24..0000000000 --- a/data/fixtures/scopes/python/interior/interior.ternary.scope +++ /dev/null @@ -1,34 +0,0 @@ -0 if True else 1 ---- - -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-0:1 - >-< -0| 0 if True else 1 - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:5-0:9 - >----< -0| 0 if True else 1 - -[#2 Domain] = 0:2-0:9 - >-------< -0| 0 if True else 1 - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:15-0:16 - >-< -0| 0 if True else 1 - -[#3 Domain] = 0:10-0:16 - >------< -0| 0 if True else 1 - -[#3 Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/c.ts b/packages/common/src/scopeSupportFacets/c.ts index a5601080d0..adf81af856 100644 --- a/packages/common/src/scopeSupportFacets/c.ts +++ b/packages/common/src/scopeSupportFacets/c.ts @@ -131,7 +131,6 @@ export const cCoreScopeSupport: LanguageScopeSupportFacetMap = { "interior.if": supported, "interior.switch": supported, "interior.switchCase": supported, - "interior.ternary": supported, "interior.for": supported, "interior.while": supported, "interior.doWhile": supported, diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index 2626d2fab1..4a987ccfde 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -220,7 +220,6 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = { "interior.doWhile": supported, "interior.switch": supported, "interior.switchCase": supported, - "interior.ternary": supported, "interior.try": supported, "collectionItem.unenclosed.singleLine": supported, diff --git a/packages/common/src/scopeSupportFacets/css.ts b/packages/common/src/scopeSupportFacets/css.ts index a4de015662..47a7ce520e 100644 --- a/packages/common/src/scopeSupportFacets/css.ts +++ b/packages/common/src/scopeSupportFacets/css.ts @@ -292,7 +292,6 @@ export const cssScopeSupport: LanguageScopeSupportFacetMap = { "branch.ternary": notApplicable, "branch.ternary.iteration": notApplicable, "condition.ternary": notApplicable, - "interior.ternary": notApplicable, // Section section: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/html.ts b/packages/common/src/scopeSupportFacets/html.ts index e5a7feb120..1219c0e752 100644 --- a/packages/common/src/scopeSupportFacets/html.ts +++ b/packages/common/src/scopeSupportFacets/html.ts @@ -284,7 +284,6 @@ export const htmlScopeSupport: LanguageScopeSupportFacetMap = { "branch.ternary": notApplicable, "branch.ternary.iteration": notApplicable, "condition.ternary": notApplicable, - "interior.ternary": notApplicable, // Section section: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/java.ts b/packages/common/src/scopeSupportFacets/java.ts index f02bd3b2d5..78f68869f7 100644 --- a/packages/common/src/scopeSupportFacets/java.ts +++ b/packages/common/src/scopeSupportFacets/java.ts @@ -198,7 +198,6 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = { "interior.doWhile": supported, "interior.switch": supported, "interior.switchCase": supported, - "interior.ternary": supported, "interior.try": supported, "interior.resource": supported, "interior.static": supported, diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index 32116a4e78..b599a9a38a 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -192,7 +192,6 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "interior.doWhile": supported, "interior.switch": supported, "interior.switchCase": supported, - "interior.ternary": supported, "interior.try": supported, "interior.static": supported, diff --git a/packages/common/src/scopeSupportFacets/json.ts b/packages/common/src/scopeSupportFacets/json.ts index 8c3bdc91cf..7a880c6be7 100644 --- a/packages/common/src/scopeSupportFacets/json.ts +++ b/packages/common/src/scopeSupportFacets/json.ts @@ -271,7 +271,6 @@ export const jsonScopeSupport: LanguageScopeSupportFacetMap = { "branch.ternary": notApplicable, "branch.ternary.iteration": notApplicable, "condition.ternary": notApplicable, - "interior.ternary": notApplicable, // Section section: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/markdown.ts b/packages/common/src/scopeSupportFacets/markdown.ts index bad6a64bc9..e257e5bc00 100644 --- a/packages/common/src/scopeSupportFacets/markdown.ts +++ b/packages/common/src/scopeSupportFacets/markdown.ts @@ -287,7 +287,6 @@ export const markdownScopeSupport: LanguageScopeSupportFacetMap = { "branch.ternary": notApplicable, "branch.ternary.iteration": notApplicable, "condition.ternary": notApplicable, - "interior.ternary": notApplicable, // Element element: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/python.ts b/packages/common/src/scopeSupportFacets/python.ts index f198b0d519..c624909643 100644 --- a/packages/common/src/scopeSupportFacets/python.ts +++ b/packages/common/src/scopeSupportFacets/python.ts @@ -148,7 +148,6 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = { "interior.try": supported, "interior.switch": supported, "interior.switchCase": supported, - "interior.ternary": supported, "interior.foreach": supported, "interior.while": supported, "interior.resource": supported, diff --git a/packages/common/src/scopeSupportFacets/scm.ts b/packages/common/src/scopeSupportFacets/scm.ts index 112090e022..c7047363bf 100644 --- a/packages/common/src/scopeSupportFacets/scm.ts +++ b/packages/common/src/scopeSupportFacets/scm.ts @@ -278,7 +278,6 @@ export const scmScopeSupport: LanguageScopeSupportFacetMap = { "branch.ternary": notApplicable, "branch.ternary.iteration": notApplicable, "condition.ternary": notApplicable, - "interior.ternary": notApplicable, // Section section: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts index 11991aff2b..827f5c12ed 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts @@ -1003,10 +1003,6 @@ export const scopeSupportFacetInfos: Record< description: "The body of a switch case branch", scopeType: { type: "interior" }, }, - "interior.ternary": { - description: "The body of a ternary condition/branch", - scopeType: { type: "interior" }, - }, "interior.for": { description: "The body of a for loop", scopeType: { type: "interior" }, diff --git a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts index 889ced90d8..455740f6f9 100644 --- a/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts +++ b/packages/common/src/scopeSupportFacets/scopeSupportFacets.types.ts @@ -274,7 +274,6 @@ export const scopeSupportFacets = [ "interior.try", "interior.switch", "interior.switchCase", - "interior.ternary", "interior.for", "interior.foreach", "interior.while", diff --git a/packages/common/src/scopeSupportFacets/talon.ts b/packages/common/src/scopeSupportFacets/talon.ts index a8891ade14..ee3385a8f8 100644 --- a/packages/common/src/scopeSupportFacets/talon.ts +++ b/packages/common/src/scopeSupportFacets/talon.ts @@ -289,7 +289,6 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = { "branch.ternary": notApplicable, "branch.ternary.iteration": notApplicable, "condition.ternary": notApplicable, - "interior.ternary": notApplicable, // Section section: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/xml.ts b/packages/common/src/scopeSupportFacets/xml.ts index 7f55d3b1a2..e4bb0a0a93 100644 --- a/packages/common/src/scopeSupportFacets/xml.ts +++ b/packages/common/src/scopeSupportFacets/xml.ts @@ -284,7 +284,6 @@ export const xmlScopeSupport: LanguageScopeSupportFacetMap = { "branch.ternary": notApplicable, "branch.ternary.iteration": notApplicable, "condition.ternary": notApplicable, - "interior.ternary": notApplicable, // Section section: notApplicable, diff --git a/packages/common/src/scopeSupportFacets/yaml.ts b/packages/common/src/scopeSupportFacets/yaml.ts index 4cffd5f301..7687cc114b 100644 --- a/packages/common/src/scopeSupportFacets/yaml.ts +++ b/packages/common/src/scopeSupportFacets/yaml.ts @@ -280,7 +280,6 @@ export const yamlScopeSupport: LanguageScopeSupportFacetMap = { "branch.ternary": notApplicable, "branch.ternary.iteration": notApplicable, "condition.ternary": notApplicable, - "interior.ternary": notApplicable, // Section section: notApplicable, diff --git a/queries/c.scm b/queries/c.scm index 8b0549ccb7..71e3d54b3e 100644 --- a/queries/c.scm +++ b/queries/c.scm @@ -433,20 +433,13 @@ ;;!! true ? 0 : 1 ;;! ^^^^ +;;! ^ ^ (conditional_expression - condition: (_) @condition @interior + condition: (_) @condition + consequence: (_) @branch ) @condition.domain @branch.iteration - -;;!! true ? 0 : 1 -;;! ^ -(conditional_expression - consequence: (_) @branch @interior -) - -;;!! true ? 0 : 1 -;;! ^ (conditional_expression - alternative: (_) @branch @interior + alternative: (_) @branch ) ;;!! int foo, bar; diff --git a/queries/csharp.scm b/queries/csharp.scm index fb891cbe03..20dea66899 100644 --- a/queries/csharp.scm +++ b/queries/csharp.scm @@ -178,15 +178,11 @@ ;;! ^^^^ ;;! ^ ^ (conditional_expression - condition: (_) @condition @interior + condition: (_) @condition + consequence: (_) @branch ) @condition.domain @branch.iteration - -(conditional_expression - consequence: (_) @branch @interior -) - (conditional_expression - alternative: (_) @branch @interior + alternative: (_) @branch ) ;;!! class Foo {} diff --git a/queries/java.scm b/queries/java.scm index cf7a62a6af..197efcc94b 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -323,21 +323,17 @@ (#child-range! @value 0 -1 true true) ) @_.domain -;;!! true ? 1 : 2 +;;!! true ? 0 : 1 +;;! ^^^^ +;;! ^ ^ (ternary_expression - condition: (_) @condition @interior -) @condition.domain -(ternary_expression - consequence: (_) @branch @interior -) + condition: (_) @condition + consequence: (_) @branch +) @condition.domain @branch.iteration (ternary_expression - alternative: (_) @branch @interior + alternative: (_) @branch ) -;;!! true ? 1 : 2 -;;! ^^^^^^^^^^^^ -(ternary_expression) @branch.iteration - ;;!! void myFunk(int value) {} ;;! ^^^^^ ;;! ------------------------- diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index e08c256eb7..21d402ccaf 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -630,15 +630,11 @@ ;;! ^ ^ ;;! ------------- (ternary_expression - condition: (_) @condition @interior + condition: (_) @condition + consequence: (_) @branch ) @condition.domain @branch.iteration - -(ternary_expression - consequence: (_) @branch @interior -) - (ternary_expression - alternative: (_) @branch @interior + alternative: (_) @branch ) ;;!! for (let i = 0; i < 2; ++i) {} diff --git a/queries/python.scm b/queries/python.scm index b46c72c8d1..eaf072cc30 100644 --- a/queries/python.scm +++ b/queries/python.scm @@ -446,37 +446,20 @@ ;;!! 1 if True else 0 ;;! ^^^^ -;;! ---------------- -( - (conditional_expression - "if" @interior.domain.start - . - (_) @condition @interior @interior.domain.end - ) @condition.domain -) - -;;!! 1 if True else 0 -;;! ^ -( - (conditional_expression - (_) @branch @interior - . - "if" - ) -) - -;;!! 1 if True else 0 -;;! ^ -( - (conditional_expression - "else" @interior.domain.start - . - (_) @branch @interior @interior.domain.end - ) +;;! ^ ^ +(conditional_expression + . + (_) @branch + . + "if" + . + (_) @condition +) @condition.domain @branch.iteration +(conditional_expression + (_) @branch + . ) -(conditional_expression) @branch.iteration - ;;!! [aaa for aaa in bbb if ccc] ;;!! (aaa for aaa in bbb if ccc) ;;!! {aaa for aaa in bbb if ccc} From 810307d5d5e5be65ba400c1b5b0d1cbb9db920c8 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 15 Aug 2025 12:37:05 +0200 Subject: [PATCH 2/2] Ran Meta Updater --- data/scopeSupportFacetInfos.md | 1 - 1 file changed, 1 deletion(-) diff --git a/data/scopeSupportFacetInfos.md b/data/scopeSupportFacetInfos.md index b0af33f45d..14bab1773d 100644 --- a/data/scopeSupportFacetInfos.md +++ b/data/scopeSupportFacetInfos.md @@ -185,7 +185,6 @@ - `interior.surroundingPair` The interior scope of a surrounding pair - `interior.switch` The body of a switch statement - `interior.switchCase` The body of a switch case branch -- `interior.ternary` The body of a ternary condition/branch - `interior.try` The body of a try/catch/finally branch - `interior.while` The body of a while loop