From 38fbf06986534fa468768329a82c1c4ecd7d5440 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 31 Oct 2025 10:29:21 +0100 Subject: [PATCH 01/38] Added interior range to Tree sitter scope type targets --- .../scopes/java/interior/interior.enum.scope | 20 ++++--------------- .../java/statement/statement.enum.scope | 4 ++++ .../TreeSitterScopeHandler.ts | 2 ++ .../processTargets/targets/ScopeTypeTarget.ts | 17 ++++++++++++++++ .../targets/SurroundingPairTarget.ts | 2 ++ queries/java.scm | 10 +++++----- 6 files changed, 34 insertions(+), 21 deletions(-) diff --git a/data/fixtures/scopes/java/interior/interior.enum.scope b/data/fixtures/scopes/java/interior/interior.enum.scope index 3f2fdbd802..412dd490fc 100644 --- a/data/fixtures/scopes/java/interior/interior.enum.scope +++ b/data/fixtures/scopes/java/interior/interior.enum.scope @@ -1,25 +1,13 @@ public enum Foo { } --- -[#1 Content] = -[#1 Removal] = 0:17-0:18 +[Content] = +[Removal] = 0:17-0:18 >-< 0| public enum Foo { } -[#1 Domain] = 0:0-0:19 - >-------------------< -0| public enum Foo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:17-0:18 - >-< -0| public enum Foo { } - -[#2 Domain] = 0:16-0:19 +[Domain] = 0:16-0:19 >---< 0| public enum Foo { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/statement/statement.enum.scope b/data/fixtures/scopes/java/statement/statement.enum.scope index 6b95327386..e5b0f719b3 100644 --- a/data/fixtures/scopes/java/statement/statement.enum.scope +++ b/data/fixtures/scopes/java/statement/statement.enum.scope @@ -7,4 +7,8 @@ public enum Foo {} >------------------< 0| public enum Foo {} +[Interior] = 0:17-0:17 + >< +0| public enum Foo {} + [Insertion delimiter] = "\n" diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts index 1fead109cd..9a94361077 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts @@ -75,6 +75,7 @@ export class TreeSitterScopeHandler extends BaseTreeSitterScopeHandler { )?.with(contentRange.end); let removalRange = getRelatedRange(match, scopeTypeType, "removal", true); + let interiorRange = getRelatedRange(match, scopeTypeType, "interior", true); if ( removalRange == null && @@ -102,6 +103,7 @@ export class TreeSitterScopeHandler extends BaseTreeSitterScopeHandler { contentRange, prefixRange, removalRange, + interiorRange, leadingDelimiterRange, trailingDelimiterRange, insertionDelimiter, diff --git a/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts b/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts index cf74c9854d..cc3d53419f 100644 --- a/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts @@ -7,6 +7,7 @@ import type { Target } from "../../typings/target.types"; import { toGeneralizedRange } from "../../util/targetUtils"; import type { CommonTargetParameters } from "./BaseTarget"; import { BaseTarget } from "./BaseTarget"; +import { InteriorTarget } from "./InteriorTarget"; import { PlainTarget } from "./PlainTarget"; import { getDelimitedSequenceRemovalRange } from "./util/insertionRemovalBehaviors/DelimitedSequenceInsertionRemovalBehavior"; import { @@ -20,6 +21,7 @@ export interface ScopeTypeTargetParameters extends CommonTargetParameters { readonly insertionDelimiter?: string; readonly prefixRange?: Range; readonly removalRange?: Range; + readonly interiorRange?: Range; readonly leadingDelimiterRange?: Range; readonly trailingDelimiterRange?: Range; } @@ -28,6 +30,7 @@ export class ScopeTypeTarget extends BaseTarget { type = "ScopeTypeTarget"; private scopeTypeType_: SimpleScopeTypeType; private removalRange_?: Range; + private interiorRange_?: Range; private leadingDelimiterRange_?: Range; private trailingDelimiterRange_?: Range; private hasDelimiterRange_: boolean; @@ -38,6 +41,7 @@ export class ScopeTypeTarget extends BaseTarget { super(parameters); this.scopeTypeType_ = parameters.scopeTypeType; this.removalRange_ = parameters.removalRange; + this.interiorRange_ = parameters.interiorRange; this.leadingDelimiterRange_ = parameters.leadingDelimiterRange; this.trailingDelimiterRange_ = parameters.trailingDelimiterRange; this.prefixRange = parameters.prefixRange; @@ -96,6 +100,19 @@ export class ScopeTypeTarget extends BaseTarget { return getSmartRemovalTarget(this).getRemovalHighlightRange(); } + getInterior(): Target[] | undefined { + if (this.interiorRange_ == null) { + return undefined; + } + return [ + new InteriorTarget({ + editor: this.editor, + isReversed: this.isReversed, + fullInteriorRange: this.interiorRange_, + }), + ]; + } + maybeCreateRichRangeTarget( isReversed: boolean, endTarget: ScopeTypeTarget, diff --git a/packages/cursorless-engine/src/processTargets/targets/SurroundingPairTarget.ts b/packages/cursorless-engine/src/processTargets/targets/SurroundingPairTarget.ts index cb412b84ff..a1f24e658b 100644 --- a/packages/cursorless-engine/src/processTargets/targets/SurroundingPairTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/SurroundingPairTarget.ts @@ -41,9 +41,11 @@ export class SurroundingPairTarget extends BaseTarget Date: Fri, 31 Oct 2025 10:55:31 +0100 Subject: [PATCH 02/38] Update interior scope handler --- .../command/PartialTargetDescriptor.types.ts | 6 -- .../processTargets/modifiers/HeadTailStage.ts | 1 - .../processTargets/modifiers/InteriorStage.ts | 12 ++-- .../InteriorScopeHandler.ts | 55 ++++--------------- 4 files changed, 20 insertions(+), 54 deletions(-) diff --git a/packages/common/src/types/command/PartialTargetDescriptor.types.ts b/packages/common/src/types/command/PartialTargetDescriptor.types.ts index cbb68b08a9..7b48bf7919 100644 --- a/packages/common/src/types/command/PartialTargetDescriptor.types.ts +++ b/packages/common/src/types/command/PartialTargetDescriptor.types.ts @@ -237,12 +237,6 @@ export interface CustomRegexScopeType { export interface InteriorScopeType { type: "interior"; - - // The user has specified a scope type. eg "inside element". - explicitScopeType?: boolean; - - // Gets passed to surrounding pair scope handler - requireStrongContainment?: boolean; } export type SurroundingPairDirection = "left" | "right"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts index 964314cee8..641dc43b71 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts @@ -101,7 +101,6 @@ class BoundedLineStage implements ModifierStage { try { return this.getContaining(target, options, { type: "interior", - requireStrongContainment: true, }); } catch (error) { if (error instanceof NoContainingScopeError) { diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts index 59ce7bd31b..e917664123 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts @@ -1,6 +1,7 @@ -import type { - ExcludeInteriorModifier, - InteriorOnlyModifier, +import { + NoContainingScopeError, + type ExcludeInteriorModifier, + type InteriorOnlyModifier, } from "@cursorless/common"; import type { Target } from "../../typings/target.types"; import type { ModifierStageFactory } from "../ModifierStageFactory"; @@ -23,11 +24,14 @@ export class InteriorOnlyStage implements ModifierStage { return interior; } + if (target.hasExplicitScopeType) { + throw new NoContainingScopeError("interior"); + } + const containingModifier = this.modifierHandlerFactory.create({ type: "containingScope", scopeType: { type: "interior", - explicitScopeType: target.hasExplicitScopeType, }, }); diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts index 65896065f8..0a084088e5 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts @@ -10,7 +10,6 @@ import type { LanguageDefinitions } from "../../../../languages/LanguageDefiniti import type { Target } from "../../../../typings/target.types"; import { InteriorTarget } from "../../../targets"; import { BaseScopeHandler } from "../BaseScopeHandler"; -import { FallbackScopeHandler } from "../FallbackScopeHandler"; import type { TargetScope } from "../scope.types"; import type { ComplexScopeType, @@ -59,9 +58,7 @@ export class InteriorScopeHandler extends BaseScopeHandler { ); for (const scope of scopes) { - if (this.shouldYield(targetDomain, scope)) { - yield createInteriorScope(scope); - } + yield createInteriorScope(scope); } } @@ -72,28 +69,12 @@ export class InteriorScopeHandler extends BaseScopeHandler { const pairScopeHandler = this.scopeHandlerFactory.create( { - type: "surroundingPair", + type: "surroundingPairInterior", delimiter: "any", - requireStrongContainment: this.scopeType.requireStrongContainment, }, this.languageId, ); - // If the scope type is explicit (ie, the user has specified a scope - // type), then we want to prioritize language scopes. For example, - // if the user says "inside element" inside a `
` tag, the angle - // brackets of the tag are also a surrounding pair which should have - // lower priority. - if (this.scopeType.explicitScopeType) { - if (languageScopeHandler == null) { - return pairScopeHandler; - } - return FallbackScopeHandler.createFromScopeHandlers([ - languageScopeHandler, - pairScopeHandler, - ]); - } - if (languageScopeHandler == null) { return pairScopeHandler; } @@ -101,16 +82,7 @@ export class InteriorScopeHandler extends BaseScopeHandler { return SortedScopeHandler.createFromScopeHandlers( this.scopeHandlerFactory, this.languageId, - [pairScopeHandler, languageScopeHandler], - ); - } - - private shouldYield(targetDomain: Range, scope: TargetScope): boolean { - // For an explicit scope type we only yield scopes that are contained within - // the target domain. For example, if the user said "inside token", we don't - // want to yield scopes that are larger than the token. - return ( - !this.scopeType.explicitScopeType || targetDomain.contains(scope.domain) + [languageScopeHandler, pairScopeHandler], ); } } @@ -120,21 +92,18 @@ function createInteriorScope(scope: TargetScope): TargetScope { editor: scope.editor, domain: scope.domain, getTargets(isReversed) { - return scope.getTargets(isReversed).flatMap(createInteriorTargets); + return scope.getTargets(isReversed).map(createInteriorTarget); }, }; } -function createInteriorTargets(target: Target): Target[] { - const interior = target.getInterior(); - if (interior != null) { - return interior; +function createInteriorTarget(target: Target): Target { + if (target instanceof InteriorTarget) { + return target; } - return [ - new InteriorTarget({ - editor: target.editor, - isReversed: target.isReversed, - fullInteriorRange: target.contentRange, - }), - ]; + return new InteriorTarget({ + editor: target.editor, + isReversed: target.isReversed, + fullInteriorRange: target.contentRange, + }); } From fd1577d409971ad4795d9a866b5eb049f67a41b0 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 31 Oct 2025 10:56:31 +0100 Subject: [PATCH 03/38] Update comment --- queries/java.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries/java.scm b/queries/java.scm index 35ff94f492..6a390ffda3 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -36,7 +36,7 @@ ;; exceptions ;; ";", ;; "block", - ;; (declaration) + ;; (declaration) ;; Is a compound of all other declarations ;; Disabled on purpose. We have a better definition of this below. ;; (if_statement) From b3e6f75e14a4112bf1ed42e28ab3dd4683ea3984 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 09:05:56 +0100 Subject: [PATCH 04/38] Update Java --- .../scopes/java/interior/interior.class.scope | 23 +--- .../java/interior/interior.constructor.scope | 57 ++------ .../java/interior/interior.doWhile.scope | 28 +--- .../scopes/java/interior/interior.enum.scope | 7 +- .../scopes/java/interior/interior.for.scope | 30 +---- .../java/interior/interior.foreach.scope | 30 +---- .../scopes/java/interior/interior.if.scope | 81 +++-------- .../java/interior/interior.interface.scope | 23 +--- .../java/interior/interior.lambda.scope | 26 +--- .../java/interior/interior.method.scope | 57 ++------ .../java/interior/interior.resource.scope | 39 ++---- .../java/interior/interior.static.scope | 48 +------ .../java/interior/interior.switch.scope | 30 +---- .../java/interior/interior.switchCase.scope | 126 +++++------------- .../java/interior/interior.switchCase2.scope | 112 +++++----------- .../scopes/java/interior/interior.try.scope | 70 ++-------- .../scopes/java/interior/interior.while.scope | 30 +---- .../java/statement/statement.enum.scope | 4 - queries/java.scm | 65 +++------ 19 files changed, 189 insertions(+), 697 deletions(-) diff --git a/data/fixtures/scopes/java/interior/interior.class.scope b/data/fixtures/scopes/java/interior/interior.class.scope index 48ed5df4de..eb86a1744f 100644 --- a/data/fixtures/scopes/java/interior/interior.class.scope +++ b/data/fixtures/scopes/java/interior/interior.class.scope @@ -1,25 +1,10 @@ public class Foo { } --- -[#1 Content] = -[#1 Removal] = 0:18-0:19 +[Content] = +[Removal] = +[Domain] = 0:18-0:19 >-< 0| public class Foo { } -[#1 Domain] = 0:0-0:20 - >--------------------< -0| public class Foo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:18-0:19 - >-< -0| public class Foo { } - -[#2 Domain] = 0:17-0:20 - >---< -0| public class Foo { } - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.constructor.scope b/data/fixtures/scopes/java/interior/interior.constructor.scope index d14e67d342..58653a0c37 100644 --- a/data/fixtures/scopes/java/interior/interior.constructor.scope +++ b/data/fixtures/scopes/java/interior/interior.constructor.scope @@ -14,68 +14,29 @@ public class Foo { 2| } < -[#1 Domain] = 0:0-2:1 - >------------------ +[#1 Domain] = 0:18-2:0 + > 0| public class Foo { 1| public Foo() { } 2| } - -< + < [#1 Insertion delimiter] = " " -[#2 Content] = 1:4-1:20 - >----------------< -1| public Foo() { } - -[#2 Removal] = 0:18-2:0 - > -0| public class Foo { -1| public Foo() { } -2| } - < - -[#2 Domain] = 0:17-2:1 - >- -0| public class Foo { +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:15-1:15 + >< 1| public Foo() { } -2| } - -< [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:18-1:19 +[#3 Removal] = +[#3 Domain] = 1:18-1:19 >-< 1| public Foo() { } -[#3 Domain] = 1:4-1:20 - >----------------< -1| public Foo() { } - [#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 1:15-1:15 - >< -1| public Foo() { } - -[#4 Domain] = 1:14-1:16 - >--< -1| public Foo() { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:18-1:19 - >-< -1| public Foo() { } - -[#5 Domain] = 1:17-1:20 - >---< -1| public Foo() { } - -[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.doWhile.scope b/data/fixtures/scopes/java/interior/interior.doWhile.scope index d1833e59d1..691176c939 100644 --- a/data/fixtures/scopes/java/interior/interior.doWhile.scope +++ b/data/fixtures/scopes/java/interior/interior.doWhile.scope @@ -2,36 +2,18 @@ do { } while (true); --- [#1 Content] = -[#1 Removal] = 0:4-0:5 +[#1 Removal] = +[#1 Domain] = 0:4-0:5 >-< 0| do { } while (true); -[#1 Domain] = 0:0-0:20 - >--------------------< -0| do { } while (true); - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:4-0:5 - >-< -0| do { } while (true); - -[#2 Domain] = 0:3-0:6 - >---< -0| do { } while (true); - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:14-0:18 +[#2 Removal] = +[#2 Domain] = 0:14-0:18 >----< 0| do { } while (true); -[#3 Domain] = 0:13-0:19 - >------< -0| do { } while (true); - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.enum.scope b/data/fixtures/scopes/java/interior/interior.enum.scope index 412dd490fc..6818ae7bf5 100644 --- a/data/fixtures/scopes/java/interior/interior.enum.scope +++ b/data/fixtures/scopes/java/interior/interior.enum.scope @@ -2,12 +2,9 @@ public enum Foo { } --- [Content] = -[Removal] = 0:17-0:18 +[Removal] = +[Domain] = 0:17-0:18 >-< 0| public enum Foo { } -[Domain] = 0:16-0:19 - >---< -0| public enum Foo { } - [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.for.scope b/data/fixtures/scopes/java/interior/interior.for.scope index e1cf88df36..54b2d5db85 100644 --- a/data/fixtures/scopes/java/interior/interior.for.scope +++ b/data/fixtures/scopes/java/interior/interior.for.scope @@ -2,36 +2,18 @@ for (int i = 0; i < size; ++i) { } --- [#1 Content] = -[#1 Removal] = 0:32-0:33 - >-< -0| for (int i = 0; i < size; ++i) { } - -[#1 Domain] = 0:0-0:34 - >----------------------------------< +[#1 Removal] = +[#1 Domain] = 0:5-0:29 + >------------------------< 0| for (int i = 0; i < size; ++i) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:29 - >------------------------< -0| for (int i = 0; i < size; ++i) { } - -[#2 Domain] = 0:4-0:30 - >--------------------------< -0| for (int i = 0; i < size; ++i) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:32-0:33 +[#2 Removal] = +[#2 Domain] = 0:32-0:33 >-< 0| for (int i = 0; i < size; ++i) { } -[#3 Domain] = 0:31-0:34 - >---< -0| for (int i = 0; i < size; ++i) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.foreach.scope b/data/fixtures/scopes/java/interior/interior.foreach.scope index 4d90296637..b375427667 100644 --- a/data/fixtures/scopes/java/interior/interior.foreach.scope +++ b/data/fixtures/scopes/java/interior/interior.foreach.scope @@ -2,36 +2,18 @@ for (int v : values) { } --- [#1 Content] = -[#1 Removal] = 0:22-0:23 - >-< -0| for (int v : values) { } - -[#1 Domain] = 0:0-0:24 - >------------------------< +[#1 Removal] = +[#1 Domain] = 0:5-0:19 + >--------------< 0| for (int v : values) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:19 - >--------------< -0| for (int v : values) { } - -[#2 Domain] = 0:4-0:20 - >----------------< -0| for (int v : values) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:22-0:23 +[#2 Removal] = +[#2 Domain] = 0:22-0:23 >-< 0| for (int v : values) { } -[#3 Domain] = 0:21-0:24 - >---< -0| for (int v : values) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.if.scope b/data/fixtures/scopes/java/interior/interior.if.scope index 52ac91931a..22a989ae6d 100644 --- a/data/fixtures/scopes/java/interior/interior.if.scope +++ b/data/fixtures/scopes/java/interior/interior.if.scope @@ -4,96 +4,45 @@ else { } --- [#1 Content] = -[#1 Removal] = 0:11-0:12 - >-< -0| if (true) { } - -[#1 Domain] = 0:0-0:13 - >-------------< +[#1 Removal] = +[#1 Domain] = 0:4-0:8 + >----< 0| if (true) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:4-0:8 - >----< -0| if (true) { } - -[#2 Domain] = 0:3-0:9 - >------< +[#2 Removal] = +[#2 Domain] = 0:11-0:12 + >-< 0| if (true) { } [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 0:11-0:12 - >-< -0| if (true) { } - -[#3 Domain] = 0:10-0:13 - >---< -0| if (true) { } +[#3 Removal] = +[#3 Domain] = 1:9-1:14 + >-----< +1| else if (false) { } [#3 Insertion delimiter] = " " [#4 Content] = -[#4 Removal] = 1:17-1:18 +[#4 Removal] = +[#4 Domain] = 1:17-1:18 >-< 1| else if (false) { } -[#4 Domain] = 1:0-1:19 - >-------------------< -1| else if (false) { } - [#4 Insertion delimiter] = " " [#5 Content] = -[#5 Removal] = 1:9-1:14 - >-----< -1| else if (false) { } - -[#5 Domain] = 1:8-1:15 - >-------< -1| else if (false) { } - -[#5 Insertion delimiter] = " " - - -[#6 Content] = -[#6 Removal] = 1:17-1:18 - >-< -1| else if (false) { } - -[#6 Domain] = 1:16-1:19 - >---< -1| else if (false) { } - -[#6 Insertion delimiter] = " " - - -[#7 Content] = -[#7 Removal] = 2:6-2:7 +[#5 Removal] = +[#5 Domain] = 2:6-2:7 >-< 2| else { } -[#7 Domain] = 2:0-2:8 - >--------< -2| else { } - -[#7 Insertion delimiter] = " " - - -[#8 Content] = -[#8 Removal] = 2:6-2:7 - >-< -2| else { } - -[#8 Domain] = 2:5-2:8 - >---< -2| else { } - -[#8 Insertion delimiter] = " " +[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.interface.scope b/data/fixtures/scopes/java/interior/interior.interface.scope index cf483fb76d..ee0b6c177f 100644 --- a/data/fixtures/scopes/java/interior/interior.interface.scope +++ b/data/fixtures/scopes/java/interior/interior.interface.scope @@ -1,25 +1,10 @@ public interface Foo { } --- -[#1 Content] = -[#1 Removal] = 0:22-0:23 +[Content] = +[Removal] = +[Domain] = 0:22-0:23 >-< 0| public interface Foo { } -[#1 Domain] = 0:0-0:24 - >------------------------< -0| public interface Foo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:22-0:23 - >-< -0| public interface Foo { } - -[#2 Domain] = 0:21-0:24 - >---< -0| public interface Foo { } - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.lambda.scope b/data/fixtures/scopes/java/interior/interior.lambda.scope index 3066da5e6b..fdbbffb81e 100644 --- a/data/fixtures/scopes/java/interior/interior.lambda.scope +++ b/data/fixtures/scopes/java/interior/interior.lambda.scope @@ -2,36 +2,18 @@ --- [#1 Content] = -[#1 Removal] = 0:1-0:1 +[#1 Removal] = +[#1 Domain] = 0:1-0:1 >< 0| () -> { } -[#1 Domain] = 0:0-0:2 - >--< -0| () -> { } - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:7-0:8 +[#2 Removal] = +[#2 Domain] = 0:7-0:8 >-< 0| () -> { } -[#2 Domain] = 0:0-0:9 - >---------< -0| () -> { } - [#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:7-0:8 - >-< -0| () -> { } - -[#3 Domain] = 0:6-0:9 - >---< -0| () -> { } - -[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.method.scope b/data/fixtures/scopes/java/interior/interior.method.scope index 646639ab38..4e6ed3779b 100644 --- a/data/fixtures/scopes/java/interior/interior.method.scope +++ b/data/fixtures/scopes/java/interior/interior.method.scope @@ -14,68 +14,29 @@ public class Foo { 2| } < -[#1 Domain] = 0:0-2:1 - >------------------ +[#1 Domain] = 0:18-2:0 + > 0| public class Foo { 1| public void bar() { } 2| } - -< + < [#1 Insertion delimiter] = " " -[#2 Content] = 1:4-1:25 - >---------------------< -1| public void bar() { } - -[#2 Removal] = 0:18-2:0 - > -0| public class Foo { -1| public void bar() { } -2| } - < - -[#2 Domain] = 0:17-2:1 - >- -0| public class Foo { +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:20-1:20 + >< 1| public void bar() { } -2| } - -< [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:23-1:24 +[#3 Removal] = +[#3 Domain] = 1:23-1:24 >-< 1| public void bar() { } -[#3 Domain] = 1:4-1:25 - >---------------------< -1| public void bar() { } - [#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 1:20-1:20 - >< -1| public void bar() { } - -[#4 Domain] = 1:19-1:21 - >--< -1| public void bar() { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:23-1:24 - >-< -1| public void bar() { } - -[#5 Domain] = 1:22-1:25 - >---< -1| public void bar() { } - -[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.resource.scope b/data/fixtures/scopes/java/interior/interior.resource.scope index e487b6ad51..eedde64e4b 100644 --- a/data/fixtures/scopes/java/interior/interior.resource.scope +++ b/data/fixtures/scopes/java/interior/interior.resource.scope @@ -2,48 +2,27 @@ try (Foo bar = create()) { } --- [#1 Content] = -[#1 Removal] = 0:26-0:27 - >-< -0| try (Foo bar = create()) { } - -[#1 Domain] = 0:0-0:28 - >----------------------------< +[#1 Removal] = +[#1 Domain] = 0:5-0:23 + >------------------< 0| try (Foo bar = create()) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:23 - >------------------< -0| try (Foo bar = create()) { } - -[#2 Domain] = 0:4-0:24 - >--------------------< +[#2 Removal] = +[#2 Domain] = 0:22-0:22 + >< 0| try (Foo bar = create()) { } [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 0:22-0:22 - >< -0| try (Foo bar = create()) { } - -[#3 Domain] = 0:21-0:23 - >--< -0| try (Foo bar = create()) { } - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 0:26-0:27 +[#3 Removal] = +[#3 Domain] = 0:26-0:27 >-< 0| try (Foo bar = create()) { } -[#4 Domain] = 0:25-0:28 - >---< -0| try (Foo bar = create()) { } - -[#4 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.static.scope b/data/fixtures/scopes/java/interior/interior.static.scope index ec08e00aa5..7faf9b8a6c 100644 --- a/data/fixtures/scopes/java/interior/interior.static.scope +++ b/data/fixtures/scopes/java/interior/interior.static.scope @@ -14,56 +14,20 @@ class Foo { 2| } < -[#1 Domain] = 0:0-2:1 - >----------- -0| class Foo { -1| static { } -2| } - -< - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 1:4-1:14 - >----------< -1| static { } - -[#2 Removal] = 0:11-2:0 +[#1 Domain] = 0:11-2:0 > 0| class Foo { 1| static { } 2| } < -[#2 Domain] = 0:10-2:1 - >- -0| class Foo { -1| static { } -2| } - -< - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 1:12-1:13 - >-< -1| static { } - -[#3 Domain] = 1:4-1:14 - >----------< -1| static { } - -[#3 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#4 Content] = -[#4 Removal] = 1:12-1:13 +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:12-1:13 >-< 1| static { } -[#4 Domain] = 1:11-1:14 - >---< -1| static { } - -[#4 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.switch.scope b/data/fixtures/scopes/java/interior/interior.switch.scope index e2ad168b18..35e3f6a261 100644 --- a/data/fixtures/scopes/java/interior/interior.switch.scope +++ b/data/fixtures/scopes/java/interior/interior.switch.scope @@ -2,36 +2,18 @@ switch (value) { } --- [#1 Content] = -[#1 Removal] = 0:16-0:17 - >-< -0| switch (value) { } - -[#1 Domain] = 0:0-0:18 - >------------------< +[#1 Removal] = +[#1 Domain] = 0:8-0:13 + >-----< 0| switch (value) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:8-0:13 - >-----< -0| switch (value) { } - -[#2 Domain] = 0:7-0:14 - >-------< -0| switch (value) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:16-0:17 +[#2 Removal] = +[#2 Domain] = 0:16-0:17 >-< 0| switch (value) { } -[#3 Domain] = 0:15-0:18 - >---< -0| switch (value) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.switchCase.scope b/data/fixtures/scopes/java/interior/interior.switchCase.scope index 58797959fa..cdc927cbce 100644 --- a/data/fixtures/scopes/java/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/java/interior/interior.switchCase.scope @@ -10,62 +10,16 @@ switch (value) { } --- -[#1 Content] = 1:4-8:14 - >------- -1| case 0: -2| foo; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; - --------------< - -[#1 Removal] = 0:16-9:0 - > -0| switch (value) { -1| case 0: -2| foo; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - < - -[#1 Domain] = 0:0-9:1 - >---------------- -0| switch (value) { -1| case 0: -2| foo; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - -< - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:8-0:13 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:8-0:13 >-----< 0| switch (value) { -[#2 Domain] = 0:7-0:14 - >-------< -0| switch (value) { - -[#2 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#3 Content] = 1:4-8:14 +[#2 Content] = 1:4-8:14 >------- 1| case 0: 2| foo; @@ -77,7 +31,7 @@ switch (value) { 8| break; --------------< -[#3 Removal] = 0:16-9:0 +[#2 Removal] = 0:16-9:0 > 0| switch (value) { 1| case 0: @@ -91,8 +45,8 @@ switch (value) { 9| } < -[#3 Domain] = 0:15-9:1 - >- +[#2 Domain] = 0:16-9:0 + > 0| switch (value) { 1| case 0: 2| foo; @@ -103,79 +57,69 @@ switch (value) { 7| default: 8| break; 9| } - -< + < -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#4 Content] = -[#4 Removal] = 2:8-3:14 +[#3 Content] = 2:8-3:14 >---- 2| foo; 3| break; --------------< -[#4 Domain] = 1:4-3:14 - >------- +[#3 Removal] = 1:11-3:14 + > 1| case 0: 2| foo; 3| break; --------------< -[#4 Insertion delimiter] = " " +[#3 Domain] = 1:11-3:14 + > +1| case 0: +2| foo; +3| break; + --------------< + +[#3 Insertion delimiter] = " " -[#5 Content] = 5:8-5:14 +[#4 Content] = 5:8-5:14 >------< 5| break; -[#5 Removal] = 4:13-6:4 +[#4 Removal] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#5 Domain] = 4:4-6:5 - >--------- -4| case 1: { -5| break; -6| } - -----< - -[#5 Insertion delimiter] = " " - - -[#6 Content] = 5:8-5:14 - >------< -5| break; - -[#6 Removal] = 4:13-6:4 +[#4 Domain] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#6 Domain] = 4:12-6:5 - >- -4| case 1: { -5| break; -6| } - -----< - -[#6 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " -[#7 Content] = -[#7 Removal] = 8:8-8:14 +[#5 Content] = 8:8-8:14 >------< 8| break; -[#7 Domain] = 7:4-8:14 - >-------- +[#5 Removal] = 7:12-8:14 + > 7| default: 8| break; --------------< -[#7 Insertion delimiter] = " " +[#5 Domain] = 7:12-8:14 + > +7| default: +8| break; + --------------< + +[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.switchCase2.scope b/data/fixtures/scopes/java/interior/interior.switchCase2.scope index a0e22c3b8b..e78b6ed9d9 100644 --- a/data/fixtures/scopes/java/interior/interior.switchCase2.scope +++ b/data/fixtures/scopes/java/interior/interior.switchCase2.scope @@ -7,53 +7,16 @@ switch (foo) { } --- -[#1 Content] = 1:4-5:17 - >------------ -1| case 0 -> 1; -2| case 1 -> { -3| yield 2; -4| }; -5| default -> 3; - -----------------< - -[#1 Removal] = 0:14-6:0 - > -0| switch (foo) { -1| case 0 -> 1; -2| case 1 -> { -3| yield 2; -4| }; -5| default -> 3; -6| } - < - -[#1 Domain] = 0:0-6:1 - >-------------- -0| switch (foo) { -1| case 0 -> 1; -2| case 1 -> { -3| yield 2; -4| }; -5| default -> 3; -6| } - -< - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:8-0:11 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:8-0:11 >---< 0| switch (foo) { -[#2 Domain] = 0:7-0:12 - >-----< -0| switch (foo) { - -[#2 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#3 Content] = 1:4-5:17 +[#2 Content] = 1:4-5:17 >------------ 1| case 0 -> 1; 2| case 1 -> { @@ -62,7 +25,7 @@ switch (foo) { 5| default -> 3; -----------------< -[#3 Removal] = 0:14-6:0 +[#2 Removal] = 0:14-6:0 > 0| switch (foo) { 1| case 0 -> 1; @@ -73,8 +36,8 @@ switch (foo) { 6| } < -[#3 Domain] = 0:13-6:1 - >- +[#2 Domain] = 0:14-6:0 + > 0| switch (foo) { 1| case 0 -> 1; 2| case 1 -> { @@ -82,72 +45,57 @@ switch (foo) { 4| }; 5| default -> 3; 6| } - -< + < -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#4 Content] = -[#4 Removal] = 1:14-1:16 +[#3 Content] = 1:14-1:16 >--< 1| case 0 -> 1; -[#4 Domain] = 1:4-1:16 - >------------< +[#3 Removal] = 1:13-1:16 + >---< 1| case 0 -> 1; -[#4 Insertion delimiter] = " " +[#3 Domain] = 1:13-1:16 + >---< +1| case 0 -> 1; + +[#3 Insertion delimiter] = " " -[#5 Content] = 3:8-3:16 +[#4 Content] = 3:8-3:16 >--------< 3| yield 2; -[#5 Removal] = 2:15-4:4 +[#4 Removal] = 2:15-4:4 > 2| case 1 -> { 3| yield 2; 4| }; ----< -[#5 Domain] = 2:4-4:5 - >----------- -2| case 1 -> { -3| yield 2; -4| }; - -----< - -[#5 Insertion delimiter] = " " - - -[#6 Content] = 3:8-3:16 - >--------< -3| yield 2; - -[#6 Removal] = 2:15-4:4 +[#4 Domain] = 2:15-4:4 > 2| case 1 -> { 3| yield 2; 4| }; ----< -[#6 Domain] = 2:14-4:5 - >- -2| case 1 -> { -3| yield 2; -4| }; - -----< - -[#6 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " -[#7 Content] = -[#7 Removal] = 5:15-5:17 +[#5 Content] = 5:15-5:17 >--< 5| default -> 3; -[#7 Domain] = 5:4-5:17 - >-------------< +[#5 Removal] = 5:14-5:17 + >---< 5| default -> 3; -[#7 Insertion delimiter] = " " +[#5 Domain] = 5:14-5:17 + >---< +5| default -> 3; + +[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.try.scope b/data/fixtures/scopes/java/interior/interior.try.scope index 87dc4ae08a..d1ac2a76cc 100644 --- a/data/fixtures/scopes/java/interior/interior.try.scope +++ b/data/fixtures/scopes/java/interior/interior.try.scope @@ -4,84 +4,36 @@ finally { } --- [#1 Content] = -[#1 Removal] = 0:5-0:6 +[#1 Removal] = +[#1 Domain] = 0:5-0:6 >-< 0| try { } -[#1 Domain] = 0:0-0:7 - >-------< -0| try { } - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:6 - >-< -0| try { } - -[#2 Domain] = 0:4-0:7 - >---< -0| try { } +[#2 Removal] = +[#2 Domain] = 1:6-1:18 + >------------< +1| catch(Exception ex) { } [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:21-1:22 +[#3 Removal] = +[#3 Domain] = 1:21-1:22 >-< 1| catch(Exception ex) { } -[#3 Domain] = 1:0-1:23 - >-----------------------< -1| catch(Exception ex) { } - [#3 Insertion delimiter] = " " [#4 Content] = -[#4 Removal] = 1:6-1:18 - >------------< -1| catch(Exception ex) { } - -[#4 Domain] = 1:5-1:19 - >--------------< -1| catch(Exception ex) { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:21-1:22 - >-< -1| catch(Exception ex) { } - -[#5 Domain] = 1:20-1:23 - >---< -1| catch(Exception ex) { } - -[#5 Insertion delimiter] = " " - - -[#6 Content] = -[#6 Removal] = 2:9-2:10 +[#4 Removal] = +[#4 Domain] = 2:9-2:10 >-< 2| finally { } -[#6 Domain] = 2:0-2:11 - >-----------< -2| finally { } - -[#6 Insertion delimiter] = " " - - -[#7 Content] = -[#7 Removal] = 2:9-2:10 - >-< -2| finally { } - -[#7 Domain] = 2:8-2:11 - >---< -2| finally { } - -[#7 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.while.scope b/data/fixtures/scopes/java/interior/interior.while.scope index 3e16181107..31901d1f61 100644 --- a/data/fixtures/scopes/java/interior/interior.while.scope +++ b/data/fixtures/scopes/java/interior/interior.while.scope @@ -2,36 +2,18 @@ while (true) { } --- [#1 Content] = -[#1 Removal] = 0:14-0:15 - >-< -0| while (true) { } - -[#1 Domain] = 0:0-0:16 - >----------------< +[#1 Removal] = +[#1 Domain] = 0:7-0:11 + >----< 0| while (true) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:7-0:11 - >----< -0| while (true) { } - -[#2 Domain] = 0:6-0:12 - >------< -0| while (true) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:14-0:15 +[#2 Removal] = +[#2 Domain] = 0:14-0:15 >-< 0| while (true) { } -[#3 Domain] = 0:13-0:16 - >---< -0| while (true) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/statement/statement.enum.scope b/data/fixtures/scopes/java/statement/statement.enum.scope index e5b0f719b3..6b95327386 100644 --- a/data/fixtures/scopes/java/statement/statement.enum.scope +++ b/data/fixtures/scopes/java/statement/statement.enum.scope @@ -7,8 +7,4 @@ public enum Foo {} >------------------< 0| public enum Foo {} -[Interior] = 0:17-0:17 - >< -0| public enum Foo {} - [Insertion delimiter] = "\n" diff --git a/queries/java.scm b/queries/java.scm index 6a390ffda3..f55124d202 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -54,8 +54,8 @@ (enum_declaration name: (_) @name body: (_ - "{" @statement.interior.start.endOf @name.iteration.start.endOf - "}" @statement.interior.end.startOf @name.iteration.end.startOf + "{" @name.iteration.start.endOf + "}" @name.iteration.end.startOf ) ) @statement @type @name.domain @@ -114,19 +114,6 @@ (#type? @_dummy block class_body interface_body constructor_body) ) -;;!! { } -;;! ^ -( - (_ - (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @_dummy - ) @_.domain - (#type? @_dummy block class_body interface_body constructor_body switch_block) - (#not-type? @_.domain try_statement if_statement) -) - ;;!! void myFunk() {} ;;! ^^^^^^^^^^^^^^^^ (method_declaration @@ -207,16 +194,20 @@ ) ) @condition.domain +;;!! case "0" -> "zero"; +;;! ^^^^^^^ +(switch_rule + "->" @interior.start.endOf + (expression_statement) +) @interior.end.endOf + ;;!! case 0: break; ;;! ^^^^^^ -(_ - (switch_label) - . - (_) @interior.start - (_)? @interior.end - . - (#not-type? @interior.start block) -) @_.domain +(switch_block_statement_group + ":" @interior.start.endOf + (_) @_dummy + (#not-type? @_dummy block) +) @interior.end.endOf (switch_expression body: (_ @@ -236,12 +227,9 @@ ;;! ^^^^^^^^ ( (if_statement - "if" @branch.start @branch.removal.start @interior.domain.start.startOf + "if" @branch.start @branch.removal.start condition: (_) @condition - consequence: (block - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end @branch.removal.end @interior.domain.end.endOf + consequence: (_) @branch.end @branch.removal.end "else"? @branch.removal.end.startOf alternative: (if_statement)? @branch.removal.end.startOf ) @condition.domain @@ -252,13 +240,10 @@ ;;!! else if () {} ;;! ^^^^^^^^^^^^^ (if_statement - "else" @branch.start @condition.domain.start @interior.domain.start.startOf + "else" @branch.start @condition.domain.start alternative: (if_statement condition: (_) @condition - consequence: (block - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end @condition.domain.end @interior.domain.end.endOf + consequence: (block) @branch.end @condition.domain.end (#child-range! @condition 0 -1 true true) ) ) @@ -266,21 +251,15 @@ ;;!! else {} ;;! ^^^^^^^ (if_statement - "else" @branch.start @interior.domain.start.startOf - alternative: (block - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end @interior.domain.end.endOf + "else" @branch.start + alternative: (block) @branch.end ) ;;!! try {} ;;! ^^^^^^ (try_statement - "try" @branch.start @interior.domain.start.startOf - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end @interior.domain.end.endOf + "try" @branch.start + body: (_) @branch.end ) ;;!! catch (Exception e) {} From 4bf62d4ae9b0b670b3b6289f53e1ab10d5aa7640 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 09:29:19 +0100 Subject: [PATCH 05/38] python --- .../python/interior/interior.class.scope | 11 ++-- .../interior/interior.constructor.scope | 35 ++++++----- .../python/interior/interior.foreach.scope | 11 ++-- .../python/interior/interior.function.scope | 22 +++---- .../python/interior/interior.function2.scope | 24 ++++---- .../scopes/python/interior/interior.if.scope | 33 ++++++---- .../python/interior/interior.method.scope | 35 ++++++----- .../python/interior/interior.resource.scope | 11 ++-- .../python/interior/interior.switch.scope | 15 +++-- .../python/interior/interior.switchCase.scope | 31 ++++++---- .../scopes/python/interior/interior.try.scope | 33 ++++++---- .../python/interior/interior.try2.scope | 22 ++++--- .../python/interior/interior.while.scope | 11 ++-- queries/python.scm | 60 +++++++------------ 14 files changed, 198 insertions(+), 156 deletions(-) diff --git a/data/fixtures/scopes/python/interior/interior.class.scope b/data/fixtures/scopes/python/interior/interior.class.scope index 719407b3ab..d820932931 100644 --- a/data/fixtures/scopes/python/interior/interior.class.scope +++ b/data/fixtures/scopes/python/interior/interior.class.scope @@ -1,13 +1,16 @@ class Foo: pass --- -[Content] = -[Removal] = 0:11-0:15 +[Content] = 0:11-0:15 >----< 0| class Foo: pass -[Domain] = 0:0-0:15 - >---------------< +[Removal] = 0:10-0:15 + >-----< +0| class Foo: pass + +[Domain] = 0:10-0:15 + >-----< 0| class Foo: pass [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.constructor.scope b/data/fixtures/scopes/python/interior/interior.constructor.scope index 641c966a22..eca66a6df9 100644 --- a/data/fixtures/scopes/python/interior/interior.constructor.scope +++ b/data/fixtures/scopes/python/interior/interior.constructor.scope @@ -2,13 +2,18 @@ class Foo: def __init__(self): pass --- -[#1 Content] = -[#1 Removal] = 1:4-1:28 +[#1 Content] = 1:4-1:28 >------------------------< 1| def __init__(self): pass -[#1 Domain] = 0:0-1:28 - >---------- +[#1 Removal] = 0:10-1:28 + > +0| class Foo: +1| def __init__(self): pass + ----------------------------< + +[#1 Domain] = 0:10-1:28 + > 0| class Foo: 1| def __init__(self): pass ----------------------------< @@ -17,24 +22,24 @@ class Foo: [#2 Content] = -[#2 Removal] = 1:24-1:28 - >----< -1| def __init__(self): pass - -[#2 Domain] = 1:4-1:28 - >------------------------< +[#2 Removal] = +[#2 Domain] = 1:17-1:21 + >----< 1| def __init__(self): pass [#2 Insertion delimiter] = " " -[#3 Content] = -[#3 Removal] = 1:17-1:21 - >----< +[#3 Content] = 1:24-1:28 + >----< +1| def __init__(self): pass + +[#3 Removal] = 1:23-1:28 + >-----< 1| def __init__(self): pass -[#3 Domain] = 1:16-1:22 - >------< +[#3 Domain] = 1:23-1:28 + >-----< 1| def __init__(self): pass [#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.foreach.scope b/data/fixtures/scopes/python/interior/interior.foreach.scope index 165854f8b2..b9441c8323 100644 --- a/data/fixtures/scopes/python/interior/interior.foreach.scope +++ b/data/fixtures/scopes/python/interior/interior.foreach.scope @@ -1,13 +1,16 @@ for v in values: pass --- -[Content] = -[Removal] = 0:17-0:21 +[Content] = 0:17-0:21 >----< 0| for v in values: pass -[Domain] = 0:0-0:21 - >---------------------< +[Removal] = 0:16-0:21 + >-----< +0| for v in values: pass + +[Domain] = 0:16-0:21 + >-----< 0| for v in values: pass [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.function.scope b/data/fixtures/scopes/python/interior/interior.function.scope index 179ab55204..3161e0aeed 100644 --- a/data/fixtures/scopes/python/interior/interior.function.scope +++ b/data/fixtures/scopes/python/interior/interior.function.scope @@ -2,24 +2,24 @@ def foo(): pass --- [#1 Content] = -[#1 Removal] = 0:11-0:15 - >----< -0| def foo(): pass - -[#1 Domain] = 0:0-0:15 - >---------------< +[#1 Removal] = +[#1 Domain] = 0:8-0:8 + >< 0| def foo(): pass [#1 Insertion delimiter] = " " -[#2 Content] = -[#2 Removal] = 0:8-0:8 - >< +[#2 Content] = 0:11-0:15 + >----< +0| def foo(): pass + +[#2 Removal] = 0:10-0:15 + >-----< 0| def foo(): pass -[#2 Domain] = 0:7-0:9 - >--< +[#2 Domain] = 0:10-0:15 + >-----< 0| def foo(): pass [#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.function2.scope b/data/fixtures/scopes/python/interior/interior.function2.scope index bd6ce81c00..0638035ff9 100644 --- a/data/fixtures/scopes/python/interior/interior.function2.scope +++ b/data/fixtures/scopes/python/interior/interior.function2.scope @@ -3,26 +3,24 @@ def foo(): pass --- [#1 Content] = -[#1 Removal] = 1:11-1:15 - >----< -1| def foo(): pass - -[#1 Domain] = 0:0-1:15 - >---- -0| @bar +[#1 Removal] = +[#1 Domain] = 1:8-1:8 + >< 1| def foo(): pass - ---------------< [#1 Insertion delimiter] = " " -[#2 Content] = -[#2 Removal] = 1:8-1:8 - >< +[#2 Content] = 1:11-1:15 + >----< +1| def foo(): pass + +[#2 Removal] = 1:10-1:15 + >-----< 1| def foo(): pass -[#2 Domain] = 1:7-1:9 - >--< +[#2 Domain] = 1:10-1:15 + >-----< 1| def foo(): pass [#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.if.scope b/data/fixtures/scopes/python/interior/interior.if.scope index 023fe55488..77f83ef80a 100644 --- a/data/fixtures/scopes/python/interior/interior.if.scope +++ b/data/fixtures/scopes/python/interior/interior.if.scope @@ -3,37 +3,46 @@ elif False: pass else: pass --- -[#1 Content] = -[#1 Removal] = 0:9-0:13 +[#1 Content] = 0:9-0:13 >----< 0| if True: pass -[#1 Domain] = 0:0-0:13 - >-------------< +[#1 Removal] = 0:8-0:13 + >-----< +0| if True: pass + +[#1 Domain] = 0:8-0:13 + >-----< 0| if True: pass [#1 Insertion delimiter] = " " -[#2 Content] = -[#2 Removal] = 1:12-1:16 +[#2 Content] = 1:12-1:16 >----< 1| elif False: pass -[#2 Domain] = 1:0-1:16 - >----------------< +[#2 Removal] = 1:11-1:16 + >-----< +1| elif False: pass + +[#2 Domain] = 1:11-1:16 + >-----< 1| elif False: pass [#2 Insertion delimiter] = " " -[#3 Content] = -[#3 Removal] = 2:6-2:10 +[#3 Content] = 2:6-2:10 >----< 2| else: pass -[#3 Domain] = 2:0-2:10 - >----------< +[#3 Removal] = 2:5-2:10 + >-----< +2| else: pass + +[#3 Domain] = 2:5-2:10 + >-----< 2| else: pass [#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.method.scope b/data/fixtures/scopes/python/interior/interior.method.scope index df796b77d5..1e1f094560 100644 --- a/data/fixtures/scopes/python/interior/interior.method.scope +++ b/data/fixtures/scopes/python/interior/interior.method.scope @@ -2,13 +2,18 @@ class Foo: def bar(): pass --- -[#1 Content] = -[#1 Removal] = 1:4-1:19 +[#1 Content] = 1:4-1:19 >---------------< 1| def bar(): pass -[#1 Domain] = 0:0-1:19 - >---------- +[#1 Removal] = 0:10-1:19 + > +0| class Foo: +1| def bar(): pass + -------------------< + +[#1 Domain] = 0:10-1:19 + > 0| class Foo: 1| def bar(): pass -------------------< @@ -17,24 +22,24 @@ class Foo: [#2 Content] = -[#2 Removal] = 1:15-1:19 - >----< -1| def bar(): pass - -[#2 Domain] = 1:4-1:19 - >---------------< +[#2 Removal] = +[#2 Domain] = 1:12-1:12 + >< 1| def bar(): pass [#2 Insertion delimiter] = " " -[#3 Content] = -[#3 Removal] = 1:12-1:12 - >< +[#3 Content] = 1:15-1:19 + >----< +1| def bar(): pass + +[#3 Removal] = 1:14-1:19 + >-----< 1| def bar(): pass -[#3 Domain] = 1:11-1:13 - >--< +[#3 Domain] = 1:14-1:19 + >-----< 1| def bar(): pass [#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.resource.scope b/data/fixtures/scopes/python/interior/interior.resource.scope index ee195de6d4..0cfa7f42a7 100644 --- a/data/fixtures/scopes/python/interior/interior.resource.scope +++ b/data/fixtures/scopes/python/interior/interior.resource.scope @@ -1,13 +1,16 @@ with file: pass --- -[Content] = -[Removal] = 0:11-0:15 +[Content] = 0:11-0:15 >----< 0| with file: pass -[Domain] = 0:0-0:15 - >---------------< +[Removal] = 0:10-0:15 + >-----< +0| with file: pass + +[Domain] = 0:10-0:15 + >-----< 0| with file: pass [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.switch.scope b/data/fixtures/scopes/python/interior/interior.switch.scope index 9e54a4a1db..53c37096dd 100644 --- a/data/fixtures/scopes/python/interior/interior.switch.scope +++ b/data/fixtures/scopes/python/interior/interior.switch.scope @@ -12,8 +12,8 @@ match value: 1| case 0: pass ----------------< -[#1 Domain] = 0:0-1:16 - >------------ +[#1 Domain] = 0:12-1:16 + > 0| match value: 1| case 0: pass ----------------< @@ -21,13 +21,16 @@ match value: [#1 Insertion delimiter] = " " -[#2 Content] = -[#2 Removal] = 1:12-1:16 +[#2 Content] = 1:12-1:16 >----< 1| case 0: pass -[#2 Domain] = 1:4-1:16 - >------------< +[#2 Removal] = 1:11-1:16 + >-----< +1| case 0: pass + +[#2 Domain] = 1:11-1:16 + >-----< 1| case 0: pass [#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.switchCase.scope b/data/fixtures/scopes/python/interior/interior.switchCase.scope index 551e1fab23..5c13a3b2f5 100644 --- a/data/fixtures/scopes/python/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/python/interior/interior.switchCase.scope @@ -25,8 +25,8 @@ match foo: 5| pass ------------< -[#1 Domain] = 0:0-5:12 - >---------- +[#1 Domain] = 0:10-5:12 + > 0| match foo: 1| case 0: 2| bar @@ -38,15 +38,21 @@ match foo: [#1 Insertion delimiter] = " " -[#2 Content] = -[#2 Removal] = 2:8-3:12 +[#2 Content] = 2:8-3:12 >--- 2| bar 3| pass ------------< -[#2 Domain] = 1:4-3:12 - >------- +[#2 Removal] = 1:11-3:12 + > +1| case 0: +2| bar +3| pass + ------------< + +[#2 Domain] = 1:11-3:12 + > 1| case 0: 2| bar 3| pass @@ -55,13 +61,18 @@ match foo: [#2 Insertion delimiter] = " " -[#3 Content] = -[#3 Removal] = 5:8-5:12 +[#3 Content] = 5:8-5:12 >----< 5| pass -[#3 Domain] = 4:4-5:12 - >------- +[#3 Removal] = 4:11-5:12 + > +4| case _: +5| pass + ------------< + +[#3 Domain] = 4:11-5:12 + > 4| case _: 5| pass ------------< diff --git a/data/fixtures/scopes/python/interior/interior.try.scope b/data/fixtures/scopes/python/interior/interior.try.scope index 28611b4b9d..34c051ece1 100644 --- a/data/fixtures/scopes/python/interior/interior.try.scope +++ b/data/fixtures/scopes/python/interior/interior.try.scope @@ -3,37 +3,46 @@ except: pass finally: pass --- -[#1 Content] = -[#1 Removal] = 0:5-0:9 +[#1 Content] = 0:5-0:9 >----< 0| try: pass -[#1 Domain] = 0:0-0:9 - >---------< +[#1 Removal] = 0:4-0:9 + >-----< +0| try: pass + +[#1 Domain] = 0:4-0:9 + >-----< 0| try: pass [#1 Insertion delimiter] = " " -[#2 Content] = -[#2 Removal] = 1:8-1:12 +[#2 Content] = 1:8-1:12 >----< 1| except: pass -[#2 Domain] = 1:0-1:12 - >------------< +[#2 Removal] = 1:7-1:12 + >-----< +1| except: pass + +[#2 Domain] = 1:7-1:12 + >-----< 1| except: pass [#2 Insertion delimiter] = " " -[#3 Content] = -[#3 Removal] = 2:9-2:13 +[#3 Content] = 2:9-2:13 >----< 2| finally: pass -[#3 Domain] = 2:0-2:13 - >-------------< +[#3 Removal] = 2:8-2:13 + >-----< +2| finally: pass + +[#3 Domain] = 2:8-2:13 + >-----< 2| finally: pass [#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.try2.scope b/data/fixtures/scopes/python/interior/interior.try2.scope index 58a5c379e2..2bfcf4d829 100644 --- a/data/fixtures/scopes/python/interior/interior.try2.scope +++ b/data/fixtures/scopes/python/interior/interior.try2.scope @@ -2,25 +2,31 @@ try: pass except*: pass --- -[#1 Content] = -[#1 Removal] = 0:5-0:9 +[#1 Content] = 0:5-0:9 >----< 0| try: pass -[#1 Domain] = 0:0-0:9 - >---------< +[#1 Removal] = 0:4-0:9 + >-----< +0| try: pass + +[#1 Domain] = 0:4-0:9 + >-----< 0| try: pass [#1 Insertion delimiter] = " " -[#2 Content] = -[#2 Removal] = 1:9-1:13 +[#2 Content] = 1:9-1:13 >----< 1| except*: pass -[#2 Domain] = 1:0-1:13 - >-------------< +[#2 Removal] = 1:8-1:13 + >-----< +1| except*: pass + +[#2 Domain] = 1:8-1:13 + >-----< 1| except*: pass [#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.while.scope b/data/fixtures/scopes/python/interior/interior.while.scope index caaaf393e8..ee0cb61af3 100644 --- a/data/fixtures/scopes/python/interior/interior.while.scope +++ b/data/fixtures/scopes/python/interior/interior.while.scope @@ -1,13 +1,16 @@ while True: pass --- -[Content] = -[Removal] = 0:12-0:16 +[Content] = 0:12-0:16 >----< 0| while True: pass -[Domain] = 0:0-0:16 - >----------------< +[Removal] = 0:11-0:16 + >-----< +0| while True: pass + +[Domain] = 0:11-0:16 + >-----< 0| while True: pass [Insertion delimiter] = " " diff --git a/queries/python.scm b/queries/python.scm index eaf072cc30..c622b12c8d 100644 --- a/queries/python.scm +++ b/queries/python.scm @@ -34,6 +34,15 @@ ;; (if_statement) ] @statement +;;!! if True: pass +;;! ^^^^ +;;! ----- +(_ + ":" @interior.start.endOf + . + (block) @interior.end.endOf +) + ;;!! a = 25 ;;! ^^ ;;! xxxxx @@ -170,12 +179,6 @@ (_) @value ) @_.domain -;;!! with aaa: -;;! ^^^ -(with_statement - body: (_) @interior -) @interior.domain - ;;!! with aaa: ;;! ^^^ ;;! -------- @@ -298,7 +301,6 @@ ( (function_definition name: (_) @name - body: (_) @interior ) @namedFunction @statement @_.domain (#not-parent-type? @namedFunction decorated_definition) ) @@ -308,7 +310,6 @@ (decorated_definition (function_definition name: (_) @name - body: (_) @interior ) ) @namedFunction @_.domain @@ -333,7 +334,6 @@ ( (class_definition name: (_) @name - body: (_) @interior ) @_.domain (#not-parent-type? @_.domain decorated_definition) ) @@ -347,7 +347,6 @@ (decorated_definition (class_definition name: (_) @name - body: (_) @interior ) ) @_.domain @@ -407,7 +406,6 @@ ;;! ^^^^^ (match_statement subject: (_) @value - body: (_) @interior ) @_.domain ;;!! { "value": 0 } @@ -433,7 +431,6 @@ (case_clause (case_pattern) @condition.start guard: (_)? @condition.end - consequence: (_) @interior ) @_.domain ;;!! case 0: pass @@ -482,13 +479,6 @@ ;;! ^^^^^^^^^^^^^^^^^^^^^^^^ (if_statement) @ifStatement @statement @branch.iteration -;;!! if True: pass -;;! ^^^^^^^^^^^^^ -(if_statement - "if" @interior.domain.start - consequence: (_) @interior @interior.domain.end -) - ;;!! if True: pass ;;! ^^^^^^^^^^^^^ (if_statement @@ -511,33 +501,27 @@ ;;!! elif True: pass ;;! ^^^^^^^^^^^^^^^ (elif_clause - consequence: (_) @interior -) @branch @interior.domain + consequence: (_) +) @branch ;;!! else: pass ;;! ^^^^^^^^^^ -(else_clause - body: (_) @interior -) @branch @interior.domain +(else_clause) @branch ;;!! try: pass ;;! ^^^^^^^^^ (try_statement - "try" @branch.start @interior.domain.start - body: (_) @branch.end @interior @interior.domain.end + "try" @branch.start + body: (_) @branch.end ) ;;!! except: pass ;;! ^^^^^^^^^^^^ -(except_clause - (block) @interior -) @branch @interior.domain +(except_clause) @branch ;;!! except*: pass ;;! ^^^^^^^^^^^^^ -(except_group_clause - (block) @interior -) @branch @interior.domain +(except_group_clause) @branch ;;!! except Exception as ex: ;;! ^^^^^^^^^^^^^^^ @@ -553,8 +537,8 @@ ;;!! finally: pass ;;! ^^^^^^^^^^^^^ (finally_clause - (block) @interior -) @branch @interior.domain + (block) +) @branch (try_statement) @branch.iteration @@ -562,8 +546,8 @@ ;;! ^^^^^^^^^^^^^^^^ (while_statement "while" @branch.start - body: (_) @branch.end @interior -) @interior.domain + body: (_) @branch.end +) (while_statement) @branch.iteration @@ -571,8 +555,8 @@ ;;! ^^^^^^^^^^^^^^^^^^^^ (for_statement "for" @branch.start - body: (_) @branch.end @interior -) @interior.domain + body: (_) @branch.end +) (for_statement) @branch.iteration From 0cc45bcca5a412579bbe087b80cec42095eb7733 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 09:49:14 +0100 Subject: [PATCH 06/38] c --- .../scopes/c/interior/interior.class.scope | 23 +--- .../scopes/c/interior/interior.class2.scope | 23 +--- .../scopes/c/interior/interior.class3.scope | 23 +--- .../scopes/c/interior/interior.class4.scope | 23 +--- .../scopes/c/interior/interior.doWhile.scope | 28 +--- .../scopes/c/interior/interior.enum.scope | 23 +--- .../scopes/c/interior/interior.enum2.scope | 23 +--- .../scopes/c/interior/interior.for.scope | 30 +---- .../scopes/c/interior/interior.function.scope | 30 +---- .../c/interior/interior.function2.scope | 30 +---- .../scopes/c/interior/interior.if.scope | 81 +++-------- .../scopes/c/interior/interior.switch.scope | 30 +---- .../c/interior/interior.switchCase.scope | 126 +++++------------- .../scopes/c/interior/interior.while.scope | 30 +---- queries/c.scm | 90 +++---------- 15 files changed, 128 insertions(+), 485 deletions(-) diff --git a/data/fixtures/scopes/c/interior/interior.class.scope b/data/fixtures/scopes/c/interior/interior.class.scope index 8c41d4852e..28c7613e2f 100644 --- a/data/fixtures/scopes/c/interior/interior.class.scope +++ b/data/fixtures/scopes/c/interior/interior.class.scope @@ -1,25 +1,10 @@ struct Foo { }; --- -[#1 Content] = -[#1 Removal] = 0:12-0:13 +[Content] = +[Removal] = +[Domain] = 0:12-0:13 >-< 0| struct Foo { }; -[#1 Domain] = 0:0-0:15 - >---------------< -0| struct Foo { }; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:12-0:13 - >-< -0| struct Foo { }; - -[#2 Domain] = 0:11-0:14 - >---< -0| struct Foo { }; - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.class2.scope b/data/fixtures/scopes/c/interior/interior.class2.scope index 26260af569..cadd9fe405 100644 --- a/data/fixtures/scopes/c/interior/interior.class2.scope +++ b/data/fixtures/scopes/c/interior/interior.class2.scope @@ -1,25 +1,10 @@ union Foo { }; --- -[#1 Content] = -[#1 Removal] = 0:11-0:12 +[Content] = +[Removal] = +[Domain] = 0:11-0:12 >-< 0| union Foo { }; -[#1 Domain] = 0:0-0:14 - >--------------< -0| union Foo { }; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:11-0:12 - >-< -0| union Foo { }; - -[#2 Domain] = 0:10-0:13 - >---< -0| union Foo { }; - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.class3.scope b/data/fixtures/scopes/c/interior/interior.class3.scope index eee3cb02c2..51f9da360c 100644 --- a/data/fixtures/scopes/c/interior/interior.class3.scope +++ b/data/fixtures/scopes/c/interior/interior.class3.scope @@ -1,25 +1,10 @@ typedef struct { } Foo; --- -[#1 Content] = -[#1 Removal] = 0:16-0:17 +[Content] = +[Removal] = +[Domain] = 0:16-0:17 >-< 0| typedef struct { } Foo; -[#1 Domain] = 0:0-0:23 - >-----------------------< -0| typedef struct { } Foo; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:16-0:17 - >-< -0| typedef struct { } Foo; - -[#2 Domain] = 0:15-0:18 - >---< -0| typedef struct { } Foo; - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.class4.scope b/data/fixtures/scopes/c/interior/interior.class4.scope index 43c0d1f6de..d9fbefdaec 100644 --- a/data/fixtures/scopes/c/interior/interior.class4.scope +++ b/data/fixtures/scopes/c/interior/interior.class4.scope @@ -1,25 +1,10 @@ typedef union { } Foo; --- -[#1 Content] = -[#1 Removal] = 0:15-0:16 +[Content] = +[Removal] = +[Domain] = 0:15-0:16 >-< 0| typedef union { } Foo; -[#1 Domain] = 0:0-0:22 - >----------------------< -0| typedef union { } Foo; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:15-0:16 - >-< -0| typedef union { } Foo; - -[#2 Domain] = 0:14-0:17 - >---< -0| typedef union { } Foo; - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.doWhile.scope b/data/fixtures/scopes/c/interior/interior.doWhile.scope index d1833e59d1..691176c939 100644 --- a/data/fixtures/scopes/c/interior/interior.doWhile.scope +++ b/data/fixtures/scopes/c/interior/interior.doWhile.scope @@ -2,36 +2,18 @@ do { } while (true); --- [#1 Content] = -[#1 Removal] = 0:4-0:5 +[#1 Removal] = +[#1 Domain] = 0:4-0:5 >-< 0| do { } while (true); -[#1 Domain] = 0:0-0:20 - >--------------------< -0| do { } while (true); - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:4-0:5 - >-< -0| do { } while (true); - -[#2 Domain] = 0:3-0:6 - >---< -0| do { } while (true); - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:14-0:18 +[#2 Removal] = +[#2 Domain] = 0:14-0:18 >----< 0| do { } while (true); -[#3 Domain] = 0:13-0:19 - >------< -0| do { } while (true); - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.enum.scope b/data/fixtures/scopes/c/interior/interior.enum.scope index 235154efaf..da2d42970d 100644 --- a/data/fixtures/scopes/c/interior/interior.enum.scope +++ b/data/fixtures/scopes/c/interior/interior.enum.scope @@ -1,25 +1,10 @@ enum Foo { }; --- -[#1 Content] = -[#1 Removal] = 0:10-0:11 +[Content] = +[Removal] = +[Domain] = 0:10-0:11 >-< 0| enum Foo { }; -[#1 Domain] = 0:0-0:13 - >-------------< -0| enum Foo { }; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:10-0:11 - >-< -0| enum Foo { }; - -[#2 Domain] = 0:9-0:12 - >---< -0| enum Foo { }; - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.enum2.scope b/data/fixtures/scopes/c/interior/interior.enum2.scope index d939ad36f1..e3ae457086 100644 --- a/data/fixtures/scopes/c/interior/interior.enum2.scope +++ b/data/fixtures/scopes/c/interior/interior.enum2.scope @@ -1,25 +1,10 @@ typedef enum { } Foo; --- -[#1 Content] = -[#1 Removal] = 0:14-0:15 +[Content] = +[Removal] = +[Domain] = 0:14-0:15 >-< 0| typedef enum { } Foo; -[#1 Domain] = 0:0-0:21 - >---------------------< -0| typedef enum { } Foo; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:14-0:15 - >-< -0| typedef enum { } Foo; - -[#2 Domain] = 0:13-0:16 - >---< -0| typedef enum { } Foo; - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.for.scope b/data/fixtures/scopes/c/interior/interior.for.scope index e1cf88df36..54b2d5db85 100644 --- a/data/fixtures/scopes/c/interior/interior.for.scope +++ b/data/fixtures/scopes/c/interior/interior.for.scope @@ -2,36 +2,18 @@ for (int i = 0; i < size; ++i) { } --- [#1 Content] = -[#1 Removal] = 0:32-0:33 - >-< -0| for (int i = 0; i < size; ++i) { } - -[#1 Domain] = 0:0-0:34 - >----------------------------------< +[#1 Removal] = +[#1 Domain] = 0:5-0:29 + >------------------------< 0| for (int i = 0; i < size; ++i) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:29 - >------------------------< -0| for (int i = 0; i < size; ++i) { } - -[#2 Domain] = 0:4-0:30 - >--------------------------< -0| for (int i = 0; i < size; ++i) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:32-0:33 +[#2 Removal] = +[#2 Domain] = 0:32-0:33 >-< 0| for (int i = 0; i < size; ++i) { } -[#3 Domain] = 0:31-0:34 - >---< -0| for (int i = 0; i < size; ++i) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.function.scope b/data/fixtures/scopes/c/interior/interior.function.scope index 55b8aa5f08..c59805dbcc 100644 --- a/data/fixtures/scopes/c/interior/interior.function.scope +++ b/data/fixtures/scopes/c/interior/interior.function.scope @@ -2,36 +2,18 @@ void foo() { } --- [#1 Content] = -[#1 Removal] = 0:12-0:13 - >-< -0| void foo() { } - -[#1 Domain] = 0:0-0:14 - >--------------< +[#1 Removal] = +[#1 Domain] = 0:9-0:9 + >< 0| void foo() { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:9-0:9 - >< -0| void foo() { } - -[#2 Domain] = 0:8-0:10 - >--< -0| void foo() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:12-0:13 +[#2 Removal] = +[#2 Domain] = 0:12-0:13 >-< 0| void foo() { } -[#3 Domain] = 0:11-0:14 - >---< -0| void foo() { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.function2.scope b/data/fixtures/scopes/c/interior/interior.function2.scope index 17dba94f16..6bc11934dc 100644 --- a/data/fixtures/scopes/c/interior/interior.function2.scope +++ b/data/fixtures/scopes/c/interior/interior.function2.scope @@ -2,36 +2,18 @@ void Foo::bar() { } --- [#1 Content] = -[#1 Removal] = 0:17-0:18 - >-< -0| void Foo::bar() { } - -[#1 Domain] = 0:0-0:19 - >-------------------< +[#1 Removal] = +[#1 Domain] = 0:14-0:14 + >< 0| void Foo::bar() { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:14-0:14 - >< -0| void Foo::bar() { } - -[#2 Domain] = 0:13-0:15 - >--< -0| void Foo::bar() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:17-0:18 +[#2 Removal] = +[#2 Domain] = 0:17-0:18 >-< 0| void Foo::bar() { } -[#3 Domain] = 0:16-0:19 - >---< -0| void Foo::bar() { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.if.scope b/data/fixtures/scopes/c/interior/interior.if.scope index 52ac91931a..22a989ae6d 100644 --- a/data/fixtures/scopes/c/interior/interior.if.scope +++ b/data/fixtures/scopes/c/interior/interior.if.scope @@ -4,96 +4,45 @@ else { } --- [#1 Content] = -[#1 Removal] = 0:11-0:12 - >-< -0| if (true) { } - -[#1 Domain] = 0:0-0:13 - >-------------< +[#1 Removal] = +[#1 Domain] = 0:4-0:8 + >----< 0| if (true) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:4-0:8 - >----< -0| if (true) { } - -[#2 Domain] = 0:3-0:9 - >------< +[#2 Removal] = +[#2 Domain] = 0:11-0:12 + >-< 0| if (true) { } [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 0:11-0:12 - >-< -0| if (true) { } - -[#3 Domain] = 0:10-0:13 - >---< -0| if (true) { } +[#3 Removal] = +[#3 Domain] = 1:9-1:14 + >-----< +1| else if (false) { } [#3 Insertion delimiter] = " " [#4 Content] = -[#4 Removal] = 1:17-1:18 +[#4 Removal] = +[#4 Domain] = 1:17-1:18 >-< 1| else if (false) { } -[#4 Domain] = 1:0-1:19 - >-------------------< -1| else if (false) { } - [#4 Insertion delimiter] = " " [#5 Content] = -[#5 Removal] = 1:9-1:14 - >-----< -1| else if (false) { } - -[#5 Domain] = 1:8-1:15 - >-------< -1| else if (false) { } - -[#5 Insertion delimiter] = " " - - -[#6 Content] = -[#6 Removal] = 1:17-1:18 - >-< -1| else if (false) { } - -[#6 Domain] = 1:16-1:19 - >---< -1| else if (false) { } - -[#6 Insertion delimiter] = " " - - -[#7 Content] = -[#7 Removal] = 2:6-2:7 +[#5 Removal] = +[#5 Domain] = 2:6-2:7 >-< 2| else { } -[#7 Domain] = 2:0-2:8 - >--------< -2| else { } - -[#7 Insertion delimiter] = " " - - -[#8 Content] = -[#8 Removal] = 2:6-2:7 - >-< -2| else { } - -[#8 Domain] = 2:5-2:8 - >---< -2| else { } - -[#8 Insertion delimiter] = " " +[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.switch.scope b/data/fixtures/scopes/c/interior/interior.switch.scope index fce2f668fa..d47263785a 100644 --- a/data/fixtures/scopes/c/interior/interior.switch.scope +++ b/data/fixtures/scopes/c/interior/interior.switch.scope @@ -2,36 +2,18 @@ switch (foo) { } --- [#1 Content] = -[#1 Removal] = 0:14-0:15 - >-< -0| switch (foo) { } - -[#1 Domain] = 0:0-0:16 - >----------------< +[#1 Removal] = +[#1 Domain] = 0:8-0:11 + >---< 0| switch (foo) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:8-0:11 - >---< -0| switch (foo) { } - -[#2 Domain] = 0:7-0:12 - >-----< -0| switch (foo) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:14-0:15 +[#2 Removal] = +[#2 Domain] = 0:14-0:15 >-< 0| switch (foo) { } -[#3 Domain] = 0:13-0:16 - >---< -0| switch (foo) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.switchCase.scope b/data/fixtures/scopes/c/interior/interior.switchCase.scope index 79eec9b526..4eb46c2559 100644 --- a/data/fixtures/scopes/c/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/c/interior/interior.switchCase.scope @@ -10,62 +10,16 @@ switch (foo) { } --- -[#1 Content] = 1:4-8:14 - >------- -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; - --------------< - -[#1 Removal] = 0:14-9:0 - > -0| switch (foo) { -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - < - -[#1 Domain] = 0:0-9:1 - >-------------- -0| switch (foo) { -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - -< - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:8-0:11 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:8-0:11 >---< 0| switch (foo) { -[#2 Domain] = 0:7-0:12 - >-----< -0| switch (foo) { - -[#2 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#3 Content] = 1:4-8:14 +[#2 Content] = 1:4-8:14 >------- 1| case 0: 2| bar; @@ -77,7 +31,7 @@ switch (foo) { 8| break; --------------< -[#3 Removal] = 0:14-9:0 +[#2 Removal] = 0:14-9:0 > 0| switch (foo) { 1| case 0: @@ -91,8 +45,8 @@ switch (foo) { 9| } < -[#3 Domain] = 0:13-9:1 - >- +[#2 Domain] = 0:14-9:0 + > 0| switch (foo) { 1| case 0: 2| bar; @@ -103,79 +57,69 @@ switch (foo) { 7| default: 8| break; 9| } - -< + < -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#4 Content] = -[#4 Removal] = 2:8-3:14 +[#3 Content] = 2:8-3:14 >---- 2| bar; 3| break; --------------< -[#4 Domain] = 1:4-3:14 - >------- +[#3 Removal] = 1:11-3:14 + > 1| case 0: 2| bar; 3| break; --------------< -[#4 Insertion delimiter] = " " +[#3 Domain] = 1:11-3:14 + > +1| case 0: +2| bar; +3| break; + --------------< + +[#3 Insertion delimiter] = " " -[#5 Content] = 5:8-5:14 +[#4 Content] = 5:8-5:14 >------< 5| break; -[#5 Removal] = 4:13-6:4 +[#4 Removal] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#5 Domain] = 4:4-6:5 - >--------- -4| case 1: { -5| break; -6| } - -----< - -[#5 Insertion delimiter] = " " - - -[#6 Content] = 5:8-5:14 - >------< -5| break; - -[#6 Removal] = 4:13-6:4 +[#4 Domain] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#6 Domain] = 4:12-6:5 - >- -4| case 1: { -5| break; -6| } - -----< - -[#6 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " -[#7 Content] = -[#7 Removal] = 8:8-8:14 +[#5 Content] = 8:8-8:14 >------< 8| break; -[#7 Domain] = 7:4-8:14 - >-------- +[#5 Removal] = 7:12-8:14 + > 7| default: 8| break; --------------< -[#7 Insertion delimiter] = " " +[#5 Domain] = 7:12-8:14 + > +7| default: +8| break; + --------------< + +[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.while.scope b/data/fixtures/scopes/c/interior/interior.while.scope index 3e16181107..31901d1f61 100644 --- a/data/fixtures/scopes/c/interior/interior.while.scope +++ b/data/fixtures/scopes/c/interior/interior.while.scope @@ -2,36 +2,18 @@ while (true) { } --- [#1 Content] = -[#1 Removal] = 0:14-0:15 - >-< -0| while (true) { } - -[#1 Domain] = 0:0-0:16 - >----------------< +[#1 Removal] = +[#1 Domain] = 0:7-0:11 + >----< 0| while (true) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:7-0:11 - >----< -0| while (true) { } - -[#2 Domain] = 0:6-0:12 - >------< -0| while (true) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:14-0:15 +[#2 Removal] = +[#2 Domain] = 0:14-0:15 >-< 0| while (true) { } -[#3 Domain] = 0:13-0:16 - >---< -0| while (true) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/queries/c.scm b/queries/c.scm index 71e3d54b3e..e85126947d 100644 --- a/queries/c.scm +++ b/queries/c.scm @@ -84,10 +84,6 @@ (_ (_ name: (_) @name - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) ) @_.domain.start @class.start @type.start . ";"? @_.domain.end @class.end @type.end @@ -108,12 +104,7 @@ ;;!! typedef union {} foo; ;;!! typedef enum {} foo; (type_definition - type: (_ - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) - ) @_dummy + type: (_) @_dummy declarator: (type_identifier) @name (#type? @_dummy struct_specifier union_specifier enum_specifier) ) @_.domain @class @type @@ -166,15 +157,6 @@ ) ) @namedFunction @name.domain -;;!! void foo() { } -;;! ^ -(function_definition - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) -) @_.domain - ;;!! int aaa; ;;! ^^^ (field_declaration @@ -312,12 +294,9 @@ ;;! ^^^^^^^^ ( (if_statement - "if" @branch.start @branch.removal.start @interior.domain.start + "if" @branch.start @branch.removal.start condition: (_) @condition - consequence: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end @branch.removal.end @interior.domain.end + consequence: (_) @branch.end @branch.removal.end alternative: (else_clause (if_statement)? @branch.removal.end.startOf )? @branch.removal.end.startOf @@ -329,13 +308,10 @@ ;;!! else if () {} ;;! ^^^^^^^^^^^^^ (else_clause - "else" @branch.start @condition.domain.start @interior.domain.start + "else" @branch.start @condition.domain.start (if_statement condition: (_) @condition - consequence: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end @condition.domain.end @interior.domain.end + consequence: (_) @branch.end @condition.domain.end (#child-range! @condition 0 -1 true true) ) ) @@ -344,11 +320,8 @@ ;;! ^^^^^^^ (if_statement (else_clause - (compound_statement - "{" @interior.start.endOf - "}" @interior.end.startOf - ) - ) @branch @interior.domain + (compound_statement) + ) @branch ) ;;!! for (int i = 0; i < size; ++i) {} @@ -356,10 +329,6 @@ ;;! ^^^^^^^^ (for_statement condition: (_) @condition - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) ) @branch @_.domain ;;!! while (true) {} @@ -367,10 +336,6 @@ ;;! ^^^^ (while_statement condition: (_) @condition - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) (#child-range! @condition 0 -1 true true) ) @branch @_.domain @@ -378,10 +343,6 @@ ;;! ^^^^^^^^^^^^^^^^^^^ ;;! ^^^^ (do_statement - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) condition: (_) @condition (#child-range! @condition 0 -1 true true) ) @branch @_.domain @@ -394,42 +355,29 @@ ")" @value.end.startOf ) body: (_ - "{" @branch.iteration.start.endOf @condition.iteration.start.endOf @interior.start.endOf - "}" @branch.iteration.end.startOf @condition.iteration.end.startOf @interior.end.startOf + "{" @branch.iteration.start.endOf @condition.iteration.start.endOf + "}" @branch.iteration.end.startOf @condition.iteration.end.startOf ) ) @_.domain @branch.iteration.domain @condition.iteration.domain ;;!! case 0: break; ;;! ^^^^^^^^^^^^^^ +(case_statement) @branch + +;;!! case 0: break; ;;! ^ (case_statement value: (_) @condition - . - (_) @interior.start - (_)? @interior.end - . - (#not-type? @interior.start "compound_statement") -) @branch @_.domain +) @condition.domain -;;!! default: break; -;;! ^^^^^^^^^^^^^^; +;;!! case 0: break; +;;! ^^^^^^ (case_statement - !value - . - (_) @interior.start - (_)? @interior.end + ":" @interior.start.endOf . - (#not-type? @interior.start "compound_statement") -) @branch @_.domain - -;;!! case 0: { } -;;! ^ -(case_statement - (compound_statement - "{" @interior.start.endOf - "}" @interior.end.startOf - ) -) @branch @_.domain + (_) @_dummy + (#not-type? @_dummy compound_statement) +) @interior.end.endOf ;;!! true ? 0 : 1 ;;! ^^^^ From b0a1062d21ff9e5eceb667e7f266844bc346b3ea Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 09:52:29 +0100 Subject: [PATCH 07/38] cpp --- .../scopes/cpp/interior/interior.class.scope | 23 ++------ .../cpp/interior/interior.constructor.scope | 57 +++---------------- .../scopes/cpp/interior/interior.enum.scope | 23 ++------ .../cpp/interior/interior.foreach.scope | 30 ++-------- .../scopes/cpp/interior/interior.lambda.scope | 37 +++--------- .../scopes/cpp/interior/interior.method.scope | 57 +++---------------- .../cpp/interior/interior.namespace.scope | 23 ++------ .../scopes/cpp/interior/interior.try.scope | 49 +++------------- queries/cpp.scm | 33 ++--------- 9 files changed, 56 insertions(+), 276 deletions(-) diff --git a/data/fixtures/scopes/cpp/interior/interior.class.scope b/data/fixtures/scopes/cpp/interior/interior.class.scope index 5390112f29..13ef2f4d94 100644 --- a/data/fixtures/scopes/cpp/interior/interior.class.scope +++ b/data/fixtures/scopes/cpp/interior/interior.class.scope @@ -1,25 +1,10 @@ class Foo { } --- -[#1 Content] = -[#1 Removal] = 0:11-0:12 +[Content] = +[Removal] = +[Domain] = 0:11-0:12 >-< 0| class Foo { } -[#1 Domain] = 0:0-0:13 - >-------------< -0| class Foo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:11-0:12 - >-< -0| class Foo { } - -[#2 Domain] = 0:10-0:13 - >---< -0| class Foo { } - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.constructor.scope b/data/fixtures/scopes/cpp/interior/interior.constructor.scope index ff8bba477b..5cf914bff8 100644 --- a/data/fixtures/scopes/cpp/interior/interior.constructor.scope +++ b/data/fixtures/scopes/cpp/interior/interior.constructor.scope @@ -14,68 +14,29 @@ class Foo { 2| } < -[#1 Domain] = 0:0-2:1 - >----------- +[#1 Domain] = 0:11-2:0 + > 0| class Foo { 1| Foo() { } 2| } - -< + < [#1 Insertion delimiter] = " " -[#2 Content] = 1:4-1:13 - >---------< -1| Foo() { } - -[#2 Removal] = 0:11-2:0 - > -0| class Foo { -1| Foo() { } -2| } - < - -[#2 Domain] = 0:10-2:1 - >- -0| class Foo { +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:8-1:8 + >< 1| Foo() { } -2| } - -< [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:11-1:12 +[#3 Removal] = +[#3 Domain] = 1:11-1:12 >-< 1| Foo() { } -[#3 Domain] = 1:4-1:13 - >---------< -1| Foo() { } - [#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 1:8-1:8 - >< -1| Foo() { } - -[#4 Domain] = 1:7-1:9 - >--< -1| Foo() { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:11-1:12 - >-< -1| Foo() { } - -[#5 Domain] = 1:10-1:13 - >---< -1| Foo() { } - -[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.enum.scope b/data/fixtures/scopes/cpp/interior/interior.enum.scope index efbe2da153..5db9f44d0c 100644 --- a/data/fixtures/scopes/cpp/interior/interior.enum.scope +++ b/data/fixtures/scopes/cpp/interior/interior.enum.scope @@ -1,25 +1,10 @@ enum class Foo { }; --- -[#1 Content] = -[#1 Removal] = 0:16-0:17 +[Content] = +[Removal] = +[Domain] = 0:16-0:17 >-< 0| enum class Foo { }; -[#1 Domain] = 0:0-0:19 - >-------------------< -0| enum class Foo { }; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:16-0:17 - >-< -0| enum class Foo { }; - -[#2 Domain] = 0:15-0:18 - >---< -0| enum class Foo { }; - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.foreach.scope b/data/fixtures/scopes/cpp/interior/interior.foreach.scope index 4d90296637..b375427667 100644 --- a/data/fixtures/scopes/cpp/interior/interior.foreach.scope +++ b/data/fixtures/scopes/cpp/interior/interior.foreach.scope @@ -2,36 +2,18 @@ for (int v : values) { } --- [#1 Content] = -[#1 Removal] = 0:22-0:23 - >-< -0| for (int v : values) { } - -[#1 Domain] = 0:0-0:24 - >------------------------< +[#1 Removal] = +[#1 Domain] = 0:5-0:19 + >--------------< 0| for (int v : values) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:19 - >--------------< -0| for (int v : values) { } - -[#2 Domain] = 0:4-0:20 - >----------------< -0| for (int v : values) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:22-0:23 +[#2 Removal] = +[#2 Domain] = 0:22-0:23 >-< 0| for (int v : values) { } -[#3 Domain] = 0:21-0:24 - >---< -0| for (int v : values) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.lambda.scope b/data/fixtures/scopes/cpp/interior/interior.lambda.scope index 4334e4c314..1740259f51 100644 --- a/data/fixtures/scopes/cpp/interior/interior.lambda.scope +++ b/data/fixtures/scopes/cpp/interior/interior.lambda.scope @@ -2,48 +2,27 @@ --- [#1 Content] = -[#1 Removal] = 0:1-0:1 +[#1 Removal] = +[#1 Domain] = 0:1-0:1 >< 0| []() { }; -[#1 Domain] = 0:0-0:2 - >--< -0| []() { }; - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:6-0:7 - >-< -0| []() { }; - -[#2 Domain] = 0:0-0:8 - >--------< +[#2 Removal] = +[#2 Domain] = 0:3-0:3 + >< 0| []() { }; [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 0:3-0:3 - >< -0| []() { }; - -[#3 Domain] = 0:2-0:4 - >--< -0| []() { }; - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 0:6-0:7 +[#3 Removal] = +[#3 Domain] = 0:6-0:7 >-< 0| []() { }; -[#4 Domain] = 0:5-0:8 - >---< -0| []() { }; - -[#4 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.method.scope b/data/fixtures/scopes/cpp/interior/interior.method.scope index f6ec2af746..cefc9bf4b4 100644 --- a/data/fixtures/scopes/cpp/interior/interior.method.scope +++ b/data/fixtures/scopes/cpp/interior/interior.method.scope @@ -14,68 +14,29 @@ class Foo { 2| } < -[#1 Domain] = 0:0-2:1 - >----------- +[#1 Domain] = 0:11-2:0 + > 0| class Foo { 1| void bar() { } 2| } - -< + < [#1 Insertion delimiter] = " " -[#2 Content] = 1:4-1:18 - >--------------< -1| void bar() { } - -[#2 Removal] = 0:11-2:0 - > -0| class Foo { -1| void bar() { } -2| } - < - -[#2 Domain] = 0:10-2:1 - >- -0| class Foo { +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:13-1:13 + >< 1| void bar() { } -2| } - -< [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:16-1:17 +[#3 Removal] = +[#3 Domain] = 1:16-1:17 >-< 1| void bar() { } -[#3 Domain] = 1:4-1:18 - >--------------< -1| void bar() { } - [#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 1:13-1:13 - >< -1| void bar() { } - -[#4 Domain] = 1:12-1:14 - >--< -1| void bar() { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:16-1:17 - >-< -1| void bar() { } - -[#5 Domain] = 1:15-1:18 - >---< -1| void bar() { } - -[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.namespace.scope b/data/fixtures/scopes/cpp/interior/interior.namespace.scope index 1f9153248c..5c87f527c6 100644 --- a/data/fixtures/scopes/cpp/interior/interior.namespace.scope +++ b/data/fixtures/scopes/cpp/interior/interior.namespace.scope @@ -1,25 +1,10 @@ namespace Foo { } --- -[#1 Content] = -[#1 Removal] = 0:15-0:16 +[Content] = +[Removal] = +[Domain] = 0:15-0:16 >-< 0| namespace Foo { } -[#1 Domain] = 0:0-0:17 - >-----------------< -0| namespace Foo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:15-0:16 - >-< -0| namespace Foo { } - -[#2 Domain] = 0:14-0:17 - >---< -0| namespace Foo { } - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.try.scope b/data/fixtures/scopes/cpp/interior/interior.try.scope index b64cb122de..abe51d04b8 100644 --- a/data/fixtures/scopes/cpp/interior/interior.try.scope +++ b/data/fixtures/scopes/cpp/interior/interior.try.scope @@ -3,60 +3,27 @@ catch (const std::exception& e) { } --- [#1 Content] = -[#1 Removal] = 0:5-0:6 +[#1 Removal] = +[#1 Domain] = 0:5-0:6 >-< 0| try { } -[#1 Domain] = 0:0-0:7 - >-------< -0| try { } - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:6 - >-< -0| try { } - -[#2 Domain] = 0:4-0:7 - >---< -0| try { } +[#2 Removal] = +[#2 Domain] = 1:7-1:30 + >-----------------------< +1| catch (const std::exception& e) { } [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:33-1:34 +[#3 Removal] = +[#3 Domain] = 1:33-1:34 >-< 1| catch (const std::exception& e) { } -[#3 Domain] = 1:0-1:35 - >-----------------------------------< -1| catch (const std::exception& e) { } - [#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 1:7-1:30 - >-----------------------< -1| catch (const std::exception& e) { } - -[#4 Domain] = 1:6-1:31 - >-------------------------< -1| catch (const std::exception& e) { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:33-1:34 - >-< -1| catch (const std::exception& e) { } - -[#5 Domain] = 1:32-1:35 - >---< -1| catch (const std::exception& e) { } - -[#5 Insertion delimiter] = " " diff --git a/queries/cpp.scm b/queries/cpp.scm index 2b1bf3f7c1..86fea784a1 100644 --- a/queries/cpp.scm +++ b/queries/cpp.scm @@ -19,10 +19,6 @@ (_ (class_specifier name: (_) @name - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) ) @_.domain.start @class.start @type.start . ";"? @_.domain.end @class.end @type.end @@ -40,10 +36,6 @@ ;;!! namespace NS { } (namespace_definition name: (_) @name - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) ) @_.domain (field_declaration_list @@ -60,12 +52,7 @@ ;;!! []() {} ;;! ^^^^^^^ -(lambda_expression - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) -) @anonymousFunction @interior.domain +(lambda_expression) @anonymousFunction ;;!! [[attribute]] ;;! ^^^^^^^^^ @@ -96,20 +83,12 @@ ;;!! try {} ;;! ^^^^^^ (try_statement - "try" @branch.start @interior.domain.start - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end @interior.domain.end + "try" @branch.start + body: (_) @branch.end ) @branch.iteration ;;!! catch (const std::exception e) {} -(catch_clause - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) -) @branch @interior.domain +(catch_clause) @branch ;;!! new Foo() ;;! ^^^^^^^^^ @@ -146,10 +125,6 @@ (for_range_loop declarator: (_) @name right: (_) @value - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) ) @_.domain (trailing_return_type From cda80ed47d552ccc65fc7b9aa0f57db76f49aa0e Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 10:05:52 +0100 Subject: [PATCH 08/38] csharp --- .../csharp/interior/interior.class.scope | 23 +--- .../interior/interior.constructor.scope | 57 ++------ .../csharp/interior/interior.doWhile.scope | 28 +--- .../csharp/interior/interior.enum.scope | 23 +--- .../scopes/csharp/interior/interior.for.scope | 30 +---- .../csharp/interior/interior.foreach.scope | 30 +---- .../csharp/interior/interior.function.scope | 30 +---- .../scopes/csharp/interior/interior.if.scope | 81 +++-------- .../csharp/interior/interior.interface.scope | 23 +--- .../csharp/interior/interior.lambda.scope | 26 +--- .../csharp/interior/interior.method.scope | 57 ++------ .../csharp/interior/interior.switch.scope | 30 +---- .../csharp/interior/interior.switchCase.scope | 126 +++++------------- .../scopes/csharp/interior/interior.try.scope | 70 ++-------- .../csharp/interior/interior.while.scope | 30 +---- queries/csharp.scm | 109 +++------------ 16 files changed, 151 insertions(+), 622 deletions(-) diff --git a/data/fixtures/scopes/csharp/interior/interior.class.scope b/data/fixtures/scopes/csharp/interior/interior.class.scope index 5390112f29..13ef2f4d94 100644 --- a/data/fixtures/scopes/csharp/interior/interior.class.scope +++ b/data/fixtures/scopes/csharp/interior/interior.class.scope @@ -1,25 +1,10 @@ class Foo { } --- -[#1 Content] = -[#1 Removal] = 0:11-0:12 +[Content] = +[Removal] = +[Domain] = 0:11-0:12 >-< 0| class Foo { } -[#1 Domain] = 0:0-0:13 - >-------------< -0| class Foo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:11-0:12 - >-< -0| class Foo { } - -[#2 Domain] = 0:10-0:13 - >---< -0| class Foo { } - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.constructor.scope b/data/fixtures/scopes/csharp/interior/interior.constructor.scope index 23adf22cbe..9bdeac4c20 100644 --- a/data/fixtures/scopes/csharp/interior/interior.constructor.scope +++ b/data/fixtures/scopes/csharp/interior/interior.constructor.scope @@ -14,68 +14,29 @@ class Foo { 2| } < -[#1 Domain] = 0:0-2:1 - >----------- +[#1 Domain] = 0:11-2:0 + > 0| class Foo { 1| public Foo() { } 2| } - -< + < [#1 Insertion delimiter] = " " -[#2 Content] = 1:4-1:20 - >----------------< -1| public Foo() { } - -[#2 Removal] = 0:11-2:0 - > -0| class Foo { -1| public Foo() { } -2| } - < - -[#2 Domain] = 0:10-2:1 - >- -0| class Foo { +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:15-1:15 + >< 1| public Foo() { } -2| } - -< [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:18-1:19 +[#3 Removal] = +[#3 Domain] = 1:18-1:19 >-< 1| public Foo() { } -[#3 Domain] = 1:4-1:20 - >----------------< -1| public Foo() { } - [#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 1:15-1:15 - >< -1| public Foo() { } - -[#4 Domain] = 1:14-1:16 - >--< -1| public Foo() { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:18-1:19 - >-< -1| public Foo() { } - -[#5 Domain] = 1:17-1:20 - >---< -1| public Foo() { } - -[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.doWhile.scope b/data/fixtures/scopes/csharp/interior/interior.doWhile.scope index d1833e59d1..691176c939 100644 --- a/data/fixtures/scopes/csharp/interior/interior.doWhile.scope +++ b/data/fixtures/scopes/csharp/interior/interior.doWhile.scope @@ -2,36 +2,18 @@ do { } while (true); --- [#1 Content] = -[#1 Removal] = 0:4-0:5 +[#1 Removal] = +[#1 Domain] = 0:4-0:5 >-< 0| do { } while (true); -[#1 Domain] = 0:0-0:20 - >--------------------< -0| do { } while (true); - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:4-0:5 - >-< -0| do { } while (true); - -[#2 Domain] = 0:3-0:6 - >---< -0| do { } while (true); - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:14-0:18 +[#2 Removal] = +[#2 Domain] = 0:14-0:18 >----< 0| do { } while (true); -[#3 Domain] = 0:13-0:19 - >------< -0| do { } while (true); - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.enum.scope b/data/fixtures/scopes/csharp/interior/interior.enum.scope index a5274985e7..d96875b078 100644 --- a/data/fixtures/scopes/csharp/interior/interior.enum.scope +++ b/data/fixtures/scopes/csharp/interior/interior.enum.scope @@ -1,25 +1,10 @@ enum Foo { } --- -[#1 Content] = -[#1 Removal] = 0:10-0:11 +[Content] = +[Removal] = +[Domain] = 0:10-0:11 >-< 0| enum Foo { } -[#1 Domain] = 0:0-0:12 - >------------< -0| enum Foo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:10-0:11 - >-< -0| enum Foo { } - -[#2 Domain] = 0:9-0:12 - >---< -0| enum Foo { } - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.for.scope b/data/fixtures/scopes/csharp/interior/interior.for.scope index e1cf88df36..54b2d5db85 100644 --- a/data/fixtures/scopes/csharp/interior/interior.for.scope +++ b/data/fixtures/scopes/csharp/interior/interior.for.scope @@ -2,36 +2,18 @@ for (int i = 0; i < size; ++i) { } --- [#1 Content] = -[#1 Removal] = 0:32-0:33 - >-< -0| for (int i = 0; i < size; ++i) { } - -[#1 Domain] = 0:0-0:34 - >----------------------------------< +[#1 Removal] = +[#1 Domain] = 0:5-0:29 + >------------------------< 0| for (int i = 0; i < size; ++i) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:29 - >------------------------< -0| for (int i = 0; i < size; ++i) { } - -[#2 Domain] = 0:4-0:30 - >--------------------------< -0| for (int i = 0; i < size; ++i) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:32-0:33 +[#2 Removal] = +[#2 Domain] = 0:32-0:33 >-< 0| for (int i = 0; i < size; ++i) { } -[#3 Domain] = 0:31-0:34 - >---< -0| for (int i = 0; i < size; ++i) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.foreach.scope b/data/fixtures/scopes/csharp/interior/interior.foreach.scope index 13e6cbc8e7..7ab252c2e9 100644 --- a/data/fixtures/scopes/csharp/interior/interior.foreach.scope +++ b/data/fixtures/scopes/csharp/interior/interior.foreach.scope @@ -2,36 +2,18 @@ foreach (int v in values) { } --- [#1 Content] = -[#1 Removal] = 0:27-0:28 - >-< -0| foreach (int v in values) { } - -[#1 Domain] = 0:0-0:29 - >-----------------------------< +[#1 Removal] = +[#1 Domain] = 0:9-0:24 + >---------------< 0| foreach (int v in values) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:9-0:24 - >---------------< -0| foreach (int v in values) { } - -[#2 Domain] = 0:8-0:25 - >-----------------< -0| foreach (int v in values) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:27-0:28 +[#2 Removal] = +[#2 Domain] = 0:27-0:28 >-< 0| foreach (int v in values) { } -[#3 Domain] = 0:26-0:29 - >---< -0| foreach (int v in values) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.function.scope b/data/fixtures/scopes/csharp/interior/interior.function.scope index 1c8b29392b..78db1a1c1f 100644 --- a/data/fixtures/scopes/csharp/interior/interior.function.scope +++ b/data/fixtures/scopes/csharp/interior/interior.function.scope @@ -2,36 +2,18 @@ void Foo() { } --- [#1 Content] = -[#1 Removal] = 0:12-0:13 - >-< -0| void Foo() { } - -[#1 Domain] = 0:0-0:14 - >--------------< +[#1 Removal] = +[#1 Domain] = 0:9-0:9 + >< 0| void Foo() { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:9-0:9 - >< -0| void Foo() { } - -[#2 Domain] = 0:8-0:10 - >--< -0| void Foo() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:12-0:13 +[#2 Removal] = +[#2 Domain] = 0:12-0:13 >-< 0| void Foo() { } -[#3 Domain] = 0:11-0:14 - >---< -0| void Foo() { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.if.scope b/data/fixtures/scopes/csharp/interior/interior.if.scope index 52ac91931a..22a989ae6d 100644 --- a/data/fixtures/scopes/csharp/interior/interior.if.scope +++ b/data/fixtures/scopes/csharp/interior/interior.if.scope @@ -4,96 +4,45 @@ else { } --- [#1 Content] = -[#1 Removal] = 0:11-0:12 - >-< -0| if (true) { } - -[#1 Domain] = 0:0-0:13 - >-------------< +[#1 Removal] = +[#1 Domain] = 0:4-0:8 + >----< 0| if (true) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:4-0:8 - >----< -0| if (true) { } - -[#2 Domain] = 0:3-0:9 - >------< +[#2 Removal] = +[#2 Domain] = 0:11-0:12 + >-< 0| if (true) { } [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 0:11-0:12 - >-< -0| if (true) { } - -[#3 Domain] = 0:10-0:13 - >---< -0| if (true) { } +[#3 Removal] = +[#3 Domain] = 1:9-1:14 + >-----< +1| else if (false) { } [#3 Insertion delimiter] = " " [#4 Content] = -[#4 Removal] = 1:17-1:18 +[#4 Removal] = +[#4 Domain] = 1:17-1:18 >-< 1| else if (false) { } -[#4 Domain] = 1:0-1:19 - >-------------------< -1| else if (false) { } - [#4 Insertion delimiter] = " " [#5 Content] = -[#5 Removal] = 1:9-1:14 - >-----< -1| else if (false) { } - -[#5 Domain] = 1:8-1:15 - >-------< -1| else if (false) { } - -[#5 Insertion delimiter] = " " - - -[#6 Content] = -[#6 Removal] = 1:17-1:18 - >-< -1| else if (false) { } - -[#6 Domain] = 1:16-1:19 - >---< -1| else if (false) { } - -[#6 Insertion delimiter] = " " - - -[#7 Content] = -[#7 Removal] = 2:6-2:7 +[#5 Removal] = +[#5 Domain] = 2:6-2:7 >-< 2| else { } -[#7 Domain] = 2:0-2:8 - >--------< -2| else { } - -[#7 Insertion delimiter] = " " - - -[#8 Content] = -[#8 Removal] = 2:6-2:7 - >-< -2| else { } - -[#8 Domain] = 2:5-2:8 - >---< -2| else { } - -[#8 Insertion delimiter] = " " +[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.interface.scope b/data/fixtures/scopes/csharp/interior/interior.interface.scope index e213945b2e..87e8ec8e37 100644 --- a/data/fixtures/scopes/csharp/interior/interior.interface.scope +++ b/data/fixtures/scopes/csharp/interior/interior.interface.scope @@ -1,25 +1,10 @@ interface IFoo { } --- -[#1 Content] = -[#1 Removal] = 0:16-0:17 +[Content] = +[Removal] = +[Domain] = 0:16-0:17 >-< 0| interface IFoo { } -[#1 Domain] = 0:0-0:18 - >------------------< -0| interface IFoo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:16-0:17 - >-< -0| interface IFoo { } - -[#2 Domain] = 0:15-0:18 - >---< -0| interface IFoo { } - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.lambda.scope b/data/fixtures/scopes/csharp/interior/interior.lambda.scope index 1d94e214a0..bd3f10ac7d 100644 --- a/data/fixtures/scopes/csharp/interior/interior.lambda.scope +++ b/data/fixtures/scopes/csharp/interior/interior.lambda.scope @@ -2,14 +2,11 @@ --- [#1 Content] = -[#1 Removal] = 0:1-0:1 +[#1 Removal] = +[#1 Domain] = 0:1-0:1 >< 0| () => { foo; }; -[#1 Domain] = 0:0-0:2 - >--< -0| () => { foo; }; - [#1 Insertion delimiter] = " " @@ -21,23 +18,8 @@ >------< 0| () => { foo; }; -[#2 Domain] = 0:0-0:14 - >--------------< -0| () => { foo; }; - -[#2 Insertion delimiter] = " " - - -[#3 Content] = 0:8-0:12 - >----< -0| () => { foo; }; - -[#3 Removal] = 0:7-0:13 +[#2 Domain] = 0:7-0:13 >------< 0| () => { foo; }; -[#3 Domain] = 0:6-0:14 - >--------< -0| () => { foo; }; - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.method.scope b/data/fixtures/scopes/csharp/interior/interior.method.scope index 87ab480019..32381e662d 100644 --- a/data/fixtures/scopes/csharp/interior/interior.method.scope +++ b/data/fixtures/scopes/csharp/interior/interior.method.scope @@ -14,68 +14,29 @@ class Foo { 2| } < -[#1 Domain] = 0:0-2:1 - >----------- +[#1 Domain] = 0:11-2:0 + > 0| class Foo { 1| public void Bar() { } 2| } - -< + < [#1 Insertion delimiter] = " " -[#2 Content] = 1:4-1:25 - >---------------------< -1| public void Bar() { } - -[#2 Removal] = 0:11-2:0 - > -0| class Foo { -1| public void Bar() { } -2| } - < - -[#2 Domain] = 0:10-2:1 - >- -0| class Foo { +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:20-1:20 + >< 1| public void Bar() { } -2| } - -< [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:23-1:24 +[#3 Removal] = +[#3 Domain] = 1:23-1:24 >-< 1| public void Bar() { } -[#3 Domain] = 1:4-1:25 - >---------------------< -1| public void Bar() { } - [#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 1:20-1:20 - >< -1| public void Bar() { } - -[#4 Domain] = 1:19-1:21 - >--< -1| public void Bar() { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:23-1:24 - >-< -1| public void Bar() { } - -[#5 Domain] = 1:22-1:25 - >---< -1| public void Bar() { } - -[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.switch.scope b/data/fixtures/scopes/csharp/interior/interior.switch.scope index fce2f668fa..d47263785a 100644 --- a/data/fixtures/scopes/csharp/interior/interior.switch.scope +++ b/data/fixtures/scopes/csharp/interior/interior.switch.scope @@ -2,36 +2,18 @@ switch (foo) { } --- [#1 Content] = -[#1 Removal] = 0:14-0:15 - >-< -0| switch (foo) { } - -[#1 Domain] = 0:0-0:16 - >----------------< +[#1 Removal] = +[#1 Domain] = 0:8-0:11 + >---< 0| switch (foo) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:8-0:11 - >---< -0| switch (foo) { } - -[#2 Domain] = 0:7-0:12 - >-----< -0| switch (foo) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:14-0:15 +[#2 Removal] = +[#2 Domain] = 0:14-0:15 >-< 0| switch (foo) { } -[#3 Domain] = 0:13-0:16 - >---< -0| switch (foo) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.switchCase.scope b/data/fixtures/scopes/csharp/interior/interior.switchCase.scope index 79eec9b526..4eb46c2559 100644 --- a/data/fixtures/scopes/csharp/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/csharp/interior/interior.switchCase.scope @@ -10,62 +10,16 @@ switch (foo) { } --- -[#1 Content] = 1:4-8:14 - >------- -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; - --------------< - -[#1 Removal] = 0:14-9:0 - > -0| switch (foo) { -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - < - -[#1 Domain] = 0:0-9:1 - >-------------- -0| switch (foo) { -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - -< - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:8-0:11 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:8-0:11 >---< 0| switch (foo) { -[#2 Domain] = 0:7-0:12 - >-----< -0| switch (foo) { - -[#2 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#3 Content] = 1:4-8:14 +[#2 Content] = 1:4-8:14 >------- 1| case 0: 2| bar; @@ -77,7 +31,7 @@ switch (foo) { 8| break; --------------< -[#3 Removal] = 0:14-9:0 +[#2 Removal] = 0:14-9:0 > 0| switch (foo) { 1| case 0: @@ -91,8 +45,8 @@ switch (foo) { 9| } < -[#3 Domain] = 0:13-9:1 - >- +[#2 Domain] = 0:14-9:0 + > 0| switch (foo) { 1| case 0: 2| bar; @@ -103,79 +57,69 @@ switch (foo) { 7| default: 8| break; 9| } - -< + < -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#4 Content] = -[#4 Removal] = 2:8-3:14 +[#3 Content] = 2:8-3:14 >---- 2| bar; 3| break; --------------< -[#4 Domain] = 1:4-3:14 - >------- +[#3 Removal] = 1:11-3:14 + > 1| case 0: 2| bar; 3| break; --------------< -[#4 Insertion delimiter] = " " +[#3 Domain] = 1:11-3:14 + > +1| case 0: +2| bar; +3| break; + --------------< + +[#3 Insertion delimiter] = " " -[#5 Content] = 5:8-5:14 +[#4 Content] = 5:8-5:14 >------< 5| break; -[#5 Removal] = 4:13-6:4 +[#4 Removal] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#5 Domain] = 4:4-6:5 - >--------- -4| case 1: { -5| break; -6| } - -----< - -[#5 Insertion delimiter] = " " - - -[#6 Content] = 5:8-5:14 - >------< -5| break; - -[#6 Removal] = 4:13-6:4 +[#4 Domain] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#6 Domain] = 4:12-6:5 - >- -4| case 1: { -5| break; -6| } - -----< - -[#6 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " -[#7 Content] = -[#7 Removal] = 8:8-8:14 +[#5 Content] = 8:8-8:14 >------< 8| break; -[#7 Domain] = 7:4-8:14 - >-------- +[#5 Removal] = 7:12-8:14 + > 7| default: 8| break; --------------< -[#7 Insertion delimiter] = " " +[#5 Domain] = 7:12-8:14 + > +7| default: +8| break; + --------------< + +[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.try.scope b/data/fixtures/scopes/csharp/interior/interior.try.scope index ae38809df4..0d567bef32 100644 --- a/data/fixtures/scopes/csharp/interior/interior.try.scope +++ b/data/fixtures/scopes/csharp/interior/interior.try.scope @@ -4,84 +4,36 @@ finally { } --- [#1 Content] = -[#1 Removal] = 0:5-0:6 +[#1 Removal] = +[#1 Domain] = 0:5-0:6 >-< 0| try { } -[#1 Domain] = 0:0-0:7 - >-------< -0| try { } - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:6 - >-< -0| try { } - -[#2 Domain] = 0:4-0:7 - >---< -0| try { } +[#2 Removal] = +[#2 Domain] = 1:6-1:17 + >-----------< +1| catch(Exception e) { } [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:20-1:21 +[#3 Removal] = +[#3 Domain] = 1:20-1:21 >-< 1| catch(Exception e) { } -[#3 Domain] = 1:0-1:22 - >----------------------< -1| catch(Exception e) { } - [#3 Insertion delimiter] = " " [#4 Content] = -[#4 Removal] = 1:6-1:17 - >-----------< -1| catch(Exception e) { } - -[#4 Domain] = 1:5-1:18 - >-------------< -1| catch(Exception e) { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:20-1:21 - >-< -1| catch(Exception e) { } - -[#5 Domain] = 1:19-1:22 - >---< -1| catch(Exception e) { } - -[#5 Insertion delimiter] = " " - - -[#6 Content] = -[#6 Removal] = 2:9-2:10 +[#4 Removal] = +[#4 Domain] = 2:9-2:10 >-< 2| finally { } -[#6 Domain] = 2:0-2:11 - >-----------< -2| finally { } - -[#6 Insertion delimiter] = " " - - -[#7 Content] = -[#7 Removal] = 2:9-2:10 - >-< -2| finally { } - -[#7 Domain] = 2:8-2:11 - >---< -2| finally { } - -[#7 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.while.scope b/data/fixtures/scopes/csharp/interior/interior.while.scope index 3e16181107..31901d1f61 100644 --- a/data/fixtures/scopes/csharp/interior/interior.while.scope +++ b/data/fixtures/scopes/csharp/interior/interior.while.scope @@ -2,36 +2,18 @@ while (true) { } --- [#1 Content] = -[#1 Removal] = 0:14-0:15 - >-< -0| while (true) { } - -[#1 Domain] = 0:0-0:16 - >----------------< +[#1 Removal] = +[#1 Domain] = 0:7-0:11 + >----< 0| while (true) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:7-0:11 - >----< -0| while (true) { } - -[#2 Domain] = 0:6-0:12 - >------< -0| while (true) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:14-0:15 +[#2 Removal] = +[#2 Domain] = 0:14-0:15 >-< 0| while (true) { } -[#3 Domain] = 0:13-0:16 - >---< -0| while (true) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/queries/csharp.scm b/queries/csharp.scm index 20dea66899..055fc05382 100644 --- a/queries/csharp.scm +++ b/queries/csharp.scm @@ -72,16 +72,6 @@ "}" @statement.iteration.end.startOf ) -( - (_ - (block - "{" @interior.start.endOf - "}" @interior.end.startOf - ) - ) @_.domain - (#not-type? @_.domain try_statement if_statement) -) - ;;!! if () {} else {} ;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ( @@ -101,47 +91,28 @@ (#not-parent-type? @condition.domain if_statement) ) -( - (if_statement - consequence: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @interior.domain.end.endOf - ) @interior.domain.start.startOf - (#not-parent-type? @interior.domain.start.startOf if_statement) -) - ;;!! else if () {} ;;! ^^^^^^^^^^^^^ (if_statement - "else" @branch.start.startOf @interior.domain.start.startOf @condition.domain.start.startOf + "else" @branch.start.startOf @condition.domain.start.startOf (if_statement condition: (_) @condition - consequence: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end.endOf @interior.domain.end.endOf @condition.domain.end.endOf + consequence: (_) @branch.end.endOf @condition.domain.end.endOf ) ) ;;!! else {} ;;! ^^^^^^^ (if_statement - "else" @branch.start @interior.domain.start.startOf - alternative: (block - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end @interior.domain.end.endOf + "else" @branch.start + alternative: (block) @branch.end ) ;;!! try () {} ;;! ^^^^^^^^^ (try_statement - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end.endOf @interior.domain.end.endOf -) @branch.start.startOf @interior.domain.start.startOf + body: (_) @branch.end.endOf +) @branch.start.startOf ;;!! catch () {} ;;! ^^^^^^^^^^^ @@ -149,12 +120,7 @@ ;;!! finally {} ;;! ^^^^^^^^^^ -(finally_clause - (block - "{" @interior.start.endOf - "}" @interior.end.startOf - ) -) @branch @interior.domain +(finally_clause) @branch ;;!! try () {} catch () {} finally {} ;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -189,10 +155,6 @@ ;;! ^^^^^^^^^^^^ (class_declaration name: (identifier) @name - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) ) @class @type @_.domain (class_declaration @@ -211,12 +173,7 @@ ;;!! interface IFoo {} ;;! ^^^^^^^^^^^^^^^^^ -(interface_declaration - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) -) @type @interior.domain +(interface_declaration) @type (interface_declaration body: (_ @@ -303,44 +260,31 @@ "new" @functionCallee.start type: (_) @functionCallee.end ) -] @_.domain - -;;!! switch(value) { } -;;! ^ -(switch_statement - (switch_body - "{" @interior.start.endOf - "}" @interior.end.startOf - ) -) @_.domain +] @functionCallee.domain (switch_statement (tuple_expression) @value -) @_.domain +) @value.domain (switch_statement value: (_) @value -) @_.domain +) @value.domain (_ condition: (_) @condition (#not-parent-type? @condition if_statement) -) @_.domain +) @condition.domain (while_statement . (_) @condition -) @_.domain +) @condition.domain (do_statement - (block - "{" @interior.start.endOf - "}" @interior.end.startOf - ) "while" . (_) @condition -) @_.domain +) @condition.domain ;;!! case 0: break; ;;! ^^^^^^^^^^^^^^ @@ -361,22 +305,11 @@ [ (case_switch_label) (default_switch_label) - ] + ] @interior.start.endOf . - (_) @interior.start - (_)? @interior.end - . - (#not-type? @interior.start "block") -) @_.domain - -;;!! case 0: { } -;;! ^ -(switch_section - (block - "{" @interior.start.endOf - "}" @interior.end.startOf - ) -) @_.domain + (_) @_dummy + (#not-type? @_dummy block) +) @interior.end.endOf (switch_statement body: (switch_body @@ -480,10 +413,10 @@ ;;!! enum Foo {} (enum_declaration body: (_ - "{" @interior.start.endOf @name.iteration.start.endOf @value.iteration.start.endOf - "}" @interior.end.startOf @name.iteration.end.startOf @value.iteration.end.startOf + "{" @name.iteration.start.endOf @value.iteration.start.endOf + "}" @name.iteration.end.startOf @value.iteration.end.startOf ) -) @type @interior.domain +) @type ;;!! bar = 0 ;;! ^ From 895aa39dc7304916a92536255eb714681dd7b0cb Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 10:08:27 +0100 Subject: [PATCH 09/38] go --- queries/go.scm | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/queries/go.scm b/queries/go.scm index 7cb7da5335..d181a42120 100644 --- a/queries/go.scm +++ b/queries/go.scm @@ -200,35 +200,16 @@ ;; func foo() (function_declaration name: (_) @name - body: (block - . - "{" @interior.start.endOf - "}" @interior.end.startOf - . - )? -) @namedFunction @_.domain +) @namedFunction @name.domain ;; method declaration ;; func (X) foo() {} (method_declaration name: (_) @name - body: (block - . - "{" @interior.start.endOf - "}" @interior.end.startOf - . - ) -) @namedFunction @_.domain +) @namedFunction @name.domain ;; func literal -(func_literal - body: (block - . - "{" @interior.start.endOf - "}" @interior.end.startOf - . - ) -) @anonymousFunction @namedFunction @interior.domain +(func_literal) @anonymousFunction @namedFunction ;; switch-based branch From 717179d4789df407929883227fb4f3f2a3f02eb8 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 10:09:40 +0100 Subject: [PATCH 10/38] html --- .../scopes/html/interior.element.scope | 21 ++++++------------- queries/html.scm | 2 +- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/data/fixtures/scopes/html/interior.element.scope b/data/fixtures/scopes/html/interior.element.scope index 74c625a413..c97011b8c8 100644 --- a/data/fixtures/scopes/html/interior.element.scope +++ b/data/fixtures/scopes/html/interior.element.scope @@ -2,36 +2,27 @@ --- [#1 Content] = -[#1 Removal] = 0:1-0:4 +[#1 Removal] = +[#1 Domain] = 0:1-0:4 >---< 0|
-[#1 Domain] = 0:0-0:5 - >-----< -0|
- [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:6 +[#2 Removal] = +[#2 Domain] = 0:5-0:6 >-< 0|
-[#2 Domain] = 0:0-0:12 - >------------< -0|
- [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 0:8-0:11 +[#3 Removal] = +[#3 Domain] = 0:8-0:11 >---< 0|
-[#3 Domain] = 0:6-0:12 - >------< -0|
- [#3 Insertion delimiter] = " " diff --git a/queries/html.scm b/queries/html.scm index 3559b325dc..d9bb38df44 100644 --- a/queries/html.scm +++ b/queries/html.scm @@ -70,7 +70,7 @@ (_ (start_tag) @interior.start.endOf (end_tag) @interior.end.startOf -) @xmlElement @interior.domain +) @xmlElement ;;!! text ;;! ^^^^^ ^^^^^^ From a2b1e2723b220c089237f8d7f61cba9520d248bb Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 10:31:58 +0100 Subject: [PATCH 11/38] xml --- .../scopes/xml/interior.element.scope | 21 ++++++------------- queries/xml.scm | 2 +- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/data/fixtures/scopes/xml/interior.element.scope b/data/fixtures/scopes/xml/interior.element.scope index 4a43b91a60..08285c96f1 100644 --- a/data/fixtures/scopes/xml/interior.element.scope +++ b/data/fixtures/scopes/xml/interior.element.scope @@ -2,36 +2,27 @@ --- [#1 Content] = -[#1 Removal] = 0:1-0:5 +[#1 Removal] = +[#1 Domain] = 0:1-0:5 >----< 0| -[#1 Domain] = 0:0-0:6 - >------< -0| - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:6-0:7 +[#2 Removal] = +[#2 Domain] = 0:6-0:7 >-< 0| -[#2 Domain] = 0:0-0:14 - >--------------< -0| - [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 0:9-0:13 +[#3 Removal] = +[#3 Domain] = 0:9-0:13 >----< 0| -[#3 Domain] = 0:7-0:14 - >-------< -0| - [#3 Insertion delimiter] = " " diff --git a/queries/xml.scm b/queries/xml.scm index f8e3098d6f..450008afd4 100644 --- a/queries/xml.scm +++ b/queries/xml.scm @@ -52,7 +52,7 @@ (element (STag) @interior.start.endOf (ETag) @interior.end.startOf -) @xmlElement @interior.domain +) @xmlElement ;;!! text ;;! ^^^^^ ^^^^^^ From 1f004862136e9b4a55915d36f9f0fa51e5a45db2 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 10:34:16 +0100 Subject: [PATCH 12/38] typescript --- .../interior/interior.class.scope | 23 +--- .../interior/interior.constructor.scope | 57 ++------ .../interior/interior.doWhile.scope | 28 +--- .../interior/interior.for.scope | 30 +---- .../interior/interior.foreach.scope | 30 +---- .../interior/interior.foreach2.scope | 30 +---- .../interior/interior.function.scope | 30 +---- .../interior/interior.if.scope | 81 +++-------- .../interior/interior.lambda.scope | 26 +--- .../interior/interior.method.scope | 57 ++------ .../interior/interior.static.scope | 48 +------ .../interior/interior.switch.scope | 30 +---- .../interior/interior.switchCase.scope | 126 +++++------------- .../interior/interior.try.scope | 70 ++-------- .../interior/interior.while.scope | 30 +---- .../javascript.jsx/interior.element.scope | 21 +-- .../typescript.core/interior.enum.scope | 23 +--- .../typescript.core/interior.interface.scope | 23 +--- queries/javascript.core.scm | 59 +++----- queries/javascript.jsx.scm | 26 ++-- queries/typescript.core.scm | 6 +- 21 files changed, 182 insertions(+), 672 deletions(-) diff --git a/data/fixtures/scopes/javascript.core/interior/interior.class.scope b/data/fixtures/scopes/javascript.core/interior/interior.class.scope index 5390112f29..13ef2f4d94 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.class.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.class.scope @@ -1,25 +1,10 @@ class Foo { } --- -[#1 Content] = -[#1 Removal] = 0:11-0:12 +[Content] = +[Removal] = +[Domain] = 0:11-0:12 >-< 0| class Foo { } -[#1 Domain] = 0:0-0:13 - >-------------< -0| class Foo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:11-0:12 - >-< -0| class Foo { } - -[#2 Domain] = 0:10-0:13 - >---< -0| class Foo { } - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope b/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope index 7e12a56c03..8cc737ead9 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope @@ -14,68 +14,29 @@ class Foo { 2| } < -[#1 Domain] = 0:0-2:1 - >----------- +[#1 Domain] = 0:11-2:0 + > 0| class Foo { 1| constructor() { } 2| } - -< + < [#1 Insertion delimiter] = " " -[#2 Content] = 1:4-1:21 - >-----------------< -1| constructor() { } - -[#2 Removal] = 0:11-2:0 - > -0| class Foo { -1| constructor() { } -2| } - < - -[#2 Domain] = 0:10-2:1 - >- -0| class Foo { +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:16-1:16 + >< 1| constructor() { } -2| } - -< [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:19-1:20 +[#3 Removal] = +[#3 Domain] = 1:19-1:20 >-< 1| constructor() { } -[#3 Domain] = 1:4-1:21 - >-----------------< -1| constructor() { } - [#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 1:16-1:16 - >< -1| constructor() { } - -[#4 Domain] = 1:15-1:17 - >--< -1| constructor() { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:19-1:20 - >-< -1| constructor() { } - -[#5 Domain] = 1:18-1:21 - >---< -1| constructor() { } - -[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.doWhile.scope b/data/fixtures/scopes/javascript.core/interior/interior.doWhile.scope index d1833e59d1..691176c939 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.doWhile.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.doWhile.scope @@ -2,36 +2,18 @@ do { } while (true); --- [#1 Content] = -[#1 Removal] = 0:4-0:5 +[#1 Removal] = +[#1 Domain] = 0:4-0:5 >-< 0| do { } while (true); -[#1 Domain] = 0:0-0:20 - >--------------------< -0| do { } while (true); - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:4-0:5 - >-< -0| do { } while (true); - -[#2 Domain] = 0:3-0:6 - >---< -0| do { } while (true); - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:14-0:18 +[#2 Removal] = +[#2 Domain] = 0:14-0:18 >----< 0| do { } while (true); -[#3 Domain] = 0:13-0:19 - >------< -0| do { } while (true); - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.for.scope b/data/fixtures/scopes/javascript.core/interior/interior.for.scope index e9ae933299..2b66831b1b 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.for.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.for.scope @@ -2,36 +2,18 @@ for (let i = 0; i < size; ++i) { } --- [#1 Content] = -[#1 Removal] = 0:32-0:33 - >-< -0| for (let i = 0; i < size; ++i) { } - -[#1 Domain] = 0:0-0:34 - >----------------------------------< +[#1 Removal] = +[#1 Domain] = 0:5-0:29 + >------------------------< 0| for (let i = 0; i < size; ++i) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:29 - >------------------------< -0| for (let i = 0; i < size; ++i) { } - -[#2 Domain] = 0:4-0:30 - >--------------------------< -0| for (let i = 0; i < size; ++i) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:32-0:33 +[#2 Removal] = +[#2 Domain] = 0:32-0:33 >-< 0| for (let i = 0; i < size; ++i) { } -[#3 Domain] = 0:31-0:34 - >---< -0| for (let i = 0; i < size; ++i) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.foreach.scope b/data/fixtures/scopes/javascript.core/interior/interior.foreach.scope index c440342398..8b55996766 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.foreach.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.foreach.scope @@ -2,36 +2,18 @@ for (const v of values) { } --- [#1 Content] = -[#1 Removal] = 0:25-0:26 - >-< -0| for (const v of values) { } - -[#1 Domain] = 0:0-0:27 - >---------------------------< +[#1 Removal] = +[#1 Domain] = 0:5-0:22 + >-----------------< 0| for (const v of values) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:22 - >-----------------< -0| for (const v of values) { } - -[#2 Domain] = 0:4-0:23 - >-------------------< -0| for (const v of values) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:25-0:26 +[#2 Removal] = +[#2 Domain] = 0:25-0:26 >-< 0| for (const v of values) { } -[#3 Domain] = 0:24-0:27 - >---< -0| for (const v of values) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.foreach2.scope b/data/fixtures/scopes/javascript.core/interior/interior.foreach2.scope index 83dc8c49b5..ea7388d4b9 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.foreach2.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.foreach2.scope @@ -2,36 +2,18 @@ for (const k in values) { } --- [#1 Content] = -[#1 Removal] = 0:25-0:26 - >-< -0| for (const k in values) { } - -[#1 Domain] = 0:0-0:27 - >---------------------------< +[#1 Removal] = +[#1 Domain] = 0:5-0:22 + >-----------------< 0| for (const k in values) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:22 - >-----------------< -0| for (const k in values) { } - -[#2 Domain] = 0:4-0:23 - >-------------------< -0| for (const k in values) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:25-0:26 +[#2 Removal] = +[#2 Domain] = 0:25-0:26 >-< 0| for (const k in values) { } -[#3 Domain] = 0:24-0:27 - >---< -0| for (const k in values) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.function.scope b/data/fixtures/scopes/javascript.core/interior/interior.function.scope index 1a87486f13..bfef7835f3 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.function.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.function.scope @@ -2,36 +2,18 @@ function foo() { } --- [#1 Content] = -[#1 Removal] = 0:16-0:17 - >-< -0| function foo() { } - -[#1 Domain] = 0:0-0:18 - >------------------< +[#1 Removal] = +[#1 Domain] = 0:13-0:13 + >< 0| function foo() { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:13-0:13 - >< -0| function foo() { } - -[#2 Domain] = 0:12-0:14 - >--< -0| function foo() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:16-0:17 +[#2 Removal] = +[#2 Domain] = 0:16-0:17 >-< 0| function foo() { } -[#3 Domain] = 0:15-0:18 - >---< -0| function foo() { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.if.scope b/data/fixtures/scopes/javascript.core/interior/interior.if.scope index 52ac91931a..22a989ae6d 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.if.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.if.scope @@ -4,96 +4,45 @@ else { } --- [#1 Content] = -[#1 Removal] = 0:11-0:12 - >-< -0| if (true) { } - -[#1 Domain] = 0:0-0:13 - >-------------< +[#1 Removal] = +[#1 Domain] = 0:4-0:8 + >----< 0| if (true) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:4-0:8 - >----< -0| if (true) { } - -[#2 Domain] = 0:3-0:9 - >------< +[#2 Removal] = +[#2 Domain] = 0:11-0:12 + >-< 0| if (true) { } [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 0:11-0:12 - >-< -0| if (true) { } - -[#3 Domain] = 0:10-0:13 - >---< -0| if (true) { } +[#3 Removal] = +[#3 Domain] = 1:9-1:14 + >-----< +1| else if (false) { } [#3 Insertion delimiter] = " " [#4 Content] = -[#4 Removal] = 1:17-1:18 +[#4 Removal] = +[#4 Domain] = 1:17-1:18 >-< 1| else if (false) { } -[#4 Domain] = 1:0-1:19 - >-------------------< -1| else if (false) { } - [#4 Insertion delimiter] = " " [#5 Content] = -[#5 Removal] = 1:9-1:14 - >-----< -1| else if (false) { } - -[#5 Domain] = 1:8-1:15 - >-------< -1| else if (false) { } - -[#5 Insertion delimiter] = " " - - -[#6 Content] = -[#6 Removal] = 1:17-1:18 - >-< -1| else if (false) { } - -[#6 Domain] = 1:16-1:19 - >---< -1| else if (false) { } - -[#6 Insertion delimiter] = " " - - -[#7 Content] = -[#7 Removal] = 2:6-2:7 +[#5 Removal] = +[#5 Domain] = 2:6-2:7 >-< 2| else { } -[#7 Domain] = 2:0-2:8 - >--------< -2| else { } - -[#7 Insertion delimiter] = " " - - -[#8 Content] = -[#8 Removal] = 2:6-2:7 - >-< -2| else { } - -[#8 Domain] = 2:5-2:8 - >---< -2| else { } - -[#8 Insertion delimiter] = " " +[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.lambda.scope b/data/fixtures/scopes/javascript.core/interior/interior.lambda.scope index 3e128b3d86..e4ec0acbe9 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.lambda.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.lambda.scope @@ -2,36 +2,18 @@ --- [#1 Content] = -[#1 Removal] = 0:1-0:1 +[#1 Removal] = +[#1 Domain] = 0:1-0:1 >< 0| () => { } -[#1 Domain] = 0:0-0:2 - >--< -0| () => { } - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:7-0:8 +[#2 Removal] = +[#2 Domain] = 0:7-0:8 >-< 0| () => { } -[#2 Domain] = 0:0-0:9 - >---------< -0| () => { } - [#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:7-0:8 - >-< -0| () => { } - -[#3 Domain] = 0:6-0:9 - >---< -0| () => { } - -[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.method.scope b/data/fixtures/scopes/javascript.core/interior/interior.method.scope index b83489b042..635e566048 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.method.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.method.scope @@ -14,68 +14,29 @@ class Foo { 2| } < -[#1 Domain] = 0:0-2:1 - >----------- +[#1 Domain] = 0:11-2:0 + > 0| class Foo { 1| bar() { } 2| } - -< + < [#1 Insertion delimiter] = " " -[#2 Content] = 1:4-1:13 - >---------< -1| bar() { } - -[#2 Removal] = 0:11-2:0 - > -0| class Foo { -1| bar() { } -2| } - < - -[#2 Domain] = 0:10-2:1 - >- -0| class Foo { +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:8-1:8 + >< 1| bar() { } -2| } - -< [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:11-1:12 +[#3 Removal] = +[#3 Domain] = 1:11-1:12 >-< 1| bar() { } -[#3 Domain] = 1:4-1:13 - >---------< -1| bar() { } - [#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 1:8-1:8 - >< -1| bar() { } - -[#4 Domain] = 1:7-1:9 - >--< -1| bar() { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:11-1:12 - >-< -1| bar() { } - -[#5 Domain] = 1:10-1:13 - >---< -1| bar() { } - -[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.static.scope b/data/fixtures/scopes/javascript.core/interior/interior.static.scope index ec08e00aa5..7faf9b8a6c 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.static.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.static.scope @@ -14,56 +14,20 @@ class Foo { 2| } < -[#1 Domain] = 0:0-2:1 - >----------- -0| class Foo { -1| static { } -2| } - -< - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 1:4-1:14 - >----------< -1| static { } - -[#2 Removal] = 0:11-2:0 +[#1 Domain] = 0:11-2:0 > 0| class Foo { 1| static { } 2| } < -[#2 Domain] = 0:10-2:1 - >- -0| class Foo { -1| static { } -2| } - -< - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 1:12-1:13 - >-< -1| static { } - -[#3 Domain] = 1:4-1:14 - >----------< -1| static { } - -[#3 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#4 Content] = -[#4 Removal] = 1:12-1:13 +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:12-1:13 >-< 1| static { } -[#4 Domain] = 1:11-1:14 - >---< -1| static { } - -[#4 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.switch.scope b/data/fixtures/scopes/javascript.core/interior/interior.switch.scope index e2ad168b18..35e3f6a261 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.switch.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.switch.scope @@ -2,36 +2,18 @@ switch (value) { } --- [#1 Content] = -[#1 Removal] = 0:16-0:17 - >-< -0| switch (value) { } - -[#1 Domain] = 0:0-0:18 - >------------------< +[#1 Removal] = +[#1 Domain] = 0:8-0:13 + >-----< 0| switch (value) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:8-0:13 - >-----< -0| switch (value) { } - -[#2 Domain] = 0:7-0:14 - >-------< -0| switch (value) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:16-0:17 +[#2 Removal] = +[#2 Domain] = 0:16-0:17 >-< 0| switch (value) { } -[#3 Domain] = 0:15-0:18 - >---< -0| switch (value) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope b/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope index 79eec9b526..4eb46c2559 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope @@ -10,62 +10,16 @@ switch (foo) { } --- -[#1 Content] = 1:4-8:14 - >------- -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; - --------------< - -[#1 Removal] = 0:14-9:0 - > -0| switch (foo) { -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - < - -[#1 Domain] = 0:0-9:1 - >-------------- -0| switch (foo) { -1| case 0: -2| bar; -3| break; -4| case 1: { -5| break; -6| } -7| default: -8| break; -9| } - -< - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:8-0:11 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:8-0:11 >---< 0| switch (foo) { -[#2 Domain] = 0:7-0:12 - >-----< -0| switch (foo) { - -[#2 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#3 Content] = 1:4-8:14 +[#2 Content] = 1:4-8:14 >------- 1| case 0: 2| bar; @@ -77,7 +31,7 @@ switch (foo) { 8| break; --------------< -[#3 Removal] = 0:14-9:0 +[#2 Removal] = 0:14-9:0 > 0| switch (foo) { 1| case 0: @@ -91,8 +45,8 @@ switch (foo) { 9| } < -[#3 Domain] = 0:13-9:1 - >- +[#2 Domain] = 0:14-9:0 + > 0| switch (foo) { 1| case 0: 2| bar; @@ -103,79 +57,69 @@ switch (foo) { 7| default: 8| break; 9| } - -< + < -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#4 Content] = -[#4 Removal] = 2:8-3:14 +[#3 Content] = 2:8-3:14 >---- 2| bar; 3| break; --------------< -[#4 Domain] = 1:4-3:14 - >------- +[#3 Removal] = 1:11-3:14 + > 1| case 0: 2| bar; 3| break; --------------< -[#4 Insertion delimiter] = " " +[#3 Domain] = 1:11-3:14 + > +1| case 0: +2| bar; +3| break; + --------------< + +[#3 Insertion delimiter] = " " -[#5 Content] = 5:8-5:14 +[#4 Content] = 5:8-5:14 >------< 5| break; -[#5 Removal] = 4:13-6:4 +[#4 Removal] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#5 Domain] = 4:4-6:5 - >--------- -4| case 1: { -5| break; -6| } - -----< - -[#5 Insertion delimiter] = " " - - -[#6 Content] = 5:8-5:14 - >------< -5| break; - -[#6 Removal] = 4:13-6:4 +[#4 Domain] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#6 Domain] = 4:12-6:5 - >- -4| case 1: { -5| break; -6| } - -----< - -[#6 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " -[#7 Content] = -[#7 Removal] = 8:8-8:14 +[#5 Content] = 8:8-8:14 >------< 8| break; -[#7 Domain] = 7:4-8:14 - >-------- +[#5 Removal] = 7:12-8:14 + > 7| default: 8| break; --------------< -[#7 Insertion delimiter] = " " +[#5 Domain] = 7:12-8:14 + > +7| default: +8| break; + --------------< + +[#5 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.try.scope b/data/fixtures/scopes/javascript.core/interior/interior.try.scope index 3b5323b649..d420b4f8e3 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.try.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.try.scope @@ -4,84 +4,36 @@ finally { } --- [#1 Content] = -[#1 Removal] = 0:5-0:6 +[#1 Removal] = +[#1 Domain] = 0:5-0:6 >-< 0| try { } -[#1 Domain] = 0:0-0:7 - >-------< -0| try { } - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:6 - >-< -0| try { } - -[#2 Domain] = 0:4-0:7 - >---< -0| try { } +[#2 Removal] = +[#2 Domain] = 1:6-1:7 + >-< +1| catch(e) { } [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 1:10-1:11 +[#3 Removal] = +[#3 Domain] = 1:10-1:11 >-< 1| catch(e) { } -[#3 Domain] = 1:0-1:12 - >------------< -1| catch(e) { } - [#3 Insertion delimiter] = " " [#4 Content] = -[#4 Removal] = 1:6-1:7 - >-< -1| catch(e) { } - -[#4 Domain] = 1:5-1:8 - >---< -1| catch(e) { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 1:10-1:11 - >-< -1| catch(e) { } - -[#5 Domain] = 1:9-1:12 - >---< -1| catch(e) { } - -[#5 Insertion delimiter] = " " - - -[#6 Content] = -[#6 Removal] = 2:9-2:10 +[#4 Removal] = +[#4 Domain] = 2:9-2:10 >-< 2| finally { } -[#6 Domain] = 2:0-2:11 - >-----------< -2| finally { } - -[#6 Insertion delimiter] = " " - - -[#7 Content] = -[#7 Removal] = 2:9-2:10 - >-< -2| finally { } - -[#7 Domain] = 2:8-2:11 - >---< -2| finally { } - -[#7 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.while.scope b/data/fixtures/scopes/javascript.core/interior/interior.while.scope index 3e16181107..31901d1f61 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.while.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.while.scope @@ -2,36 +2,18 @@ while (true) { } --- [#1 Content] = -[#1 Removal] = 0:14-0:15 - >-< -0| while (true) { } - -[#1 Domain] = 0:0-0:16 - >----------------< +[#1 Removal] = +[#1 Domain] = 0:7-0:11 + >----< 0| while (true) { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:7-0:11 - >----< -0| while (true) { } - -[#2 Domain] = 0:6-0:12 - >------< -0| while (true) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:14-0:15 +[#2 Removal] = +[#2 Domain] = 0:14-0:15 >-< 0| while (true) { } -[#3 Domain] = 0:13-0:16 - >---< -0| while (true) { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.jsx/interior.element.scope b/data/fixtures/scopes/javascript.jsx/interior.element.scope index 74c625a413..c97011b8c8 100644 --- a/data/fixtures/scopes/javascript.jsx/interior.element.scope +++ b/data/fixtures/scopes/javascript.jsx/interior.element.scope @@ -2,36 +2,27 @@ --- [#1 Content] = -[#1 Removal] = 0:1-0:4 +[#1 Removal] = +[#1 Domain] = 0:1-0:4 >---< 0|
-[#1 Domain] = 0:0-0:5 - >-----< -0|
- [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:5-0:6 +[#2 Removal] = +[#2 Domain] = 0:5-0:6 >-< 0|
-[#2 Domain] = 0:0-0:12 - >------------< -0|
- [#2 Insertion delimiter] = " " [#3 Content] = -[#3 Removal] = 0:8-0:11 +[#3 Removal] = +[#3 Domain] = 0:8-0:11 >---< 0|
-[#3 Domain] = 0:6-0:12 - >------< -0|
- [#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/interior.enum.scope b/data/fixtures/scopes/typescript.core/interior.enum.scope index a5274985e7..d96875b078 100644 --- a/data/fixtures/scopes/typescript.core/interior.enum.scope +++ b/data/fixtures/scopes/typescript.core/interior.enum.scope @@ -1,25 +1,10 @@ enum Foo { } --- -[#1 Content] = -[#1 Removal] = 0:10-0:11 +[Content] = +[Removal] = +[Domain] = 0:10-0:11 >-< 0| enum Foo { } -[#1 Domain] = 0:0-0:12 - >------------< -0| enum Foo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:10-0:11 - >-< -0| enum Foo { } - -[#2 Domain] = 0:9-0:12 - >---< -0| enum Foo { } - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/interior.interface.scope b/data/fixtures/scopes/typescript.core/interior.interface.scope index f79024c7de..b9968a2fff 100644 --- a/data/fixtures/scopes/typescript.core/interior.interface.scope +++ b/data/fixtures/scopes/typescript.core/interior.interface.scope @@ -1,25 +1,10 @@ interface Foo { } --- -[#1 Content] = -[#1 Removal] = 0:15-0:16 +[Content] = +[Removal] = +[Domain] = 0:15-0:16 >-< 0| interface Foo { } -[#1 Domain] = 0:0-0:17 - >-----------------< -0| interface Foo { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:15-0:16 - >-< -0| interface Foo { } - -[#2 Domain] = 0:14-0:17 - >---< -0| interface Foo { } - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index 21d402ccaf..8f0b95326c 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -502,17 +502,6 @@ (#type? @_dummy statement_block class_body interface_body) ) -( - (_ - (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @_dummy - ) @_.domain - (#type? @_dummy statement_block class_body interface_body switch_body) - (#not-type? @_.domain if_statement try_statement) -) - ;;!! const aaa = {bbb: 0, ccc: 0}; ;;! ************** (object @@ -682,19 +671,23 @@ ;;! ^^^^^^^^^^^^^^^ (switch_default) @branch +;;!! case 0: break; +;;! ^^^^^^ (switch_case - body: (_) @interior.start - body: (_)? @interior.end + ":" @interior.start.endOf . - (#not-type? @interior.start statement_block) -) @_.domain + (_) @_dummy + (#not-type? @_dummy statement_block) +) @interior.end.endOf +;;!! default: break; +;;! ^^^^^^ (switch_default - body: (_) @interior.start - body: (_)? @interior.end + ":" @interior.start.endOf . - (#not-type? @interior.start statement_block) -) @_.domain + (_) @_dummy + (#not-type? @_dummy statement_block) +) @interior.end.endOf ;;!! if () {} else {} ;;! ^^^^^^^^^^^^^^^^ @@ -707,12 +700,9 @@ ;;! ^^^^^^^^ ( (if_statement - "if" @branch.start.startOf @branch.removal.start.startOf @interior.domain.start.startOf + "if" @branch.start.startOf @branch.removal.start.startOf condition: (_) @condition - consequence: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end.endOf @branch.removal.end.endOf @interior.domain.end.endOf + consequence: (_) @branch.end.endOf @branch.removal.end.endOf alternative: (else_clause (if_statement)? @branch.removal.end.startOf )? @branch.removal.end.startOf @@ -724,13 +714,10 @@ ;;!! else if () {} ;;! ^^^^^^^^^^^^^ (else_clause - "else" @branch.start.startOf @condition.domain.start.startOf @interior.domain.start.startOf + "else" @branch.start.startOf @condition.domain.start.startOf (if_statement condition: (_) @condition - consequence: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end.endOf @condition.domain.end.endOf @interior.domain.end.endOf + consequence: (_) @branch.end.endOf @condition.domain.end.endOf ) (#child-range! @condition 0 -1 true true) ) @@ -738,20 +725,14 @@ ;;!! else {} ;;! ^^^^^^^ (else_clause - (statement_block - "{" @interior.start.endOf - "}" @interior.end.startOf - ) -) @branch @interior.domain + (statement_block) +) @branch ;;!! try () {} ;;! ^^^^^^^^^ (try_statement - "try" @branch.start @interior.domain.start.startOf - body: (_ - "{" @interior.start.endOf - "}" @interior.end.startOf - ) @branch.end @interior.domain.end.endOf + "try" @branch.start + body: (_) @branch.end ) ;;!! catch () {} diff --git a/queries/javascript.jsx.scm b/queries/javascript.jsx.scm index 2825fcff08..d673455c01 100644 --- a/queries/javascript.jsx.scm +++ b/queries/javascript.jsx.scm @@ -1,23 +1,19 @@ ;;!! bar ;;! ^^^^^^^^^^^^^^ -;;! ### -;;! *** -( - (jsx_element) @xmlElement @interior @interior.domain - (#child-range! @interior 0 -1 true true) -) -( - (jsx_element) @xmlElement.iteration - (#child-range! @xmlElement.iteration 0 -1 true true) +(jsx_element) @xmlElement + +;;!! bar +;;! ^^^ +(jsx_element + (jsx_opening_element) @interior.start.endOf @xmlElement.iteration.start.endOf + (jsx_closing_element) @interior.end.startOf @xmlElement.iteration.end.startOf ) ;;!! bar -;;! *** -( - (jsx_element) @xmlStartTag.iteration @xmlEndTag.iteration @xmlBothTags.iteration - (#child-range! @xmlStartTag.iteration 0 -1 true true) - (#child-range! @xmlEndTag.iteration 0 -1 true true) - (#child-range! @xmlBothTags.iteration 0 -1 true true) +;;! ^^^ +(jsx_element + (jsx_opening_element) @xmlStartTag.iteration.start.endOf @xmlEndTag.iteration.start.endOf @xmlBothTags.iteration.start.endOf + (jsx_closing_element) @xmlStartTag.iteration.end.startOf @xmlEndTag.iteration.end.startOf @xmlBothTags.iteration.end.startOf ) ;;!! bar diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index b1430d08e4..e58003a4b1 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -39,10 +39,10 @@ ;;! ^ (enum_declaration (enum_body - "{" @interior.start.endOf @name.iteration.start.endOf @value.iteration.start.endOf - "}" @interior.end.startOf @name.iteration.end.startOf @value.iteration.end.startOf + "{" @name.iteration.start.endOf @value.iteration.start.endOf + "}" @name.iteration.end.startOf @value.iteration.end.startOf ) -) @type @interior.domain +) @type ;;!! enum Foo { aaa, bbb } ;;! ^^^ ^^^ From a1933d4ca010816358a54a8ceef91d772995d610 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 10:38:44 +0100 Subject: [PATCH 13/38] scss --- .../scopes/scss/interior.function.scope | 30 ++------- data/fixtures/scopes/scss/interior.if.scope | 63 +++---------------- queries/scss.scm | 7 --- 3 files changed, 15 insertions(+), 85 deletions(-) diff --git a/data/fixtures/scopes/scss/interior.function.scope b/data/fixtures/scopes/scss/interior.function.scope index 550f4806fc..aceac05963 100644 --- a/data/fixtures/scopes/scss/interior.function.scope +++ b/data/fixtures/scopes/scss/interior.function.scope @@ -2,36 +2,18 @@ --- [#1 Content] = -[#1 Removal] = 0:17-0:18 - >-< -0| @function foo() { } - -[#1 Domain] = 0:0-0:19 - >-------------------< +[#1 Removal] = +[#1 Domain] = 0:14-0:14 + >< 0| @function foo() { } [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:14-0:14 - >< -0| @function foo() { } - -[#2 Domain] = 0:13-0:15 - >--< -0| @function foo() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 0:17-0:18 +[#2 Removal] = +[#2 Domain] = 0:17-0:18 >-< 0| @function foo() { } -[#3 Domain] = 0:16-0:19 - >---< -0| @function foo() { } - -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/scss/interior.if.scope b/data/fixtures/scopes/scss/interior.if.scope index 3c64701f8f..913d07828d 100644 --- a/data/fixtures/scopes/scss/interior.if.scope +++ b/data/fixtures/scopes/scss/interior.if.scope @@ -4,72 +4,27 @@ --- [#1 Content] = -[#1 Removal] = 0:10-0:11 +[#1 Removal] = +[#1 Domain] = 0:10-0:11 >-< 0| @if true { } -[#1 Domain] = 0:0-0:12 - >------------< -0| @if true { } - [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:10-0:11 - >-< -0| @if true { } - -[#2 Domain] = 0:9-0:12 - >---< -0| @if true { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 1:16-1:17 +[#2 Removal] = +[#2 Domain] = 1:16-1:17 >-< 1| @else if false { } -[#3 Domain] = 1:0-1:18 - >------------------< -1| @else if false { } - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = 1:16-1:17 - >-< -1| @else if false { } - -[#4 Domain] = 1:15-1:18 - >---< -1| @else if false { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = 2:7-2:8 - >-< -2| @else { } - -[#5 Domain] = 2:0-2:9 - >---------< -2| @else { } - -[#5 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#6 Content] = -[#6 Removal] = 2:7-2:8 +[#3 Content] = +[#3 Removal] = +[#3 Domain] = 2:7-2:8 >-< 2| @else { } -[#6 Domain] = 2:6-2:9 - >---< -2| @else { } - -[#6 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " diff --git a/queries/scss.scm b/queries/scss.scm index ceda500c02..c87893768e 100644 --- a/queries/scss.scm +++ b/queries/scss.scm @@ -30,13 +30,6 @@ (while_statement) ] @statement -(_ - (block - "{" @interior.start.endOf - "}" @interior.end.startOf - ) -) @_.domain - (single_line_comment) @comment @textFragment ;;!! @if true { } @else { } From 0521934cdbebb09bfa652a1bad20581530d9aa37 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 6 Nov 2025 10:59:16 +0100 Subject: [PATCH 14/38] latex --- queries/latex.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/queries/latex.scm b/queries/latex.scm index b357165ce1..cf35700f14 100644 --- a/queries/latex.scm +++ b/queries/latex.scm @@ -16,14 +16,20 @@ (subparagraph) @subParagraph (_ - (begin) @xmlStartTag @interior.start.endOf - (end) @xmlEndTag @interior.end.startOf + (begin) @xmlStartTag + (end) @xmlEndTag ) @environment @xmlElement @_.domain +(_ + (begin) @interior.start.endOf + (end) @interior.end.startOf +) + (_ (begin) @xmlBothTags (#allow-multiple! @xmlBothTags) ) @_.domain + (_ (end) @xmlBothTags (#allow-multiple! @xmlBothTags) From 7fd57a17598aec5bef8fb5aecb2cae414622431f Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 7 Nov 2025 08:53:05 +0100 Subject: [PATCH 15/38] talon --- data/fixtures/scopes/talon/interior.command.scope | 13 +++++++++---- queries/talon.scm | 13 ++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/data/fixtures/scopes/talon/interior.command.scope b/data/fixtures/scopes/talon/interior.command.scope index 1f3a9d4c54..35f2bcc898 100644 --- a/data/fixtures/scopes/talon/interior.command.scope +++ b/data/fixtures/scopes/talon/interior.command.scope @@ -2,13 +2,18 @@ foo: bar = 0 --- -[Content] = -[Removal] = 1:4-1:11 +[Content] = 1:4-1:11 >-------< 1| bar = 0 -[Domain] = 0:0-1:11 - >---- +[Removal] = 0:4-1:11 + > +0| foo: +1| bar = 0 + -----------< + +[Domain] = 0:4-1:11 + > 0| foo: 1| bar = 0 -----------< diff --git a/queries/talon.scm b/queries/talon.scm index 74b212f428..8b5f86d576 100644 --- a/queries/talon.scm +++ b/queries/talon.scm @@ -121,12 +121,19 @@ ;;!! slap: key(enter) ;;! ^^^^^^^^^^^^^^^^ ( - (command_declaration - right: (_) @interior - ) @command @interior.domain + (command_declaration) @command (#insertion-delimiter! @command "\n") ) +;;!! slap: key(enter) +;;! ^^^^^^^^^^^ +( + (command_declaration + ":" @interior.start.endOf + right: (_) @interior.end.endOf + ) +) + ;;!! key(enter) ;;! ^^^^^^^^^^ ;;!! edit.left() From 7a151f95362c3a666d65c9f4b8b9ad3e8626045a Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 7 Nov 2025 09:13:44 +0100 Subject: [PATCH 16/38] lua --- .../scopes/lua/interior.function.scope | 18 +++---- data/fixtures/scopes/lua/interior.if.scope | 51 +++++++++++++------ queries/lua.scm | 38 ++++++++++---- 3 files changed, 69 insertions(+), 38 deletions(-) diff --git a/data/fixtures/scopes/lua/interior.function.scope b/data/fixtures/scopes/lua/interior.function.scope index ee6c7f7217..9cf3b65eac 100644 --- a/data/fixtures/scopes/lua/interior.function.scope +++ b/data/fixtures/scopes/lua/interior.function.scope @@ -2,24 +2,18 @@ function foo() end --- [#1 Content] = -[#1 Removal] = 0:14-0:15 - >-< -0| function foo() end - -[#1 Domain] = 0:0-0:18 - >------------------< +[#1 Removal] = +[#1 Domain] = 0:13-0:13 + >< 0| function foo() end [#1 Insertion delimiter] = " " [#2 Content] = -[#2 Removal] = 0:13-0:13 - >< -0| function foo() end - -[#2 Domain] = 0:12-0:14 - >--< +[#2 Removal] = +[#2 Domain] = 0:14-0:15 + >-< 0| function foo() end [#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/lua/interior.if.scope b/data/fixtures/scopes/lua/interior.if.scope index 044b13f70b..9e06cf6864 100644 --- a/data/fixtures/scopes/lua/interior.if.scope +++ b/data/fixtures/scopes/lua/interior.if.scope @@ -7,43 +7,64 @@ else end --- -[#1 Content] = -[#1 Removal] = 1:4-1:9 +[#1 Content] = 1:4-1:9 >-----< 1| a = 1 -[#1 Domain] = 0:0-1:9 - >------------ +[#1 Removal] = 0:12-2:0 + > 0| if true then 1| a = 1 - ---------< +2| elseif false then + < + +[#1 Domain] = 0:12-2:0 + > +0| if true then +1| a = 1 +2| elseif false then + < [#1 Insertion delimiter] = " " -[#2 Content] = -[#2 Removal] = 3:4-3:9 +[#2 Content] = 3:4-3:9 >-----< 3| a = 2 -[#2 Domain] = 2:0-3:9 - >----------------- +[#2 Removal] = 2:17-4:0 + > 2| elseif false then 3| a = 2 - ---------< +4| else + < + +[#2 Domain] = 2:17-4:0 + > +2| elseif false then +3| a = 2 +4| else + < [#2 Insertion delimiter] = " " -[#3 Content] = -[#3 Removal] = 5:4-5:9 +[#3 Content] = 5:4-5:9 >-----< 5| a = 3 -[#3 Domain] = 4:0-5:9 - >---- +[#3 Removal] = 4:4-6:0 + > +4| else +5| a = 3 +6| end + < + +[#3 Domain] = 4:4-6:0 + > 4| else 5| a = 3 - ---------< +6| end + < [#3 Insertion delimiter] = " " diff --git a/queries/lua.scm b/queries/lua.scm index ed6c682f60..3a11e70ec0 100644 --- a/queries/lua.scm +++ b/queries/lua.scm @@ -49,11 +49,18 @@ ;;! ^^^^^^^^^^^^^^^^ ;;! ^^^^ (if_statement - "if" @interior.domain.start condition: (_) @condition - consequence: (_)? @interior @interior.domain.end ) @ifStatement @condition.domain @branch.iteration +;;!! if true then a=1 end +;;! ^^^^^ +(if_statement + "then" @interior.start.endOf + consequence: (_) + . + _ @interior.end.startOf +) + ;;!! if true then end ;;! ^^^^^^^^^^^^ (if_statement @@ -85,16 +92,25 @@ ;;!! elseif true then ;;! ^^^^^^^^^^^^^^^^ ;;! ^^^^ -(elseif_statement - condition: (_) @condition - consequence: (_) @interior -) @branch @_.domain +(if_statement + (elseif_statement + condition: (_) @condition + "then" @interior.start.endOf + ) @branch @condition.domain + . + _ @interior.end.startOf +) ;;!! else then ;;! ^^^^^^^^^ -(else_statement - body: (_) @interior -) @branch @interior.domain + +(if_statement + (else_statement + "else" @interior.start.endOf + ) @branch + . + _ @interior.end.startOf +) ;;!! while true do ;;! ^^^^ @@ -220,7 +236,7 @@ name: (_) @name parameters: (_) @interior.start.endOf "end" @interior.end.startOf -) @namedFunction @_.domain +) @namedFunction @name.domain ;; inside lambda: ;;!! __add = function(a, b) return a + b end @@ -231,7 +247,7 @@ (function_definition parameters: (_) @interior.start.endOf "end" @interior.end.startOf -) @anonymousFunction @_.domain +) @anonymousFunction ;; Names and values From f93936c862940ea87b283fa429e262aacf1dbcca Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 7 Nov 2025 09:19:39 +0100 Subject: [PATCH 17/38] markdown --- .../scopes/markdown/interior.cell.scope | 6 ++--- .../scopes/markdown/interior.cell2.scope | 6 ++--- queries/markdown.scm | 23 +------------------ 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/data/fixtures/scopes/markdown/interior.cell.scope b/data/fixtures/scopes/markdown/interior.cell.scope index ea6c76e382..58439cebbe 100644 --- a/data/fixtures/scopes/markdown/interior.cell.scope +++ b/data/fixtures/scopes/markdown/interior.cell.scope @@ -16,11 +16,11 @@ let foo; 2| ``` < -[Domain] = 0:0-2:3 - >----- +[Domain] = 0:3-2:0 + >-- 0| ```ts 1| let foo; 2| ``` - ---< + < [Insertion delimiter] = " " diff --git a/data/fixtures/scopes/markdown/interior.cell2.scope b/data/fixtures/scopes/markdown/interior.cell2.scope index 1366885ab2..d10d5932d9 100644 --- a/data/fixtures/scopes/markdown/interior.cell2.scope +++ b/data/fixtures/scopes/markdown/interior.cell2.scope @@ -14,11 +14,11 @@ Hello world 2| ``` < -[Domain] = 0:0-2:3 - >--- +[Domain] = 0:3-2:0 + > 0| ``` 1| Hello world 2| ``` - ---< + < [Insertion delimiter] = " " diff --git a/queries/markdown.scm b/queries/markdown.scm index e81ecc9e9c..e753e484cc 100644 --- a/queries/markdown.scm +++ b/queries/markdown.scm @@ -47,28 +47,7 @@ ;;!! ``` ;;! ^^^ ( - (fenced_code_block - (fenced_code_block_delimiter) @interior.start.endOf - . - (block_continuation) - (fenced_code_block_delimiter) @interior.end.startOf - ) @notebookCell @interior.domain - (#trim-end! @notebookCell) - (#insertion-delimiter! @notebookCell "\n\n") -) - -;;!! ```python -;;! ^^^^^^^^^ -;;!! pass -;;! ---- -;;! #### -;;!! ``` -;;! ^^^ -( - (fenced_code_block - (info_string) @interior.start.endOf - (fenced_code_block_delimiter) @interior.end.startOf - ) @notebookCell @interior.domain + (fenced_code_block) @notebookCell (#trim-end! @notebookCell) (#insertion-delimiter! @notebookCell "\n\n") ) From a8c533e8c684f74bb326dc08012bcf344c6e2b12 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 7 Nov 2025 09:22:09 +0100 Subject: [PATCH 18/38] r --- queries/r.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries/r.scm b/queries/r.scm index f70cd30cdb..b34f60cd6f 100644 --- a/queries/r.scm +++ b/queries/r.scm @@ -27,7 +27,7 @@ rhs: (function_definition name: "function" parameters: (parameters) - body: (braced_expression) @interior + body: (braced_expression) ) @name.trailing.startOf ) @namedFunction @_.domain From 09ea3f44bd4cadc3a2048d35423e0ec17ef98281 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 7 Nov 2025 09:27:41 +0100 Subject: [PATCH 19/38] Update comments --- queries/c.scm | 2 +- queries/csharp.scm | 4 ++-- queries/java.scm | 4 ++-- queries/javascript.core.scm | 4 ++-- queries/latex.scm | 2 ++ queries/python.scm | 3 +-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/queries/c.scm b/queries/c.scm index e85126947d..a9b2fdb870 100644 --- a/queries/c.scm +++ b/queries/c.scm @@ -371,7 +371,7 @@ ) @condition.domain ;;!! case 0: break; -;;! ^^^^^^ +;;! ^^^^^^^ (case_statement ":" @interior.start.endOf . diff --git a/queries/csharp.scm b/queries/csharp.scm index 055fc05382..a0b62d8aff 100644 --- a/queries/csharp.scm +++ b/queries/csharp.scm @@ -297,10 +297,10 @@ . (_) @condition ) -) @_.domain +) @condition.domain ;;!! default: break; -;;! ^^^^^^ +;;! ^^^^^^^ (switch_section [ (case_switch_label) diff --git a/queries/java.scm b/queries/java.scm index f55124d202..41be9a6d5d 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -195,14 +195,14 @@ ) @condition.domain ;;!! case "0" -> "zero"; -;;! ^^^^^^^ +;;! ^^^^^^^^ (switch_rule "->" @interior.start.endOf (expression_statement) ) @interior.end.endOf ;;!! case 0: break; -;;! ^^^^^^ +;;! ^^^^^^^ (switch_block_statement_group ":" @interior.start.endOf (_) @_dummy diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index 8f0b95326c..01e9aa5999 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -672,7 +672,7 @@ (switch_default) @branch ;;!! case 0: break; -;;! ^^^^^^ +;;! ^^^^^^^ (switch_case ":" @interior.start.endOf . @@ -681,7 +681,7 @@ ) @interior.end.endOf ;;!! default: break; -;;! ^^^^^^ +;;! ^^^^^^^ (switch_default ":" @interior.start.endOf . diff --git a/queries/latex.scm b/queries/latex.scm index cf35700f14..2918539577 100644 --- a/queries/latex.scm +++ b/queries/latex.scm @@ -20,6 +20,8 @@ (end) @xmlEndTag ) @environment @xmlElement @_.domain +;;!! \begin{quote} Hello \end{quote} +;;! ^^^^^^^ (_ (begin) @interior.start.endOf (end) @interior.end.startOf diff --git a/queries/python.scm b/queries/python.scm index c622b12c8d..81af439cbf 100644 --- a/queries/python.scm +++ b/queries/python.scm @@ -35,8 +35,7 @@ ] @statement ;;!! if True: pass -;;! ^^^^ -;;! ----- +;;! ^^^^^ (_ ":" @interior.start.endOf . From fceedc54c16b7758b692b5cb6ea586779c4b5399 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 7 Nov 2025 09:36:12 +0100 Subject: [PATCH 20/38] textual --- data/fixtures/scopes/plaintext/interior.surroundingPair.scope | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/fixtures/scopes/plaintext/interior.surroundingPair.scope b/data/fixtures/scopes/plaintext/interior.surroundingPair.scope index 24f970f757..f2a71db63a 100644 --- a/data/fixtures/scopes/plaintext/interior.surroundingPair.scope +++ b/data/fixtures/scopes/plaintext/interior.surroundingPair.scope @@ -9,8 +9,8 @@ >------< 0| ( text ) -[Domain] = 0:0-0:8 - >--------< +[Domain] = 0:1-0:7 + >------< 0| ( text ) [Insertion delimiter] = " " From 976bb42ce0dc901c42b11eff96a15998ec42cbad Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 11:30:27 +0100 Subject: [PATCH 21/38] Use every scope for interiors in typed targets --- .../recorded/modifiers/changeInside.yml | 4 +- .../recorded/selectionTypes/clearCore.yml | 4 +- .../recorded/selectionTypes/clearCore2.yml | 4 +- .../parseTree/python/clearMatching10.yml | 6 +-- .../scopes/c/interior/interior.doWhile.scope | 17 ++---- .../scopes/c/interior/interior.for.scope | 17 ++---- .../scopes/c/interior/interior.function.scope | 17 ++---- .../c/interior/interior.function2.scope | 17 ++---- .../scopes/c/interior/interior.if.scope | 32 +++-------- .../scopes/c/interior/interior.switch.scope | 17 ++---- .../c/interior/interior.switchCase.scope | 41 ++++++-------- .../scopes/c/interior/interior.while.scope | 17 ++---- .../cpp/interior/interior.constructor.scope | 13 +---- .../cpp/interior/interior.foreach.scope | 17 ++---- .../scopes/cpp/interior/interior.lambda.scope | 26 ++------- .../scopes/cpp/interior/interior.method.scope | 13 +---- .../scopes/cpp/interior/interior.try.scope | 13 +---- .../interior/interior.constructor.scope | 13 +---- .../csharp/interior/interior.doWhile.scope | 17 ++---- .../scopes/csharp/interior/interior.for.scope | 17 ++---- .../csharp/interior/interior.foreach.scope | 17 ++---- .../csharp/interior/interior.function.scope | 17 ++---- .../scopes/csharp/interior/interior.if.scope | 32 +++-------- .../csharp/interior/interior.lambda.scope | 17 ++---- .../csharp/interior/interior.method.scope | 13 +---- .../csharp/interior/interior.switch.scope | 17 ++---- .../csharp/interior/interior.switchCase.scope | 41 ++++++-------- .../scopes/csharp/interior/interior.try.scope | 17 ++---- .../csharp/interior/interior.while.scope | 17 ++---- .../scopes/html/interior.element.scope | 26 ++------- .../java/interior/interior.constructor.scope | 13 +---- .../java/interior/interior.doWhile.scope | 17 ++---- .../scopes/java/interior/interior.for.scope | 17 ++---- .../java/interior/interior.foreach.scope | 17 ++---- .../scopes/java/interior/interior.if.scope | 32 +++-------- .../java/interior/interior.lambda.scope | 17 ++---- .../java/interior/interior.method.scope | 13 +---- .../java/interior/interior.resource.scope | 26 ++------- .../java/interior/interior.switch.scope | 17 ++---- .../java/interior/interior.switchCase.scope | 41 ++++++-------- .../java/interior/interior.switchCase2.scope | 41 ++++++-------- .../scopes/java/interior/interior.try.scope | 17 ++---- .../scopes/java/interior/interior.while.scope | 17 ++---- .../interior/interior.constructor.scope | 13 +---- .../interior/interior.doWhile.scope | 17 ++---- .../interior/interior.for.scope | 17 ++---- .../interior/interior.foreach.scope | 17 ++---- .../interior/interior.foreach2.scope | 17 ++---- .../interior/interior.function.scope | 17 ++---- .../interior/interior.if.scope | 32 +++-------- .../interior/interior.lambda.scope | 17 ++---- .../interior/interior.method.scope | 13 +---- .../interior/interior.switch.scope | 17 ++---- .../interior/interior.switchCase.scope | 41 ++++++-------- .../interior/interior.try.scope | 17 ++---- .../interior/interior.while.scope | 17 ++---- .../javascript.jsx/interior.element.scope | 26 ++------- .../scopes/lua/interior.function.scope | 17 ++---- .../scopes/markdown/interior.cell.scope | 15 +++--- .../scopes/markdown/interior.cell2.scope | 1 + .../interior/interior.constructor.scope | 17 ++---- .../python/interior/interior.function.scope | 17 ++---- .../python/interior/interior.function2.scope | 26 --------- .../python/interior/interior.method.scope | 17 ++---- .../scopes/scss/interior.function.scope | 17 ++---- .../scopes/xml/interior.element.scope | 26 ++------- .../PlaintextScopeSupportFacetInfos.ts | 3 +- .../command/PartialTargetDescriptor.types.ts | 6 +-- .../cursorless-engine/src/actions/Rewrap.ts | 2 +- .../ModifierStageFactoryImpl.ts | 6 +-- .../processTargets/modifiers/BoundaryStage.ts | 39 ++++++++++++++ .../processTargets/modifiers/InteriorStage.ts | 54 ++++++++----------- .../InteriorScopeHandler.ts | 45 +++------------- .../spokenForms/defaultSpokenFormMapCore.ts | 1 + queries/c.scm | 9 ++++ queries/csharp.scm | 9 ++++ queries/java.scm | 9 ++++ queries/javascript.core.scm | 9 ++++ queries/markdown.scm | 23 +++++++- queries/scss.scm | 9 ++++ 80 files changed, 449 insertions(+), 1027 deletions(-) delete mode 100644 data/fixtures/scopes/python/interior/interior.function2.scope create mode 100644 packages/cursorless-engine/src/processTargets/modifiers/BoundaryStage.ts diff --git a/data/fixtures/recorded/modifiers/changeInside.yml b/data/fixtures/recorded/modifiers/changeInside.yml index 32454197af..04bce24ce6 100644 --- a/data/fixtures/recorded/modifiers/changeInside.yml +++ b/data/fixtures/recorded/modifiers/changeInside.yml @@ -14,8 +14,8 @@ initialState: def testing(): pass selections: - - anchor: {line: 0, character: 0} - active: {line: 0, character: 0} + - anchor: {line: 1, character: 14} + active: {line: 1, character: 14} marks: {} finalState: documentContents: |- diff --git a/data/fixtures/recorded/selectionTypes/clearCore.yml b/data/fixtures/recorded/selectionTypes/clearCore.yml index 9536406096..8b2d63a3ff 100644 --- a/data/fixtures/recorded/selectionTypes/clearCore.yml +++ b/data/fixtures/recorded/selectionTypes/clearCore.yml @@ -12,8 +12,8 @@ command: initialState: documentContents: ( ) selections: - - anchor: {line: 0, character: 0} - active: {line: 0, character: 0} + - anchor: {line: 0, character: 1} + active: {line: 0, character: 1} marks: {} finalState: documentContents: () diff --git a/data/fixtures/recorded/selectionTypes/clearCore2.yml b/data/fixtures/recorded/selectionTypes/clearCore2.yml index f7f85daf30..d808ff5589 100644 --- a/data/fixtures/recorded/selectionTypes/clearCore2.yml +++ b/data/fixtures/recorded/selectionTypes/clearCore2.yml @@ -12,8 +12,8 @@ command: initialState: documentContents: () selections: - - anchor: {line: 0, character: 0} - active: {line: 0, character: 0} + - anchor: {line: 0, character: 1} + active: {line: 0, character: 1} marks: {} finalState: documentContents: () diff --git a/data/fixtures/recorded/surroundingPair/parseTree/python/clearMatching10.yml b/data/fixtures/recorded/surroundingPair/parseTree/python/clearMatching10.yml index c3605886aa..289deb8c23 100644 --- a/data/fixtures/recorded/surroundingPair/parseTree/python/clearMatching10.yml +++ b/data/fixtures/recorded/surroundingPair/parseTree/python/clearMatching10.yml @@ -20,7 +20,7 @@ initialState: finalState: documentContents: |- - "'' 'fsd'" + "" selections: - - anchor: {line: 1, character: 2} - active: {line: 1, character: 2} + - anchor: {line: 1, character: 1} + active: {line: 1, character: 1} diff --git a/data/fixtures/scopes/c/interior/interior.doWhile.scope b/data/fixtures/scopes/c/interior/interior.doWhile.scope index 691176c939..84fdbc5cc0 100644 --- a/data/fixtures/scopes/c/interior/interior.doWhile.scope +++ b/data/fixtures/scopes/c/interior/interior.doWhile.scope @@ -1,19 +1,10 @@ do { } while (true); --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:4-0:5 +[Content] = +[Removal] = +[Domain] = 0:4-0:5 >-< 0| do { } while (true); -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:18 - >----< -0| do { } while (true); - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.for.scope b/data/fixtures/scopes/c/interior/interior.for.scope index 54b2d5db85..132becea8a 100644 --- a/data/fixtures/scopes/c/interior/interior.for.scope +++ b/data/fixtures/scopes/c/interior/interior.for.scope @@ -1,19 +1,10 @@ for (int i = 0; i < size; ++i) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:5-0:29 - >------------------------< -0| for (int i = 0; i < size; ++i) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:32-0:33 +[Content] = +[Removal] = +[Domain] = 0:32-0:33 >-< 0| for (int i = 0; i < size; ++i) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.function.scope b/data/fixtures/scopes/c/interior/interior.function.scope index c59805dbcc..8a0c0bc456 100644 --- a/data/fixtures/scopes/c/interior/interior.function.scope +++ b/data/fixtures/scopes/c/interior/interior.function.scope @@ -1,19 +1,10 @@ void foo() { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:9-0:9 - >< -0| void foo() { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:12-0:13 +[Content] = +[Removal] = +[Domain] = 0:12-0:13 >-< 0| void foo() { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.function2.scope b/data/fixtures/scopes/c/interior/interior.function2.scope index 6bc11934dc..1c598f582d 100644 --- a/data/fixtures/scopes/c/interior/interior.function2.scope +++ b/data/fixtures/scopes/c/interior/interior.function2.scope @@ -1,19 +1,10 @@ void Foo::bar() { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:14-0:14 - >< -0| void Foo::bar() { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:17-0:18 +[Content] = +[Removal] = +[Domain] = 0:17-0:18 >-< 0| void Foo::bar() { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.if.scope b/data/fixtures/scopes/c/interior/interior.if.scope index 22a989ae6d..407453929f 100644 --- a/data/fixtures/scopes/c/interior/interior.if.scope +++ b/data/fixtures/scopes/c/interior/interior.if.scope @@ -5,8 +5,8 @@ else { } [#1 Content] = [#1 Removal] = -[#1 Domain] = 0:4-0:8 - >----< +[#1 Domain] = 0:11-0:12 + >-< 0| if (true) { } [#1 Insertion delimiter] = " " @@ -14,35 +14,17 @@ else { } [#2 Content] = [#2 Removal] = -[#2 Domain] = 0:11-0:12 - >-< -0| if (true) { } +[#2 Domain] = 1:17-1:18 + >-< +1| else if (false) { } [#2 Insertion delimiter] = " " [#3 Content] = [#3 Removal] = -[#3 Domain] = 1:9-1:14 - >-----< -1| else if (false) { } - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = -[#4 Domain] = 1:17-1:18 - >-< -1| else if (false) { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = -[#5 Domain] = 2:6-2:7 +[#3 Domain] = 2:6-2:7 >-< 2| else { } -[#5 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.switch.scope b/data/fixtures/scopes/c/interior/interior.switch.scope index d47263785a..92f10c6415 100644 --- a/data/fixtures/scopes/c/interior/interior.switch.scope +++ b/data/fixtures/scopes/c/interior/interior.switch.scope @@ -1,19 +1,10 @@ switch (foo) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:8-0:11 - >---< -0| switch (foo) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:15 +[Content] = +[Removal] = +[Domain] = 0:14-0:15 >-< 0| switch (foo) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.switchCase.scope b/data/fixtures/scopes/c/interior/interior.switchCase.scope index 4eb46c2559..1034635c48 100644 --- a/data/fixtures/scopes/c/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/c/interior/interior.switchCase.scope @@ -10,16 +10,7 @@ switch (foo) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:8-0:11 - >---< -0| switch (foo) { - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 1:4-8:14 +[#1 Content] = 1:4-8:14 >------- 1| case 0: 2| bar; @@ -31,7 +22,7 @@ switch (foo) { 8| break; --------------< -[#2 Removal] = 0:14-9:0 +[#1 Removal] = 0:14-9:0 > 0| switch (foo) { 1| case 0: @@ -45,7 +36,7 @@ switch (foo) { 9| } < -[#2 Domain] = 0:14-9:0 +[#1 Domain] = 0:14-9:0 > 0| switch (foo) { 1| case 0: @@ -59,67 +50,67 @@ switch (foo) { 9| } < -[#2 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#3 Content] = 2:8-3:14 +[#2 Content] = 2:8-3:14 >---- 2| bar; 3| break; --------------< -[#3 Removal] = 1:11-3:14 +[#2 Removal] = 1:11-3:14 > 1| case 0: 2| bar; 3| break; --------------< -[#3 Domain] = 1:11-3:14 +[#2 Domain] = 1:11-3:14 > 1| case 0: 2| bar; 3| break; --------------< -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#4 Content] = 5:8-5:14 +[#3 Content] = 5:8-5:14 >------< 5| break; -[#4 Removal] = 4:13-6:4 +[#3 Removal] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#4 Domain] = 4:13-6:4 +[#3 Domain] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#4 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " -[#5 Content] = 8:8-8:14 +[#4 Content] = 8:8-8:14 >------< 8| break; -[#5 Removal] = 7:12-8:14 +[#4 Removal] = 7:12-8:14 > 7| default: 8| break; --------------< -[#5 Domain] = 7:12-8:14 +[#4 Domain] = 7:12-8:14 > 7| default: 8| break; --------------< -[#5 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/c/interior/interior.while.scope b/data/fixtures/scopes/c/interior/interior.while.scope index 31901d1f61..1afbe23128 100644 --- a/data/fixtures/scopes/c/interior/interior.while.scope +++ b/data/fixtures/scopes/c/interior/interior.while.scope @@ -1,19 +1,10 @@ while (true) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:7-0:11 - >----< -0| while (true) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:15 +[Content] = +[Removal] = +[Domain] = 0:14-0:15 >-< 0| while (true) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.constructor.scope b/data/fixtures/scopes/cpp/interior/interior.constructor.scope index 5cf914bff8..d64baa9016 100644 --- a/data/fixtures/scopes/cpp/interior/interior.constructor.scope +++ b/data/fixtures/scopes/cpp/interior/interior.constructor.scope @@ -26,17 +26,8 @@ class Foo { [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:8-1:8 - >< -1| Foo() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 1:11-1:12 +[#2 Domain] = 1:11-1:12 >-< 1| Foo() { } -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.foreach.scope b/data/fixtures/scopes/cpp/interior/interior.foreach.scope index b375427667..be709fe126 100644 --- a/data/fixtures/scopes/cpp/interior/interior.foreach.scope +++ b/data/fixtures/scopes/cpp/interior/interior.foreach.scope @@ -1,19 +1,10 @@ for (int v : values) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:5-0:19 - >--------------< -0| for (int v : values) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:22-0:23 +[Content] = +[Removal] = +[Domain] = 0:22-0:23 >-< 0| for (int v : values) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.lambda.scope b/data/fixtures/scopes/cpp/interior/interior.lambda.scope index 1740259f51..9de845ff6b 100644 --- a/data/fixtures/scopes/cpp/interior/interior.lambda.scope +++ b/data/fixtures/scopes/cpp/interior/interior.lambda.scope @@ -1,28 +1,10 @@ []() { }; --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:1-0:1 - >< -0| []() { }; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:3-0:3 - >< -0| []() { }; - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 0:6-0:7 +[Content] = +[Removal] = +[Domain] = 0:6-0:7 >-< 0| []() { }; -[#3 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.method.scope b/data/fixtures/scopes/cpp/interior/interior.method.scope index cefc9bf4b4..bd398f6473 100644 --- a/data/fixtures/scopes/cpp/interior/interior.method.scope +++ b/data/fixtures/scopes/cpp/interior/interior.method.scope @@ -26,17 +26,8 @@ class Foo { [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:13-1:13 - >< -1| void bar() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 1:16-1:17 +[#2 Domain] = 1:16-1:17 >-< 1| void bar() { } -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/cpp/interior/interior.try.scope b/data/fixtures/scopes/cpp/interior/interior.try.scope index abe51d04b8..179938a3ec 100644 --- a/data/fixtures/scopes/cpp/interior/interior.try.scope +++ b/data/fixtures/scopes/cpp/interior/interior.try.scope @@ -13,17 +13,8 @@ catch (const std::exception& e) { } [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:7-1:30 - >-----------------------< -1| catch (const std::exception& e) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 1:33-1:34 +[#2 Domain] = 1:33-1:34 >-< 1| catch (const std::exception& e) { } -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.constructor.scope b/data/fixtures/scopes/csharp/interior/interior.constructor.scope index 9bdeac4c20..babc97caa5 100644 --- a/data/fixtures/scopes/csharp/interior/interior.constructor.scope +++ b/data/fixtures/scopes/csharp/interior/interior.constructor.scope @@ -26,17 +26,8 @@ class Foo { [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:15-1:15 - >< -1| public Foo() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 1:18-1:19 +[#2 Domain] = 1:18-1:19 >-< 1| public Foo() { } -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.doWhile.scope b/data/fixtures/scopes/csharp/interior/interior.doWhile.scope index 691176c939..84fdbc5cc0 100644 --- a/data/fixtures/scopes/csharp/interior/interior.doWhile.scope +++ b/data/fixtures/scopes/csharp/interior/interior.doWhile.scope @@ -1,19 +1,10 @@ do { } while (true); --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:4-0:5 +[Content] = +[Removal] = +[Domain] = 0:4-0:5 >-< 0| do { } while (true); -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:18 - >----< -0| do { } while (true); - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.for.scope b/data/fixtures/scopes/csharp/interior/interior.for.scope index 54b2d5db85..132becea8a 100644 --- a/data/fixtures/scopes/csharp/interior/interior.for.scope +++ b/data/fixtures/scopes/csharp/interior/interior.for.scope @@ -1,19 +1,10 @@ for (int i = 0; i < size; ++i) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:5-0:29 - >------------------------< -0| for (int i = 0; i < size; ++i) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:32-0:33 +[Content] = +[Removal] = +[Domain] = 0:32-0:33 >-< 0| for (int i = 0; i < size; ++i) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.foreach.scope b/data/fixtures/scopes/csharp/interior/interior.foreach.scope index 7ab252c2e9..529461c23f 100644 --- a/data/fixtures/scopes/csharp/interior/interior.foreach.scope +++ b/data/fixtures/scopes/csharp/interior/interior.foreach.scope @@ -1,19 +1,10 @@ foreach (int v in values) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:9-0:24 - >---------------< -0| foreach (int v in values) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:27-0:28 +[Content] = +[Removal] = +[Domain] = 0:27-0:28 >-< 0| foreach (int v in values) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.function.scope b/data/fixtures/scopes/csharp/interior/interior.function.scope index 78db1a1c1f..383258e2c1 100644 --- a/data/fixtures/scopes/csharp/interior/interior.function.scope +++ b/data/fixtures/scopes/csharp/interior/interior.function.scope @@ -1,19 +1,10 @@ void Foo() { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:9-0:9 - >< -0| void Foo() { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:12-0:13 +[Content] = +[Removal] = +[Domain] = 0:12-0:13 >-< 0| void Foo() { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.if.scope b/data/fixtures/scopes/csharp/interior/interior.if.scope index 22a989ae6d..407453929f 100644 --- a/data/fixtures/scopes/csharp/interior/interior.if.scope +++ b/data/fixtures/scopes/csharp/interior/interior.if.scope @@ -5,8 +5,8 @@ else { } [#1 Content] = [#1 Removal] = -[#1 Domain] = 0:4-0:8 - >----< +[#1 Domain] = 0:11-0:12 + >-< 0| if (true) { } [#1 Insertion delimiter] = " " @@ -14,35 +14,17 @@ else { } [#2 Content] = [#2 Removal] = -[#2 Domain] = 0:11-0:12 - >-< -0| if (true) { } +[#2 Domain] = 1:17-1:18 + >-< +1| else if (false) { } [#2 Insertion delimiter] = " " [#3 Content] = [#3 Removal] = -[#3 Domain] = 1:9-1:14 - >-----< -1| else if (false) { } - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = -[#4 Domain] = 1:17-1:18 - >-< -1| else if (false) { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = -[#5 Domain] = 2:6-2:7 +[#3 Domain] = 2:6-2:7 >-< 2| else { } -[#5 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.lambda.scope b/data/fixtures/scopes/csharp/interior/interior.lambda.scope index bd3f10ac7d..355508bec5 100644 --- a/data/fixtures/scopes/csharp/interior/interior.lambda.scope +++ b/data/fixtures/scopes/csharp/interior/interior.lambda.scope @@ -1,25 +1,16 @@ () => { foo; }; --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:1-0:1 - >< -0| () => { foo; }; - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 0:8-0:12 +[Content] = 0:8-0:12 >----< 0| () => { foo; }; -[#2 Removal] = 0:7-0:13 +[Removal] = 0:7-0:13 >------< 0| () => { foo; }; -[#2 Domain] = 0:7-0:13 +[Domain] = 0:7-0:13 >------< 0| () => { foo; }; -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.method.scope b/data/fixtures/scopes/csharp/interior/interior.method.scope index 32381e662d..dae6bb4ef6 100644 --- a/data/fixtures/scopes/csharp/interior/interior.method.scope +++ b/data/fixtures/scopes/csharp/interior/interior.method.scope @@ -26,17 +26,8 @@ class Foo { [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:20-1:20 - >< -1| public void Bar() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 1:23-1:24 +[#2 Domain] = 1:23-1:24 >-< 1| public void Bar() { } -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.switch.scope b/data/fixtures/scopes/csharp/interior/interior.switch.scope index d47263785a..92f10c6415 100644 --- a/data/fixtures/scopes/csharp/interior/interior.switch.scope +++ b/data/fixtures/scopes/csharp/interior/interior.switch.scope @@ -1,19 +1,10 @@ switch (foo) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:8-0:11 - >---< -0| switch (foo) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:15 +[Content] = +[Removal] = +[Domain] = 0:14-0:15 >-< 0| switch (foo) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.switchCase.scope b/data/fixtures/scopes/csharp/interior/interior.switchCase.scope index 4eb46c2559..1034635c48 100644 --- a/data/fixtures/scopes/csharp/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/csharp/interior/interior.switchCase.scope @@ -10,16 +10,7 @@ switch (foo) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:8-0:11 - >---< -0| switch (foo) { - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 1:4-8:14 +[#1 Content] = 1:4-8:14 >------- 1| case 0: 2| bar; @@ -31,7 +22,7 @@ switch (foo) { 8| break; --------------< -[#2 Removal] = 0:14-9:0 +[#1 Removal] = 0:14-9:0 > 0| switch (foo) { 1| case 0: @@ -45,7 +36,7 @@ switch (foo) { 9| } < -[#2 Domain] = 0:14-9:0 +[#1 Domain] = 0:14-9:0 > 0| switch (foo) { 1| case 0: @@ -59,67 +50,67 @@ switch (foo) { 9| } < -[#2 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#3 Content] = 2:8-3:14 +[#2 Content] = 2:8-3:14 >---- 2| bar; 3| break; --------------< -[#3 Removal] = 1:11-3:14 +[#2 Removal] = 1:11-3:14 > 1| case 0: 2| bar; 3| break; --------------< -[#3 Domain] = 1:11-3:14 +[#2 Domain] = 1:11-3:14 > 1| case 0: 2| bar; 3| break; --------------< -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#4 Content] = 5:8-5:14 +[#3 Content] = 5:8-5:14 >------< 5| break; -[#4 Removal] = 4:13-6:4 +[#3 Removal] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#4 Domain] = 4:13-6:4 +[#3 Domain] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#4 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " -[#5 Content] = 8:8-8:14 +[#4 Content] = 8:8-8:14 >------< 8| break; -[#5 Removal] = 7:12-8:14 +[#4 Removal] = 7:12-8:14 > 7| default: 8| break; --------------< -[#5 Domain] = 7:12-8:14 +[#4 Domain] = 7:12-8:14 > 7| default: 8| break; --------------< -[#5 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.try.scope b/data/fixtures/scopes/csharp/interior/interior.try.scope index 0d567bef32..90d785795c 100644 --- a/data/fixtures/scopes/csharp/interior/interior.try.scope +++ b/data/fixtures/scopes/csharp/interior/interior.try.scope @@ -14,8 +14,8 @@ finally { } [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:6-1:17 - >-----------< +[#2 Domain] = 1:20-1:21 + >-< 1| catch(Exception e) { } [#2 Insertion delimiter] = " " @@ -23,17 +23,8 @@ finally { } [#3 Content] = [#3 Removal] = -[#3 Domain] = 1:20-1:21 - >-< -1| catch(Exception e) { } - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = -[#4 Domain] = 2:9-2:10 +[#3 Domain] = 2:9-2:10 >-< 2| finally { } -[#4 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/csharp/interior/interior.while.scope b/data/fixtures/scopes/csharp/interior/interior.while.scope index 31901d1f61..1afbe23128 100644 --- a/data/fixtures/scopes/csharp/interior/interior.while.scope +++ b/data/fixtures/scopes/csharp/interior/interior.while.scope @@ -1,19 +1,10 @@ while (true) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:7-0:11 - >----< -0| while (true) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:15 +[Content] = +[Removal] = +[Domain] = 0:14-0:15 >-< 0| while (true) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/html/interior.element.scope b/data/fixtures/scopes/html/interior.element.scope index c97011b8c8..9f9283d847 100644 --- a/data/fixtures/scopes/html/interior.element.scope +++ b/data/fixtures/scopes/html/interior.element.scope @@ -1,28 +1,10 @@
--- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:1-0:4 - >---< -0|
- -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:5-0:6 +[Content] = +[Removal] = +[Domain] = 0:5-0:6 >-< 0|
-[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 0:8-0:11 - >---< -0|
- -[#3 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.constructor.scope b/data/fixtures/scopes/java/interior/interior.constructor.scope index 58653a0c37..bcbf1899fe 100644 --- a/data/fixtures/scopes/java/interior/interior.constructor.scope +++ b/data/fixtures/scopes/java/interior/interior.constructor.scope @@ -26,17 +26,8 @@ public class Foo { [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:15-1:15 - >< -1| public Foo() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 1:18-1:19 +[#2 Domain] = 1:18-1:19 >-< 1| public Foo() { } -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.doWhile.scope b/data/fixtures/scopes/java/interior/interior.doWhile.scope index 691176c939..84fdbc5cc0 100644 --- a/data/fixtures/scopes/java/interior/interior.doWhile.scope +++ b/data/fixtures/scopes/java/interior/interior.doWhile.scope @@ -1,19 +1,10 @@ do { } while (true); --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:4-0:5 +[Content] = +[Removal] = +[Domain] = 0:4-0:5 >-< 0| do { } while (true); -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:18 - >----< -0| do { } while (true); - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.for.scope b/data/fixtures/scopes/java/interior/interior.for.scope index 54b2d5db85..132becea8a 100644 --- a/data/fixtures/scopes/java/interior/interior.for.scope +++ b/data/fixtures/scopes/java/interior/interior.for.scope @@ -1,19 +1,10 @@ for (int i = 0; i < size; ++i) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:5-0:29 - >------------------------< -0| for (int i = 0; i < size; ++i) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:32-0:33 +[Content] = +[Removal] = +[Domain] = 0:32-0:33 >-< 0| for (int i = 0; i < size; ++i) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.foreach.scope b/data/fixtures/scopes/java/interior/interior.foreach.scope index b375427667..be709fe126 100644 --- a/data/fixtures/scopes/java/interior/interior.foreach.scope +++ b/data/fixtures/scopes/java/interior/interior.foreach.scope @@ -1,19 +1,10 @@ for (int v : values) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:5-0:19 - >--------------< -0| for (int v : values) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:22-0:23 +[Content] = +[Removal] = +[Domain] = 0:22-0:23 >-< 0| for (int v : values) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.if.scope b/data/fixtures/scopes/java/interior/interior.if.scope index 22a989ae6d..407453929f 100644 --- a/data/fixtures/scopes/java/interior/interior.if.scope +++ b/data/fixtures/scopes/java/interior/interior.if.scope @@ -5,8 +5,8 @@ else { } [#1 Content] = [#1 Removal] = -[#1 Domain] = 0:4-0:8 - >----< +[#1 Domain] = 0:11-0:12 + >-< 0| if (true) { } [#1 Insertion delimiter] = " " @@ -14,35 +14,17 @@ else { } [#2 Content] = [#2 Removal] = -[#2 Domain] = 0:11-0:12 - >-< -0| if (true) { } +[#2 Domain] = 1:17-1:18 + >-< +1| else if (false) { } [#2 Insertion delimiter] = " " [#3 Content] = [#3 Removal] = -[#3 Domain] = 1:9-1:14 - >-----< -1| else if (false) { } - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = -[#4 Domain] = 1:17-1:18 - >-< -1| else if (false) { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = -[#5 Domain] = 2:6-2:7 +[#3 Domain] = 2:6-2:7 >-< 2| else { } -[#5 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.lambda.scope b/data/fixtures/scopes/java/interior/interior.lambda.scope index fdbbffb81e..e3d16ca4a1 100644 --- a/data/fixtures/scopes/java/interior/interior.lambda.scope +++ b/data/fixtures/scopes/java/interior/interior.lambda.scope @@ -1,19 +1,10 @@ () -> { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:1-0:1 - >< -0| () -> { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:7-0:8 +[Content] = +[Removal] = +[Domain] = 0:7-0:8 >-< 0| () -> { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.method.scope b/data/fixtures/scopes/java/interior/interior.method.scope index 4e6ed3779b..bc30c69903 100644 --- a/data/fixtures/scopes/java/interior/interior.method.scope +++ b/data/fixtures/scopes/java/interior/interior.method.scope @@ -26,17 +26,8 @@ public class Foo { [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:20-1:20 - >< -1| public void bar() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 1:23-1:24 +[#2 Domain] = 1:23-1:24 >-< 1| public void bar() { } -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.resource.scope b/data/fixtures/scopes/java/interior/interior.resource.scope index eedde64e4b..cb4cf86b96 100644 --- a/data/fixtures/scopes/java/interior/interior.resource.scope +++ b/data/fixtures/scopes/java/interior/interior.resource.scope @@ -1,28 +1,10 @@ try (Foo bar = create()) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:5-0:23 - >------------------< -0| try (Foo bar = create()) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:22-0:22 - >< -0| try (Foo bar = create()) { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 0:26-0:27 +[Content] = +[Removal] = +[Domain] = 0:26-0:27 >-< 0| try (Foo bar = create()) { } -[#3 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.switch.scope b/data/fixtures/scopes/java/interior/interior.switch.scope index 35e3f6a261..516c60576b 100644 --- a/data/fixtures/scopes/java/interior/interior.switch.scope +++ b/data/fixtures/scopes/java/interior/interior.switch.scope @@ -1,19 +1,10 @@ switch (value) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:8-0:13 - >-----< -0| switch (value) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:16-0:17 +[Content] = +[Removal] = +[Domain] = 0:16-0:17 >-< 0| switch (value) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.switchCase.scope b/data/fixtures/scopes/java/interior/interior.switchCase.scope index cdc927cbce..7e04299152 100644 --- a/data/fixtures/scopes/java/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/java/interior/interior.switchCase.scope @@ -10,16 +10,7 @@ switch (value) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:8-0:13 - >-----< -0| switch (value) { - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 1:4-8:14 +[#1 Content] = 1:4-8:14 >------- 1| case 0: 2| foo; @@ -31,7 +22,7 @@ switch (value) { 8| break; --------------< -[#2 Removal] = 0:16-9:0 +[#1 Removal] = 0:16-9:0 > 0| switch (value) { 1| case 0: @@ -45,7 +36,7 @@ switch (value) { 9| } < -[#2 Domain] = 0:16-9:0 +[#1 Domain] = 0:16-9:0 > 0| switch (value) { 1| case 0: @@ -59,67 +50,67 @@ switch (value) { 9| } < -[#2 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#3 Content] = 2:8-3:14 +[#2 Content] = 2:8-3:14 >---- 2| foo; 3| break; --------------< -[#3 Removal] = 1:11-3:14 +[#2 Removal] = 1:11-3:14 > 1| case 0: 2| foo; 3| break; --------------< -[#3 Domain] = 1:11-3:14 +[#2 Domain] = 1:11-3:14 > 1| case 0: 2| foo; 3| break; --------------< -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#4 Content] = 5:8-5:14 +[#3 Content] = 5:8-5:14 >------< 5| break; -[#4 Removal] = 4:13-6:4 +[#3 Removal] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#4 Domain] = 4:13-6:4 +[#3 Domain] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#4 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " -[#5 Content] = 8:8-8:14 +[#4 Content] = 8:8-8:14 >------< 8| break; -[#5 Removal] = 7:12-8:14 +[#4 Removal] = 7:12-8:14 > 7| default: 8| break; --------------< -[#5 Domain] = 7:12-8:14 +[#4 Domain] = 7:12-8:14 > 7| default: 8| break; --------------< -[#5 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.switchCase2.scope b/data/fixtures/scopes/java/interior/interior.switchCase2.scope index e78b6ed9d9..14e1e2fc6d 100644 --- a/data/fixtures/scopes/java/interior/interior.switchCase2.scope +++ b/data/fixtures/scopes/java/interior/interior.switchCase2.scope @@ -7,16 +7,7 @@ switch (foo) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:8-0:11 - >---< -0| switch (foo) { - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 1:4-5:17 +[#1 Content] = 1:4-5:17 >------------ 1| case 0 -> 1; 2| case 1 -> { @@ -25,7 +16,7 @@ switch (foo) { 5| default -> 3; -----------------< -[#2 Removal] = 0:14-6:0 +[#1 Removal] = 0:14-6:0 > 0| switch (foo) { 1| case 0 -> 1; @@ -36,7 +27,7 @@ switch (foo) { 6| } < -[#2 Domain] = 0:14-6:0 +[#1 Domain] = 0:14-6:0 > 0| switch (foo) { 1| case 0 -> 1; @@ -47,55 +38,55 @@ switch (foo) { 6| } < -[#2 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#3 Content] = 1:14-1:16 +[#2 Content] = 1:14-1:16 >--< 1| case 0 -> 1; -[#3 Removal] = 1:13-1:16 +[#2 Removal] = 1:13-1:16 >---< 1| case 0 -> 1; -[#3 Domain] = 1:13-1:16 +[#2 Domain] = 1:13-1:16 >---< 1| case 0 -> 1; -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#4 Content] = 3:8-3:16 +[#3 Content] = 3:8-3:16 >--------< 3| yield 2; -[#4 Removal] = 2:15-4:4 +[#3 Removal] = 2:15-4:4 > 2| case 1 -> { 3| yield 2; 4| }; ----< -[#4 Domain] = 2:15-4:4 +[#3 Domain] = 2:15-4:4 > 2| case 1 -> { 3| yield 2; 4| }; ----< -[#4 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " -[#5 Content] = 5:15-5:17 +[#4 Content] = 5:15-5:17 >--< 5| default -> 3; -[#5 Removal] = 5:14-5:17 +[#4 Removal] = 5:14-5:17 >---< 5| default -> 3; -[#5 Domain] = 5:14-5:17 +[#4 Domain] = 5:14-5:17 >---< 5| default -> 3; -[#5 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.try.scope b/data/fixtures/scopes/java/interior/interior.try.scope index d1ac2a76cc..d8b8697ede 100644 --- a/data/fixtures/scopes/java/interior/interior.try.scope +++ b/data/fixtures/scopes/java/interior/interior.try.scope @@ -14,8 +14,8 @@ finally { } [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:6-1:18 - >------------< +[#2 Domain] = 1:21-1:22 + >-< 1| catch(Exception ex) { } [#2 Insertion delimiter] = " " @@ -23,17 +23,8 @@ finally { } [#3 Content] = [#3 Removal] = -[#3 Domain] = 1:21-1:22 - >-< -1| catch(Exception ex) { } - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = -[#4 Domain] = 2:9-2:10 +[#3 Domain] = 2:9-2:10 >-< 2| finally { } -[#4 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/java/interior/interior.while.scope b/data/fixtures/scopes/java/interior/interior.while.scope index 31901d1f61..1afbe23128 100644 --- a/data/fixtures/scopes/java/interior/interior.while.scope +++ b/data/fixtures/scopes/java/interior/interior.while.scope @@ -1,19 +1,10 @@ while (true) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:7-0:11 - >----< -0| while (true) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:15 +[Content] = +[Removal] = +[Domain] = 0:14-0:15 >-< 0| while (true) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope b/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope index 8cc737ead9..31fb4f8777 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.constructor.scope @@ -26,17 +26,8 @@ class Foo { [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:16-1:16 - >< -1| constructor() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 1:19-1:20 +[#2 Domain] = 1:19-1:20 >-< 1| constructor() { } -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.doWhile.scope b/data/fixtures/scopes/javascript.core/interior/interior.doWhile.scope index 691176c939..84fdbc5cc0 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.doWhile.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.doWhile.scope @@ -1,19 +1,10 @@ do { } while (true); --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:4-0:5 +[Content] = +[Removal] = +[Domain] = 0:4-0:5 >-< 0| do { } while (true); -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:18 - >----< -0| do { } while (true); - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.for.scope b/data/fixtures/scopes/javascript.core/interior/interior.for.scope index 2b66831b1b..cdeeaeedef 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.for.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.for.scope @@ -1,19 +1,10 @@ for (let i = 0; i < size; ++i) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:5-0:29 - >------------------------< -0| for (let i = 0; i < size; ++i) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:32-0:33 +[Content] = +[Removal] = +[Domain] = 0:32-0:33 >-< 0| for (let i = 0; i < size; ++i) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.foreach.scope b/data/fixtures/scopes/javascript.core/interior/interior.foreach.scope index 8b55996766..a734e56176 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.foreach.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.foreach.scope @@ -1,19 +1,10 @@ for (const v of values) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:5-0:22 - >-----------------< -0| for (const v of values) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:25-0:26 +[Content] = +[Removal] = +[Domain] = 0:25-0:26 >-< 0| for (const v of values) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.foreach2.scope b/data/fixtures/scopes/javascript.core/interior/interior.foreach2.scope index ea7388d4b9..314ceaed82 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.foreach2.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.foreach2.scope @@ -1,19 +1,10 @@ for (const k in values) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:5-0:22 - >-----------------< -0| for (const k in values) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:25-0:26 +[Content] = +[Removal] = +[Domain] = 0:25-0:26 >-< 0| for (const k in values) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.function.scope b/data/fixtures/scopes/javascript.core/interior/interior.function.scope index bfef7835f3..52fbd14290 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.function.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.function.scope @@ -1,19 +1,10 @@ function foo() { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:13-0:13 - >< -0| function foo() { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:16-0:17 +[Content] = +[Removal] = +[Domain] = 0:16-0:17 >-< 0| function foo() { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.if.scope b/data/fixtures/scopes/javascript.core/interior/interior.if.scope index 22a989ae6d..407453929f 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.if.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.if.scope @@ -5,8 +5,8 @@ else { } [#1 Content] = [#1 Removal] = -[#1 Domain] = 0:4-0:8 - >----< +[#1 Domain] = 0:11-0:12 + >-< 0| if (true) { } [#1 Insertion delimiter] = " " @@ -14,35 +14,17 @@ else { } [#2 Content] = [#2 Removal] = -[#2 Domain] = 0:11-0:12 - >-< -0| if (true) { } +[#2 Domain] = 1:17-1:18 + >-< +1| else if (false) { } [#2 Insertion delimiter] = " " [#3 Content] = [#3 Removal] = -[#3 Domain] = 1:9-1:14 - >-----< -1| else if (false) { } - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = -[#4 Domain] = 1:17-1:18 - >-< -1| else if (false) { } - -[#4 Insertion delimiter] = " " - - -[#5 Content] = -[#5 Removal] = -[#5 Domain] = 2:6-2:7 +[#3 Domain] = 2:6-2:7 >-< 2| else { } -[#5 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.lambda.scope b/data/fixtures/scopes/javascript.core/interior/interior.lambda.scope index e4ec0acbe9..4503fae070 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.lambda.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.lambda.scope @@ -1,19 +1,10 @@ () => { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:1-0:1 - >< -0| () => { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:7-0:8 +[Content] = +[Removal] = +[Domain] = 0:7-0:8 >-< 0| () => { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.method.scope b/data/fixtures/scopes/javascript.core/interior/interior.method.scope index 635e566048..e953514d23 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.method.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.method.scope @@ -26,17 +26,8 @@ class Foo { [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:8-1:8 - >< -1| bar() { } - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 1:11-1:12 +[#2 Domain] = 1:11-1:12 >-< 1| bar() { } -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.switch.scope b/data/fixtures/scopes/javascript.core/interior/interior.switch.scope index 35e3f6a261..516c60576b 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.switch.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.switch.scope @@ -1,19 +1,10 @@ switch (value) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:8-0:13 - >-----< -0| switch (value) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:16-0:17 +[Content] = +[Removal] = +[Domain] = 0:16-0:17 >-< 0| switch (value) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope b/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope index 4eb46c2559..1034635c48 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.switchCase.scope @@ -10,16 +10,7 @@ switch (foo) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:8-0:11 - >---< -0| switch (foo) { - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 1:4-8:14 +[#1 Content] = 1:4-8:14 >------- 1| case 0: 2| bar; @@ -31,7 +22,7 @@ switch (foo) { 8| break; --------------< -[#2 Removal] = 0:14-9:0 +[#1 Removal] = 0:14-9:0 > 0| switch (foo) { 1| case 0: @@ -45,7 +36,7 @@ switch (foo) { 9| } < -[#2 Domain] = 0:14-9:0 +[#1 Domain] = 0:14-9:0 > 0| switch (foo) { 1| case 0: @@ -59,67 +50,67 @@ switch (foo) { 9| } < -[#2 Insertion delimiter] = " " +[#1 Insertion delimiter] = " " -[#3 Content] = 2:8-3:14 +[#2 Content] = 2:8-3:14 >---- 2| bar; 3| break; --------------< -[#3 Removal] = 1:11-3:14 +[#2 Removal] = 1:11-3:14 > 1| case 0: 2| bar; 3| break; --------------< -[#3 Domain] = 1:11-3:14 +[#2 Domain] = 1:11-3:14 > 1| case 0: 2| bar; 3| break; --------------< -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#4 Content] = 5:8-5:14 +[#3 Content] = 5:8-5:14 >------< 5| break; -[#4 Removal] = 4:13-6:4 +[#3 Removal] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#4 Domain] = 4:13-6:4 +[#3 Domain] = 4:13-6:4 > 4| case 1: { 5| break; 6| } ----< -[#4 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " -[#5 Content] = 8:8-8:14 +[#4 Content] = 8:8-8:14 >------< 8| break; -[#5 Removal] = 7:12-8:14 +[#4 Removal] = 7:12-8:14 > 7| default: 8| break; --------------< -[#5 Domain] = 7:12-8:14 +[#4 Domain] = 7:12-8:14 > 7| default: 8| break; --------------< -[#5 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.try.scope b/data/fixtures/scopes/javascript.core/interior/interior.try.scope index d420b4f8e3..343d029799 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.try.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.try.scope @@ -14,8 +14,8 @@ finally { } [#2 Content] = [#2 Removal] = -[#2 Domain] = 1:6-1:7 - >-< +[#2 Domain] = 1:10-1:11 + >-< 1| catch(e) { } [#2 Insertion delimiter] = " " @@ -23,17 +23,8 @@ finally { } [#3 Content] = [#3 Removal] = -[#3 Domain] = 1:10-1:11 - >-< -1| catch(e) { } - -[#3 Insertion delimiter] = " " - - -[#4 Content] = -[#4 Removal] = -[#4 Domain] = 2:9-2:10 +[#3 Domain] = 2:9-2:10 >-< 2| finally { } -[#4 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/interior/interior.while.scope b/data/fixtures/scopes/javascript.core/interior/interior.while.scope index 31901d1f61..1afbe23128 100644 --- a/data/fixtures/scopes/javascript.core/interior/interior.while.scope +++ b/data/fixtures/scopes/javascript.core/interior/interior.while.scope @@ -1,19 +1,10 @@ while (true) { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:7-0:11 - >----< -0| while (true) { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:15 +[Content] = +[Removal] = +[Domain] = 0:14-0:15 >-< 0| while (true) { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.jsx/interior.element.scope b/data/fixtures/scopes/javascript.jsx/interior.element.scope index c97011b8c8..9f9283d847 100644 --- a/data/fixtures/scopes/javascript.jsx/interior.element.scope +++ b/data/fixtures/scopes/javascript.jsx/interior.element.scope @@ -1,28 +1,10 @@
--- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:1-0:4 - >---< -0|
- -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:5-0:6 +[Content] = +[Removal] = +[Domain] = 0:5-0:6 >-< 0|
-[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 0:8-0:11 - >---< -0|
- -[#3 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/lua/interior.function.scope b/data/fixtures/scopes/lua/interior.function.scope index 9cf3b65eac..1b252dfed5 100644 --- a/data/fixtures/scopes/lua/interior.function.scope +++ b/data/fixtures/scopes/lua/interior.function.scope @@ -1,19 +1,10 @@ function foo() end --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:13-0:13 - >< -0| function foo() end - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:14-0:15 +[Content] = +[Removal] = +[Domain] = 0:14-0:15 >-< 0| function foo() end -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/markdown/interior.cell.scope b/data/fixtures/scopes/markdown/interior.cell.scope index 58439cebbe..f8f2670a14 100644 --- a/data/fixtures/scopes/markdown/interior.cell.scope +++ b/data/fixtures/scopes/markdown/interior.cell.scope @@ -1,23 +1,22 @@ ```ts let foo; ``` + --- -[Content] = 0:3-1:8 - >-- -0| ```ts +[Content] = 1:0-1:8 + >--------< 1| let foo; - --------< -[Removal] = 0:3-2:0 - >-- +[Removal] = 0:5-2:0 + > 0| ```ts 1| let foo; 2| ``` < -[Domain] = 0:3-2:0 - >-- +[Domain] = 0:5-2:0 + > 0| ```ts 1| let foo; 2| ``` diff --git a/data/fixtures/scopes/markdown/interior.cell2.scope b/data/fixtures/scopes/markdown/interior.cell2.scope index d10d5932d9..3538f475d2 100644 --- a/data/fixtures/scopes/markdown/interior.cell2.scope +++ b/data/fixtures/scopes/markdown/interior.cell2.scope @@ -1,6 +1,7 @@ ``` Hello world ``` + --- [Content] = 1:0-1:11 diff --git a/data/fixtures/scopes/python/interior/interior.constructor.scope b/data/fixtures/scopes/python/interior/interior.constructor.scope index eca66a6df9..49188f85fe 100644 --- a/data/fixtures/scopes/python/interior/interior.constructor.scope +++ b/data/fixtures/scopes/python/interior/interior.constructor.scope @@ -21,25 +21,16 @@ class Foo: [#1 Insertion delimiter] = " " -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 1:17-1:21 - >----< -1| def __init__(self): pass - -[#2 Insertion delimiter] = " " - - -[#3 Content] = 1:24-1:28 +[#2 Content] = 1:24-1:28 >----< 1| def __init__(self): pass -[#3 Removal] = 1:23-1:28 +[#2 Removal] = 1:23-1:28 >-----< 1| def __init__(self): pass -[#3 Domain] = 1:23-1:28 +[#2 Domain] = 1:23-1:28 >-----< 1| def __init__(self): pass -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.function.scope b/data/fixtures/scopes/python/interior/interior.function.scope index 3161e0aeed..441e198d50 100644 --- a/data/fixtures/scopes/python/interior/interior.function.scope +++ b/data/fixtures/scopes/python/interior/interior.function.scope @@ -1,25 +1,16 @@ def foo(): pass --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:8-0:8 - >< -0| def foo(): pass - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 0:11-0:15 +[Content] = 0:11-0:15 >----< 0| def foo(): pass -[#2 Removal] = 0:10-0:15 +[Removal] = 0:10-0:15 >-----< 0| def foo(): pass -[#2 Domain] = 0:10-0:15 +[Domain] = 0:10-0:15 >-----< 0| def foo(): pass -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.function2.scope b/data/fixtures/scopes/python/interior/interior.function2.scope deleted file mode 100644 index 0638035ff9..0000000000 --- a/data/fixtures/scopes/python/interior/interior.function2.scope +++ /dev/null @@ -1,26 +0,0 @@ -@bar -def foo(): pass ---- - -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 1:8-1:8 - >< -1| def foo(): pass - -[#1 Insertion delimiter] = " " - - -[#2 Content] = 1:11-1:15 - >----< -1| def foo(): pass - -[#2 Removal] = 1:10-1:15 - >-----< -1| def foo(): pass - -[#2 Domain] = 1:10-1:15 - >-----< -1| def foo(): pass - -[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/python/interior/interior.method.scope b/data/fixtures/scopes/python/interior/interior.method.scope index 1e1f094560..80757cc915 100644 --- a/data/fixtures/scopes/python/interior/interior.method.scope +++ b/data/fixtures/scopes/python/interior/interior.method.scope @@ -21,25 +21,16 @@ class Foo: [#1 Insertion delimiter] = " " -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 1:12-1:12 - >< -1| def bar(): pass - -[#2 Insertion delimiter] = " " - - -[#3 Content] = 1:15-1:19 +[#2 Content] = 1:15-1:19 >----< 1| def bar(): pass -[#3 Removal] = 1:14-1:19 +[#2 Removal] = 1:14-1:19 >-----< 1| def bar(): pass -[#3 Domain] = 1:14-1:19 +[#2 Domain] = 1:14-1:19 >-----< 1| def bar(): pass -[#3 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/scss/interior.function.scope b/data/fixtures/scopes/scss/interior.function.scope index aceac05963..4f01b19c75 100644 --- a/data/fixtures/scopes/scss/interior.function.scope +++ b/data/fixtures/scopes/scss/interior.function.scope @@ -1,19 +1,10 @@ @function foo() { } --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:14-0:14 - >< -0| @function foo() { } - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:17-0:18 +[Content] = +[Removal] = +[Domain] = 0:17-0:18 >-< 0| @function foo() { } -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/xml/interior.element.scope b/data/fixtures/scopes/xml/interior.element.scope index 08285c96f1..418caa62d7 100644 --- a/data/fixtures/scopes/xml/interior.element.scope +++ b/data/fixtures/scopes/xml/interior.element.scope @@ -1,28 +1,10 @@ --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:1-0:5 - >----< -0| - -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:6-0:7 +[Content] = +[Removal] = +[Domain] = 0:6-0:7 >-< 0| -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = -[#3 Domain] = 0:9-0:13 - >----< -0| - -[#3 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/PlaintextScopeSupportFacetInfos.ts b/packages/common/src/scopeSupportFacets/PlaintextScopeSupportFacetInfos.ts index 03d410fff9..e67bc32670 100644 --- a/packages/common/src/scopeSupportFacets/PlaintextScopeSupportFacetInfos.ts +++ b/packages/common/src/scopeSupportFacets/PlaintextScopeSupportFacetInfos.ts @@ -92,7 +92,8 @@ export const plaintextScopeSupportFacetInfos: Record< "interior.surroundingPair": { description: "The interior scope of a surrounding pair", scopeType: { - type: "interior", + type: "surroundingPairInterior", + delimiter: "any", }, }, "collectionItem.textual": { diff --git a/packages/common/src/types/command/PartialTargetDescriptor.types.ts b/packages/common/src/types/command/PartialTargetDescriptor.types.ts index 1524a97c4d..dd6aa8a42c 100644 --- a/packages/common/src/types/command/PartialTargetDescriptor.types.ts +++ b/packages/common/src/types/command/PartialTargetDescriptor.types.ts @@ -208,6 +208,7 @@ export const simpleScopeTypeTypes = [ "textFragment", "disqualifyDelimiter", "pairDelimiter", + "interior", ] as const; export function isSimpleScopeType( @@ -236,10 +237,6 @@ export interface CustomRegexScopeType { flags?: string; } -export interface InteriorScopeType { - type: "interior"; -} - export type SurroundingPairDirection = "left" | "right"; export interface SurroundingPairScopeType { @@ -283,7 +280,6 @@ export type ScopeType = | SurroundingPairScopeType | SurroundingPairInteriorScopeType | CustomRegexScopeType - | InteriorScopeType | OneOfScopeType | GlyphScopeType; diff --git a/packages/cursorless-engine/src/actions/Rewrap.ts b/packages/cursorless-engine/src/actions/Rewrap.ts index 3b9030654f..0fad5350e3 100644 --- a/packages/cursorless-engine/src/actions/Rewrap.ts +++ b/packages/cursorless-engine/src/actions/Rewrap.ts @@ -1,7 +1,7 @@ import { FlashStyle } from "@cursorless/common"; import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { performEditsAndUpdateSelections } from "../core/updateSelections/updateSelections"; -import { getContainingSurroundingPairIfNoBoundaryStage } from "../processTargets/modifiers/InteriorStage"; +import { getContainingSurroundingPairIfNoBoundaryStage } from "../processTargets/modifiers/BoundaryStage"; import type { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; import { ide } from "../singletons/ide.singleton"; import type { Target } from "../typings/target.types"; diff --git a/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts b/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts index 5ad4c56a5a..12a9558133 100644 --- a/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts +++ b/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts @@ -3,6 +3,7 @@ import type { StoredTargetMap } from "../core/StoredTargets"; import type { LanguageDefinitions } from "../languages/LanguageDefinitions"; import type { ModifierStageFactory } from "./ModifierStageFactory"; import type { ModifierStage } from "./PipelineStages.types"; +import { ExcludeInteriorStage } from "./modifiers/BoundaryStage"; import { ClassFunctionNameStage } from "./modifiers/ClassFunctionNameStage"; import { ModifyIfUntypedStage } from "./modifiers/ConditionalModifierStages"; import { ContainingScopeStage } from "./modifiers/ContainingScopeStage"; @@ -14,10 +15,7 @@ import { } from "./modifiers/FilterStages"; import { HeadStage, TailStage } from "./modifiers/HeadTailStage"; import { InstanceStage } from "./modifiers/InstanceStage"; -import { - ExcludeInteriorStage, - InteriorOnlyStage, -} from "./modifiers/InteriorStage"; +import { InteriorOnlyStage } from "./modifiers/InteriorStage"; import { LeadingStage, TrailingStage } from "./modifiers/LeadingTrailingStages"; import { OrdinalScopeStage } from "./modifiers/OrdinalScopeStage"; import { EndOfStage, StartOfStage } from "./modifiers/PositionStage"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/BoundaryStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/BoundaryStage.ts new file mode 100644 index 0000000000..e29bb975b5 --- /dev/null +++ b/packages/cursorless-engine/src/processTargets/modifiers/BoundaryStage.ts @@ -0,0 +1,39 @@ +import { type ExcludeInteriorModifier } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; +import type { + ModifierStage, + ModifierStateOptions, +} from "../PipelineStages.types"; +import { ModifyIfConditionStage } from "./ConditionalModifierStages"; + +export class ExcludeInteriorStage implements ModifierStage { + private containingSurroundingPairIfNoBoundaryStage: ModifierStage; + + constructor( + private modifierStageFactory: ModifierStageFactory, + private modifier: ExcludeInteriorModifier, + ) { + this.containingSurroundingPairIfNoBoundaryStage = + getContainingSurroundingPairIfNoBoundaryStage(this.modifierStageFactory); + } + + run(target: Target, options: ModifierStateOptions): Target[] { + return this.containingSurroundingPairIfNoBoundaryStage + .run(target, options) + .flatMap((target) => target.getBoundary()!); + } +} + +export function getContainingSurroundingPairIfNoBoundaryStage( + modifierStageFactory: ModifierStageFactory, +): ModifierStage { + return new ModifyIfConditionStage( + modifierStageFactory, + { + type: "containingScope", + scopeType: { type: "surroundingPair", delimiter: "any" }, + }, + (target) => target.getBoundary() == null, + ); +} diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts index e917664123..1d26355181 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts @@ -20,52 +20,40 @@ export class InteriorOnlyStage implements ModifierStage { run(target: Target, options: ModifierStateOptions): Target[] { const interior = target.getInterior(); + // eg `inside pair` if (interior != null) { return interior; } + // eg `inside funk` if (target.hasExplicitScopeType) { - throw new NoContainingScopeError("interior"); + const everyModifier = this.modifierHandlerFactory.create({ + type: "everyScope", + scopeType: { + type: "interior", + }, + }); + + return everyModifier.run(target, options); } + // eg `inside air` const containingModifier = this.modifierHandlerFactory.create({ type: "containingScope", scopeType: { - type: "interior", + type: "oneOf", + scopeTypes: [ + { + type: "interior", + }, + { + type: "surroundingPairInterior", + delimiter: "any", + }, + ], }, }); return containingModifier.run(target, options); } } - -export class ExcludeInteriorStage implements ModifierStage { - private containingSurroundingPairIfNoBoundaryStage: ModifierStage; - - constructor( - private modifierStageFactory: ModifierStageFactory, - private modifier: ExcludeInteriorModifier, - ) { - this.containingSurroundingPairIfNoBoundaryStage = - getContainingSurroundingPairIfNoBoundaryStage(this.modifierStageFactory); - } - - run(target: Target, options: ModifierStateOptions): Target[] { - return this.containingSurroundingPairIfNoBoundaryStage - .run(target, options) - .flatMap((target) => target.getBoundary()!); - } -} - -export function getContainingSurroundingPairIfNoBoundaryStage( - modifierStageFactory: ModifierStageFactory, -): ModifierStage { - return new ModifyIfConditionStage( - modifierStageFactory, - { - type: "containingScope", - scopeType: { type: "surroundingPair", delimiter: "any" }, - }, - (target) => target.getBoundary() == null, - ); -} diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts index 0a084088e5..c0baf6efc7 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts @@ -1,11 +1,10 @@ import type { Direction, - InteriorScopeType, Position, ScopeType, TextEditor, } from "@cursorless/common"; -import { NoContainingScopeError, Range } from "@cursorless/common"; +import { NoContainingScopeError } from "@cursorless/common"; import type { LanguageDefinitions } from "../../../../languages/LanguageDefinitions"; import type { Target } from "../../../../typings/target.types"; import { InteriorTarget } from "../../../targets"; @@ -13,11 +12,9 @@ import { BaseScopeHandler } from "../BaseScopeHandler"; import type { TargetScope } from "../scope.types"; import type { ComplexScopeType, - ScopeHandler, ScopeIteratorRequirements, } from "../scopeHandler.types"; import type { ScopeHandlerFactory } from "../ScopeHandlerFactory"; -import { SortedScopeHandler } from "../SortedScopeHandler"; export class InteriorScopeHandler extends BaseScopeHandler { protected isHierarchical = true; @@ -25,7 +22,7 @@ export class InteriorScopeHandler extends BaseScopeHandler { constructor( private scopeHandlerFactory: ScopeHandlerFactory, private languageDefinitions: LanguageDefinitions, - public readonly scopeType: InteriorScopeType, + public readonly scopeType: ScopeType, private languageId: string, ) { super(); @@ -43,8 +40,9 @@ export class InteriorScopeHandler extends BaseScopeHandler { direction: Direction, hints: ScopeIteratorRequirements, ): Iterable { - const targetDomain = new Range(position, hints.distalPosition); - const scopeHandler = this.getScopeHandler(); + const scopeHandler = this.languageDefinitions + .get(this.languageId) + ?.getScopeHandler(this.scopeType); if (scopeHandler == null) { return; @@ -58,36 +56,12 @@ export class InteriorScopeHandler extends BaseScopeHandler { ); for (const scope of scopes) { - yield createInteriorScope(scope); + yield createScope(scope); } } - - private getScopeHandler(): ScopeHandler | undefined { - const languageScopeHandler = this.languageDefinitions - .get(this.languageId) - ?.getScopeHandler(this.scopeType); - - const pairScopeHandler = this.scopeHandlerFactory.create( - { - type: "surroundingPairInterior", - delimiter: "any", - }, - this.languageId, - ); - - if (languageScopeHandler == null) { - return pairScopeHandler; - } - - return SortedScopeHandler.createFromScopeHandlers( - this.scopeHandlerFactory, - this.languageId, - [languageScopeHandler, pairScopeHandler], - ); - } } -function createInteriorScope(scope: TargetScope): TargetScope { +function createScope(scope: TargetScope): TargetScope { return { editor: scope.editor, domain: scope.domain, @@ -97,10 +71,7 @@ function createInteriorScope(scope: TargetScope): TargetScope { }; } -function createInteriorTarget(target: Target): Target { - if (target instanceof InteriorTarget) { - return target; - } +function createInteriorTarget(target: Target): InteriorTarget { return new InteriorTarget({ editor: target.editor, isReversed: target.isReversed, diff --git a/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts b/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts index 518470e8a8..bd554818b6 100644 --- a/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts +++ b/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts @@ -107,6 +107,7 @@ export const defaultSpokenFormMapCore: DefaultSpokenFormMapDefinition = { textFragment: isPrivate("text fragment"), disqualifyDelimiter: isPrivate("disqualify delimiter"), pairDelimiter: isPrivate("pair delimiter"), + interior: isPrivate("inside"), ["private.fieldAccess"]: isPrivate("access"), }, complexScopeTypeType: { diff --git a/queries/c.scm b/queries/c.scm index a9b2fdb870..627104e13d 100644 --- a/queries/c.scm +++ b/queries/c.scm @@ -46,6 +46,15 @@ (#document-range! @name.iteration @value.iteration @type.iteration) ) +;;!! { } +;;! ^ +(_ + . + "{" @interior.start.endOf + "}" @interior.end.startOf + . +) + ;;!! struct Foo { }; ;;! ^ ;;!! union Foo { }; diff --git a/queries/csharp.scm b/queries/csharp.scm index a0b62d8aff..d6f6d87978 100644 --- a/queries/csharp.scm +++ b/queries/csharp.scm @@ -72,6 +72,15 @@ "}" @statement.iteration.end.startOf ) +;;!! { } +;;! ^ +(_ + . + "{" @interior.start.endOf + "}" @interior.end.startOf + . +) + ;;!! if () {} else {} ;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ( diff --git a/queries/java.scm b/queries/java.scm index 41be9a6d5d..1a898680dc 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -59,6 +59,15 @@ ) ) @statement @type @name.domain +;;!! { } +;;! ^ +(_ + . + "{" @interior.start.endOf + "}" @interior.end.startOf + . +) + ;;!! enum Foo { bar, baz } ;;! ^^^ ^^^ (enum_constant diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index 01e9aa5999..3542c89eac 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -57,6 +57,15 @@ (#document-range! @name.iteration @value.iteration @type.iteration) ) +;;!! { } +;;! ^ +(_ + . + "{" @interior.start.endOf + "}" @interior.end.startOf + . +) + ;; `name` scope without `export` ( (_ diff --git a/queries/markdown.scm b/queries/markdown.scm index e753e484cc..afb93bd165 100644 --- a/queries/markdown.scm +++ b/queries/markdown.scm @@ -47,7 +47,28 @@ ;;!! ``` ;;! ^^^ ( - (fenced_code_block) @notebookCell + (fenced_code_block + (fenced_code_block_delimiter) @interior.start.endOf + . + (block_continuation) + (fenced_code_block_delimiter) @interior.end.startOf + ) @notebookCell + (#trim-end! @notebookCell) + (#insertion-delimiter! @notebookCell "\n\n") +) + +;;!! ```python +;;! ^^^^^^^^^ +;;!! pass +;;! ---- +;;! #### +;;!! ``` +;;! ^^^ +( + (fenced_code_block + (info_string) @interior.start.endOf + (fenced_code_block_delimiter) @interior.end.startOf + ) @notebookCell (#trim-end! @notebookCell) (#insertion-delimiter! @notebookCell "\n\n") ) diff --git a/queries/scss.scm b/queries/scss.scm index c87893768e..256bbd63d4 100644 --- a/queries/scss.scm +++ b/queries/scss.scm @@ -30,6 +30,15 @@ (while_statement) ] @statement +;;!! { } +;;! ^ +(_ + . + "{" @interior.start.endOf + "}" @interior.end.startOf + . +) + (single_line_comment) @comment @textFragment ;;!! @if true { } @else { } From d33b6c12a4dfe44164adc2e57d8b0eec8301cd8f Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 11:36:48 +0100 Subject: [PATCH 22/38] Changelog --- changelog/2025-11-changeInteriorDomain.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changelog/2025-11-changeInteriorDomain.md diff --git a/changelog/2025-11-changeInteriorDomain.md b/changelog/2025-11-changeInteriorDomain.md new file mode 100644 index 0000000000..8868129db5 --- /dev/null +++ b/changelog/2025-11-changeInteriorDomain.md @@ -0,0 +1,7 @@ +--- +tags: [enhancement] +pullRequest: 3099 +--- + +- Interior domain is now same as content range (before shrinking to text content). `"take inside"` with the cursor on a function name will not select function body anymore. +- Interior of typed target now utilities every scope. `"take inside funk"` will select function body. `"take inside state"` will select all branch bodies in an if statement. From 2c20e1909f7143825d09df69b19269209d887ed4 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 11:45:12 +0100 Subject: [PATCH 23/38] Pass lint --- data/scopeSupportFacetInfos.md | 6 ++++++ .../src/processTargets/modifiers/InteriorStage.ts | 7 +------ .../TreeSitterScopeHandler/TreeSitterScopeHandler.ts | 8 +++++++- packages/cursorless-org-docs/src/docs/components/util.ts | 2 ++ .../docs/contributing/scopes/surroundingPairInterior.mdx | 5 +++++ 5 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 packages/cursorless-org-docs/src/docs/contributing/scopes/surroundingPairInterior.mdx diff --git a/data/scopeSupportFacetInfos.md b/data/scopeSupportFacetInfos.md index c79ccfa6b2..7418dff4b3 100644 --- a/data/scopeSupportFacetInfos.md +++ b/data/scopeSupportFacetInfos.md @@ -186,7 +186,13 @@ - `interior.namespace` the body of a namespace statement - `interior.resource` the body of a 'with' / 'use' / 'using' statement - `interior.static` the body of a static statement + +### surroundingPairInterior + - `interior.surroundingPair` The interior scope of a surrounding pair + +### interior + - `interior.switch` The body of a switch statement - `interior.switchCase` The body of a switch case branch - `interior.try` The body of a try/catch/finally branch diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts index 1d26355181..5435ddbfe6 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts @@ -1,15 +1,10 @@ -import { - NoContainingScopeError, - type ExcludeInteriorModifier, - type InteriorOnlyModifier, -} from "@cursorless/common"; +import { type InteriorOnlyModifier } from "@cursorless/common"; import type { Target } from "../../typings/target.types"; import type { ModifierStageFactory } from "../ModifierStageFactory"; import type { ModifierStage, ModifierStateOptions, } from "../PipelineStages.types"; -import { ModifyIfConditionStage } from "./ConditionalModifierStages"; export class InteriorOnlyStage implements ModifierStage { constructor( diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts index 9a94361077..785954248b 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts @@ -74,8 +74,14 @@ export class TreeSitterScopeHandler extends BaseTreeSitterScopeHandler { true, )?.with(contentRange.end); + const interiorRange = getRelatedRange( + match, + scopeTypeType, + "interior", + true, + ); + let removalRange = getRelatedRange(match, scopeTypeType, "removal", true); - let interiorRange = getRelatedRange(match, scopeTypeType, "interior", true); if ( removalRange == null && diff --git a/packages/cursorless-org-docs/src/docs/components/util.ts b/packages/cursorless-org-docs/src/docs/components/util.ts index 17ef0d0fcf..09b802cd4a 100644 --- a/packages/cursorless-org-docs/src/docs/components/util.ts +++ b/packages/cursorless-org-docs/src/docs/components/util.ts @@ -68,6 +68,8 @@ export function isScopeInternal(scope: ScopeTypeType): boolean { case "disqualifyDelimiter": case "pairDelimiter": case "textFragment": + case "interior": + case "surroundingPairInterior": return true; default: return false; diff --git a/packages/cursorless-org-docs/src/docs/contributing/scopes/surroundingPairInterior.mdx b/packages/cursorless-org-docs/src/docs/contributing/scopes/surroundingPairInterior.mdx new file mode 100644 index 0000000000..7c2895e51a --- /dev/null +++ b/packages/cursorless-org-docs/src/docs/contributing/scopes/surroundingPairInterior.mdx @@ -0,0 +1,5 @@ +import { Scopes } from "./components/Scopes"; + +# Surrounding pair interior + + From 84626c554efaa527052a58b3cdfaa047e85a1016 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 11:58:01 +0100 Subject: [PATCH 24/38] Clean up --- .../parseTree/python/clearMatching10.yml | 10 +++++----- .../TreeSitterScopeHandler.ts | 8 -------- .../processTargets/targets/ScopeTypeTarget.ts | 17 ----------------- 3 files changed, 5 insertions(+), 30 deletions(-) diff --git a/data/fixtures/recorded/surroundingPair/parseTree/python/clearMatching10.yml b/data/fixtures/recorded/surroundingPair/parseTree/python/clearMatching10.yml index 289deb8c23..efd27891a4 100644 --- a/data/fixtures/recorded/surroundingPair/parseTree/python/clearMatching10.yml +++ b/data/fixtures/recorded/surroundingPair/parseTree/python/clearMatching10.yml @@ -14,13 +14,13 @@ initialState: "'jlkjl' 'fsd'" selections: - - anchor: {line: 1, character: 8} - active: {line: 1, character: 8} + - anchor: {line: 1, character: 7} + active: {line: 1, character: 7} marks: {} finalState: documentContents: |- - "" + "'' 'fsd'" selections: - - anchor: {line: 1, character: 1} - active: {line: 1, character: 1} + - anchor: {line: 1, character: 2} + active: {line: 1, character: 2} diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts index 785954248b..1fead109cd 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts @@ -74,13 +74,6 @@ export class TreeSitterScopeHandler extends BaseTreeSitterScopeHandler { true, )?.with(contentRange.end); - const interiorRange = getRelatedRange( - match, - scopeTypeType, - "interior", - true, - ); - let removalRange = getRelatedRange(match, scopeTypeType, "removal", true); if ( @@ -109,7 +102,6 @@ export class TreeSitterScopeHandler extends BaseTreeSitterScopeHandler { contentRange, prefixRange, removalRange, - interiorRange, leadingDelimiterRange, trailingDelimiterRange, insertionDelimiter, diff --git a/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts b/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts index cc3d53419f..cf74c9854d 100644 --- a/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts @@ -7,7 +7,6 @@ import type { Target } from "../../typings/target.types"; import { toGeneralizedRange } from "../../util/targetUtils"; import type { CommonTargetParameters } from "./BaseTarget"; import { BaseTarget } from "./BaseTarget"; -import { InteriorTarget } from "./InteriorTarget"; import { PlainTarget } from "./PlainTarget"; import { getDelimitedSequenceRemovalRange } from "./util/insertionRemovalBehaviors/DelimitedSequenceInsertionRemovalBehavior"; import { @@ -21,7 +20,6 @@ export interface ScopeTypeTargetParameters extends CommonTargetParameters { readonly insertionDelimiter?: string; readonly prefixRange?: Range; readonly removalRange?: Range; - readonly interiorRange?: Range; readonly leadingDelimiterRange?: Range; readonly trailingDelimiterRange?: Range; } @@ -30,7 +28,6 @@ export class ScopeTypeTarget extends BaseTarget { type = "ScopeTypeTarget"; private scopeTypeType_: SimpleScopeTypeType; private removalRange_?: Range; - private interiorRange_?: Range; private leadingDelimiterRange_?: Range; private trailingDelimiterRange_?: Range; private hasDelimiterRange_: boolean; @@ -41,7 +38,6 @@ export class ScopeTypeTarget extends BaseTarget { super(parameters); this.scopeTypeType_ = parameters.scopeTypeType; this.removalRange_ = parameters.removalRange; - this.interiorRange_ = parameters.interiorRange; this.leadingDelimiterRange_ = parameters.leadingDelimiterRange; this.trailingDelimiterRange_ = parameters.trailingDelimiterRange; this.prefixRange = parameters.prefixRange; @@ -100,19 +96,6 @@ export class ScopeTypeTarget extends BaseTarget { return getSmartRemovalTarget(this).getRemovalHighlightRange(); } - getInterior(): Target[] | undefined { - if (this.interiorRange_ == null) { - return undefined; - } - return [ - new InteriorTarget({ - editor: this.editor, - isReversed: this.isReversed, - fullInteriorRange: this.interiorRange_, - }), - ]; - } - maybeCreateRichRangeTarget( isReversed: boolean, endTarget: ScopeTypeTarget, From afe049884a998980f95671f1e9bb9c136800b063 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 12:06:46 +0100 Subject: [PATCH 25/38] Restore head tail --- .../processTargets/modifiers/HeadTailStage.ts | 20 +++------ .../processTargets/modifiers/InteriorStage.ts | 41 +++++++++++-------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts index 641dc43b71..74e79ef936 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts @@ -16,6 +16,7 @@ import { processModifierStages, } from "../TargetPipelineRunner"; import { HeadTailTarget, PlainTarget } from "../targets"; +import { createContainingInteriorStage } from "./InteriorStage"; class HeadTailStage implements ModifierStage { constructor( @@ -99,9 +100,10 @@ class BoundedLineStage implements ModifierStage { options: ModifierStateOptions, ): Target | undefined { try { - return this.getContaining(target, options, { - type: "interior", - }); + return createContainingInteriorStage(this.modifierStageFactory).run( + target, + options, + )[0]; } catch (error) { if (error instanceof NoContainingScopeError) { return undefined; @@ -113,19 +115,9 @@ class BoundedLineStage implements ModifierStage { private getContainingLine( target: Target, options: ModifierStateOptions, - ): Target { - return this.getContaining(target, options, { - type: "line", - }); - } - - private getContaining( - target: Target, - options: ModifierStateOptions, - scopeType: ScopeType, ): Target { return this.modifierStageFactory - .create({ type: "containingScope", scopeType }) + .create({ type: "containingScope", scopeType: { type: "line" } }) .run(target, options)[0]; } } diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts index 5435ddbfe6..a014b7083e 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts @@ -33,22 +33,29 @@ export class InteriorOnlyStage implements ModifierStage { } // eg `inside air` - const containingModifier = this.modifierHandlerFactory.create({ - type: "containingScope", - scopeType: { - type: "oneOf", - scopeTypes: [ - { - type: "interior", - }, - { - type: "surroundingPairInterior", - delimiter: "any", - }, - ], - }, - }); - - return containingModifier.run(target, options); + return createContainingInteriorStage(this.modifierHandlerFactory).run( + target, + options, + ); } } + +export function createContainingInteriorStage( + modifierHandlerFactory: ModifierStageFactory, +): ModifierStage { + return modifierHandlerFactory.create({ + type: "containingScope", + scopeType: { + type: "oneOf", + scopeTypes: [ + { + type: "interior", + }, + { + type: "surroundingPairInterior", + delimiter: "any", + }, + ], + }, + }); +} From ea7925bcc14dbe0181037d1b69cf5004d38f3c2f Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 12:41:53 +0100 Subject: [PATCH 26/38] Added comment --- .../src/processTargets/modifiers/HeadTailStage.ts | 1 - .../src/processTargets/modifiers/InteriorStage.ts | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts index 74e79ef936..f5a09216cf 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts @@ -2,7 +2,6 @@ import { NoContainingScopeError, type HeadModifier, type Modifier, - type ScopeType, type TailModifier, } from "@cursorless/common"; import type { Target } from "../../typings/target.types"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts index a014b7083e..dbbd839cbf 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts @@ -21,6 +21,9 @@ export class InteriorOnlyStage implements ModifierStage { } // eg `inside funk` + // The reason for this being in every scope when we have an explicit scope + // type is because we are looking for interiors inside of the scope. We + // don't want a normal containing behavior that expands. if (target.hasExplicitScopeType) { const everyModifier = this.modifierHandlerFactory.create({ type: "everyScope", From e2e0968a41a0ffcc7fa464bd333c3d1881ef5e75 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 12:42:52 +0100 Subject: [PATCH 27/38] Remove change log --- changelog/2025-11-changeInteriorDomain.md | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 changelog/2025-11-changeInteriorDomain.md diff --git a/changelog/2025-11-changeInteriorDomain.md b/changelog/2025-11-changeInteriorDomain.md deleted file mode 100644 index 8868129db5..0000000000 --- a/changelog/2025-11-changeInteriorDomain.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -tags: [enhancement] -pullRequest: 3099 ---- - -- Interior domain is now same as content range (before shrinking to text content). `"take inside"` with the cursor on a function name will not select function body anymore. -- Interior of typed target now utilities every scope. `"take inside funk"` will select function body. `"take inside state"` will select all branch bodies in an if statement. From af04dbcbb923b2b601630b9a9b96b3ba018b6dfb Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 12:46:23 +0100 Subject: [PATCH 28/38] Add test --- .../modifiers/interior/changeInsideState.yml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 data/fixtures/recorded/modifiers/interior/changeInsideState.yml diff --git a/data/fixtures/recorded/modifiers/interior/changeInsideState.yml b/data/fixtures/recorded/modifiers/interior/changeInsideState.yml new file mode 100644 index 0000000000..221c88f0d4 --- /dev/null +++ b/data/fixtures/recorded/modifiers/interior/changeInsideState.yml @@ -0,0 +1,44 @@ +languageId: javascript +command: + version: 7 + spokenForm: change inside state + action: + name: clearAndSetSelection + target: + type: primitive + modifiers: + - {type: interiorOnly} + - type: containingScope + scopeType: {type: statement} + usePrePhraseSnapshot: false +initialState: + documentContents: |- + if (true) { + a; + } + else if (false) { + b; + } else { + c; + } + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: {} +finalState: + documentContents: |- + if (true) { + + } + else if (false) { + + } else { + + } + selections: + - anchor: {line: 1, character: 4} + active: {line: 1, character: 4} + - anchor: {line: 4, character: 4} + active: {line: 4, character: 4} + - anchor: {line: 6, character: 4} + active: {line: 6, character: 4} From 4d180d53412f6c8b7a58a22847f06d21531a4817 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 12:48:24 +0100 Subject: [PATCH 29/38] Update comment --- .../src/processTargets/modifiers/InteriorStage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts index dbbd839cbf..68af14af8b 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts @@ -21,7 +21,7 @@ export class InteriorOnlyStage implements ModifierStage { } // eg `inside funk` - // The reason for this being in every scope when we have an explicit scope + // The reason for this being an every scope when we have an explicit scope // type is because we are looking for interiors inside of the scope. We // don't want a normal containing behavior that expands. if (target.hasExplicitScopeType) { From 3c6ebd5a257ebe997111490fff24e3bfc7bc3102 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 14:31:54 +0100 Subject: [PATCH 30/38] Update tests --- .../recorded/modifiers/changeInsideValue.yml | 30 ------------------- .../changeInside5.yml} | 4 +-- queries/go.scm | 9 ++++++ queries/lua.scm | 9 ++++++ 4 files changed, 20 insertions(+), 32 deletions(-) delete mode 100644 data/fixtures/recorded/modifiers/changeInsideValue.yml rename data/fixtures/recorded/modifiers/{changeInside.yml => interior/changeInside5.yml} (85%) diff --git a/data/fixtures/recorded/modifiers/changeInsideValue.yml b/data/fixtures/recorded/modifiers/changeInsideValue.yml deleted file mode 100644 index 1510d7bce4..0000000000 --- a/data/fixtures/recorded/modifiers/changeInsideValue.yml +++ /dev/null @@ -1,30 +0,0 @@ -languageId: typescript -command: - version: 7 - spokenForm: change inside value - action: - name: clearAndSetSelection - target: - type: primitive - modifiers: - - {type: interiorOnly} - - type: containingScope - scopeType: {type: value} - usePrePhraseSnapshot: true -initialState: - documentContents: |- - const aaa = { - bbb: "ccc ddd" - } - selections: - - anchor: {line: 1, character: 4} - active: {line: 1, character: 4} - marks: {} -finalState: - documentContents: |- - const aaa = { - bbb: "" - } - selections: - - anchor: {line: 1, character: 10} - active: {line: 1, character: 10} diff --git a/data/fixtures/recorded/modifiers/changeInside.yml b/data/fixtures/recorded/modifiers/interior/changeInside5.yml similarity index 85% rename from data/fixtures/recorded/modifiers/changeInside.yml rename to data/fixtures/recorded/modifiers/interior/changeInside5.yml index 04bce24ce6..8b325a1692 100644 --- a/data/fixtures/recorded/modifiers/changeInside.yml +++ b/data/fixtures/recorded/modifiers/interior/changeInside5.yml @@ -14,8 +14,8 @@ initialState: def testing(): pass selections: - - anchor: {line: 1, character: 14} - active: {line: 1, character: 14} + - anchor: {line: 1, character: 4} + active: {line: 1, character: 4} marks: {} finalState: documentContents: |- diff --git a/queries/go.scm b/queries/go.scm index d181a42120..1a57ed82a8 100644 --- a/queries/go.scm +++ b/queries/go.scm @@ -31,6 +31,15 @@ (var_declaration) ] @statement +;;!! { } +;;! ^ +(_ + . + "{" @interior.start.endOf + "}" @interior.end.startOf + . +) + ( (interpreted_string_literal) @string @textFragment (#child-range! @textFragment 0 -1 true true) diff --git a/queries/lua.scm b/queries/lua.scm index 3a11e70ec0..90716aa376 100644 --- a/queries/lua.scm +++ b/queries/lua.scm @@ -15,6 +15,15 @@ (while_statement) ] @statement +;;!! { } +;;! ^ +(_ + . + "{" @interior.start.endOf + "}" @interior.end.startOf + . +) + ;; Only treat function declarions and calls as statements if they ;; aren't part of assignments, etc ( From dd93599a751559280fa279629011b016d3a34130 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 14:57:19 +0100 Subject: [PATCH 31/38] latex interior --- .../scopes/latex/interior.element.scope | 32 +++---------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/data/fixtures/scopes/latex/interior.element.scope b/data/fixtures/scopes/latex/interior.element.scope index a3235c56a0..9f0a0637fc 100644 --- a/data/fixtures/scopes/latex/interior.element.scope +++ b/data/fixtures/scopes/latex/interior.element.scope @@ -3,46 +3,22 @@ \end{quote} --- -[#1 Content] = 1:4-1:9 +[Content] = 1:4-1:9 >-----< 1| Hello -[#1 Removal] = 0:13-2:0 +[Removal] = 0:13-2:0 > 0| \begin{quote} 1| Hello 2| \end{quote} < -[#1 Domain] = 0:0-2:11 +[Domain] = 0:0-2:11 >------------- 0| \begin{quote} 1| Hello 2| \end{quote} -----------< -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = 0:7-0:12 - >-----< -0| \begin{quote} - -[#2 Domain] = 0:6-0:13 - >-------< -0| \begin{quote} - -[#2 Insertion delimiter] = " " - - -[#3 Content] = -[#3 Removal] = 2:5-2:10 - >-----< -2| \end{quote} - -[#3 Domain] = 2:4-2:11 - >-------< -2| \end{quote} - -[#3 Insertion delimiter] = " " +[Insertion delimiter] = " " From 079b26d4ff4b3d5215e3caa0ade0ee1624e09f5e Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 15:02:24 +0100 Subject: [PATCH 32/38] update tests --- ...eParen2.yml => changeEveryPaintInside.yml} | 11 +++------- ...en.yml => changeEveryShortPaintInside.yml} | 11 +++------- .../processTargets/modifiers/InteriorStage.ts | 20 ++++++++++++++----- 3 files changed, 21 insertions(+), 21 deletions(-) rename data/fixtures/recorded/selectionTypes/{changeEveryPaintInsideParen2.yml => changeEveryPaintInside.yml} (66%) rename data/fixtures/recorded/selectionTypes/{changeEveryShortPaintInsideParen.yml => changeEveryShortPaintInside.yml} (65%) diff --git a/data/fixtures/recorded/selectionTypes/changeEveryPaintInsideParen2.yml b/data/fixtures/recorded/selectionTypes/changeEveryPaintInside.yml similarity index 66% rename from data/fixtures/recorded/selectionTypes/changeEveryPaintInsideParen2.yml rename to data/fixtures/recorded/selectionTypes/changeEveryPaintInside.yml index decbb40e90..56617ee2e5 100644 --- a/data/fixtures/recorded/selectionTypes/changeEveryPaintInsideParen2.yml +++ b/data/fixtures/recorded/selectionTypes/changeEveryPaintInside.yml @@ -1,7 +1,7 @@ languageId: plaintext command: version: 6 - spokenForm: change every paint inside paren + spokenForm: change every paint inside action: name: clearAndSetSelection target: @@ -10,17 +10,12 @@ command: - type: everyScope scopeType: {type: nonWhitespaceSequence} - {type: interiorOnly} - mark: {type: decoratedSymbol, symbolColor: default, character: (} usePrePhraseSnapshot: true initialState: documentContents: foo(aa|aa-().c_d bb|bb-().'') { return 1; } selections: - - anchor: {line: 0, character: 0} - active: {line: 0, character: 0} - marks: - default.(: - start: {line: 0, character: 3} - end: {line: 0, character: 4} + - anchor: {line: 0, character: 4} + active: {line: 0, character: 4} finalState: documentContents: " { return 1; }" selections: diff --git a/data/fixtures/recorded/selectionTypes/changeEveryShortPaintInsideParen.yml b/data/fixtures/recorded/selectionTypes/changeEveryShortPaintInside.yml similarity index 65% rename from data/fixtures/recorded/selectionTypes/changeEveryShortPaintInsideParen.yml rename to data/fixtures/recorded/selectionTypes/changeEveryShortPaintInside.yml index 96f413ee3e..d6a13f0ef8 100644 --- a/data/fixtures/recorded/selectionTypes/changeEveryShortPaintInsideParen.yml +++ b/data/fixtures/recorded/selectionTypes/changeEveryShortPaintInside.yml @@ -1,7 +1,7 @@ languageId: plaintext command: version: 6 - spokenForm: change every short paint inside paren + spokenForm: change every short paint inside action: name: clearAndSetSelection target: @@ -10,17 +10,12 @@ command: - type: everyScope scopeType: {type: boundedNonWhitespaceSequence} - {type: interiorOnly} - mark: {type: decoratedSymbol, symbolColor: default, character: (} usePrePhraseSnapshot: true initialState: documentContents: foo(aa|aa-().c_d bb|bb-().'') selections: - - anchor: {line: 0, character: 1} - active: {line: 0, character: 1} - marks: - default.(: - start: {line: 0, character: 3} - end: {line: 0, character: 4} + - anchor: {line: 0, character: 4} + active: {line: 0, character: 4} finalState: documentContents: foo( ) selections: diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts index 68af14af8b..bee80ae8a6 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts @@ -1,4 +1,7 @@ -import { type InteriorOnlyModifier } from "@cursorless/common"; +import { + NoContainingScopeError, + type InteriorOnlyModifier, +} from "@cursorless/common"; import type { Target } from "../../typings/target.types"; import type { ModifierStageFactory } from "../ModifierStageFactory"; import type { @@ -36,10 +39,17 @@ export class InteriorOnlyStage implements ModifierStage { } // eg `inside air` - return createContainingInteriorStage(this.modifierHandlerFactory).run( - target, - options, - ); + try { + return createContainingInteriorStage(this.modifierHandlerFactory).run( + target, + options, + ); + } catch (e) { + if (e instanceof NoContainingScopeError) { + throw new NoContainingScopeError("interior"); + } + throw e; + } } } From a8989d02465a53e4677b54e413fd0046986685ad Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 15:14:12 +0100 Subject: [PATCH 33/38] Mark interior as sudo scope --- .../common/src/types/command/PartialTargetDescriptor.types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/common/src/types/command/PartialTargetDescriptor.types.ts b/packages/common/src/types/command/PartialTargetDescriptor.types.ts index dd6aa8a42c..41afdd2556 100644 --- a/packages/common/src/types/command/PartialTargetDescriptor.types.ts +++ b/packages/common/src/types/command/PartialTargetDescriptor.types.ts @@ -221,6 +221,7 @@ export type SimpleScopeTypeType = (typeof simpleScopeTypeTypes)[number]; export const pseudoScopes = new Set([ "instance", + "interior", "className", "functionName", ]); From 7530b9db90a5be092b6e29e90c2bc3cadf3e7420 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 15:24:07 +0100 Subject: [PATCH 34/38] more latex --- data/fixtures/scopes/latex/interior.element.scope | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/fixtures/scopes/latex/interior.element.scope b/data/fixtures/scopes/latex/interior.element.scope index 9f0a0637fc..34b602d342 100644 --- a/data/fixtures/scopes/latex/interior.element.scope +++ b/data/fixtures/scopes/latex/interior.element.scope @@ -14,11 +14,11 @@ 2| \end{quote} < -[Domain] = 0:0-2:11 - >------------- +[Domain] = 0:13-2:0 + > 0| \begin{quote} 1| Hello 2| \end{quote} - -----------< + < [Insertion delimiter] = " " From 31d437435bcf4fffd95323303378ffae81ca8a64 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 10 Nov 2025 16:28:45 +0100 Subject: [PATCH 35/38] Rename default spoke in form for interior scope --- .../src/spokenForms/defaultSpokenFormMapCore.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts b/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts index bd554818b6..3bf96c1d90 100644 --- a/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts +++ b/packages/cursorless-engine/src/spokenForms/defaultSpokenFormMapCore.ts @@ -107,7 +107,7 @@ export const defaultSpokenFormMapCore: DefaultSpokenFormMapDefinition = { textFragment: isPrivate("text fragment"), disqualifyDelimiter: isPrivate("disqualify delimiter"), pairDelimiter: isPrivate("pair delimiter"), - interior: isPrivate("inside"), + interior: isPrivate("interior"), ["private.fieldAccess"]: isPrivate("access"), }, complexScopeTypeType: { From 914303116a0513e741936add1601a7ce7fd0bac1 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Tue, 11 Nov 2025 11:27:00 +0100 Subject: [PATCH 36/38] Update comment --- .../src/processTargets/modifiers/InteriorStage.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts index bee80ae8a6..6a38d9a3c1 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts @@ -24,9 +24,15 @@ export class InteriorOnlyStage implements ModifierStage { } // eg `inside funk` - // The reason for this being an every scope when we have an explicit scope - // type is because we are looking for interiors inside of the scope. We - // don't want a normal containing behavior that expands. + // When you say "inside funk", in an ideal world, the function target would + // have a defined interior property that we could just use directly. + // However, it is painful to define interiors for every single scope in + // every single language, particularly scopes like "if", which could have + // multiple interiors and tends to be defined in a tricky nested way in the + // parse tree. Instead, we just define interior as a scope, and then call + // every interior on the input target here. This will work as expected in + // most cases, as long as the nearest interior is what we expect, which it + // usually is. if (target.hasExplicitScopeType) { const everyModifier = this.modifierHandlerFactory.create({ type: "everyScope", From ed6ca7e9790f92950448210f74f5b8f7171be67d Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 13 Nov 2025 11:27:19 +0100 Subject: [PATCH 37/38] Update lua test --- .../languages/lua/changeInsideList.yml | 26 ------------------- queries/lua.scm | 9 ------- 2 files changed, 35 deletions(-) delete mode 100644 data/fixtures/recorded/languages/lua/changeInsideList.yml diff --git a/data/fixtures/recorded/languages/lua/changeInsideList.yml b/data/fixtures/recorded/languages/lua/changeInsideList.yml deleted file mode 100644 index 06802e045d..0000000000 --- a/data/fixtures/recorded/languages/lua/changeInsideList.yml +++ /dev/null @@ -1,26 +0,0 @@ -languageId: lua -command: - version: 6 - spokenForm: change inside list - action: - name: clearAndSetSelection - target: - type: primitive - modifiers: - - {type: interiorOnly} - - type: containingScope - scopeType: {type: list} - usePrePhraseSnapshot: true -initialState: - documentContents: | - foo = {"a", "b", "c"}, - selections: - - anchor: {line: 0, character: 9} - active: {line: 0, character: 9} - marks: {} -finalState: - documentContents: | - foo = {}, - selections: - - anchor: {line: 0, character: 7} - active: {line: 0, character: 7} diff --git a/queries/lua.scm b/queries/lua.scm index 90716aa376..3a11e70ec0 100644 --- a/queries/lua.scm +++ b/queries/lua.scm @@ -15,15 +15,6 @@ (while_statement) ] @statement -;;!! { } -;;! ^ -(_ - . - "{" @interior.start.endOf - "}" @interior.end.startOf - . -) - ;; Only treat function declarions and calls as statements if they ;; aren't part of assignments, etc ( From d1f4aa8e027f296399b7e1484f22754e455791a4 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 13 Nov 2025 11:28:34 +0100 Subject: [PATCH 38/38] Clean up comments --- .../src/processTargets/modifiers/InteriorStage.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts index 6a38d9a3c1..6d6b400608 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts @@ -18,12 +18,12 @@ export class InteriorOnlyStage implements ModifierStage { run(target: Target, options: ModifierStateOptions): Target[] { const interior = target.getInterior(); - // eg `inside pair` + // eg "inside pair" if (interior != null) { return interior; } - // eg `inside funk` + // eg "inside funk" // When you say "inside funk", in an ideal world, the function target would // have a defined interior property that we could just use directly. // However, it is painful to define interiors for every single scope in @@ -44,7 +44,7 @@ export class InteriorOnlyStage implements ModifierStage { return everyModifier.run(target, options); } - // eg `inside air` + // eg "inside air" try { return createContainingInteriorStage(this.modifierHandlerFactory).run( target,