From ebfcd262752910a429efa6934d0fecc922806571 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Wed, 16 Apr 2025 15:54:40 +0200 Subject: [PATCH 01/11] resource is not applicabler --- .../common/src/scopeSupportFacets/javascript.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index 5bce8eed13..a153bc1e5a 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -135,11 +135,6 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "className.iteration.document": unsupported, "name.iteration.block": unsupported, - "name.resource": unsupported, - "name.resource.iteration": unsupported, - - "value.resource": unsupported, - "value.resource.iteration": unsupported, "interior.class": unsupported, "interior.function": unsupported, @@ -149,19 +144,25 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "interior.switchCase": unsupported, "interior.ternary": unsupported, "interior.try": unsupported, - "interior.resource": unsupported, // Not applicable "interior.cell": notApplicable, "interior.command": notApplicable, + "interior.resource": notApplicable, "name.argument.actual.iteration": notApplicable, "name.argument.actual": notApplicable, - "value.argument.actual": notApplicable, - "value.argument.actual.iteration": notApplicable, + "name.resource.iteration": notApplicable, + "name.resource": notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, "textFragment.element": notApplicable, + "type.resource.iteration": notApplicable, + "type.resource": notApplicable, + "value.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.resource.iteration": notApplicable, + "value.resource": notApplicable, command: notApplicable, environment: notApplicable, notebookCell: notApplicable, From c772363d328b3688a7f8d8eb25359b63bece29be Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Wed, 16 Apr 2025 17:04:42 +0200 Subject: [PATCH 02/11] More migrations --- .../scopes/javascript.core/branch.loop.scope | 10 +++++ .../scopes/javascript.core/branch.loop2.scope | 10 +++++ .../scopes/javascript.core/branch.loop3.scope | 10 +++++ .../scopes/javascript.core/branch.loop4.scope | 10 +++++ .../class.iteration.document.scope | 8 ++++ .../className.iteration.document.scope | 8 ++++ .../collectionItem.unenclosed.iteration.scope | 10 +++++ .../functionName.iteration.block.scope | 27 ++++++++++++ .../functionName.iteration.block2.scope | 13 ++++++ .../functionName.iteration.block3.scope | 22 ++++++++++ .../functionName.iteration.block4.scope | 13 ++++++ .../functionName.iteration.document.scope | 10 ++++- .../functionName.method.iteration.class.scope | 19 +++++++- ...rgument.formal.constructor.iteration.scope | 4 +- .../name.argument.formal.iteration.scope | 4 +- ...ame.argument.formal.method.iteration.scope | 4 +- .../name.iteration.block.scope | 33 ++++++++++++++ .../name.iteration.block2.scope | 19 ++++++++ .../name.iteration.block3.scope | 22 ++++++++++ .../name.iteration.block4.scope | 13 ++++++ .../namedFunction.iteration.block.scope | 27 ++++++++++++ .../namedFunction.iteration.block2.scope | 13 ++++++ .../namedFunction.iteration.block3.scope | 22 ++++++++++ .../namedFunction.iteration.block4.scope | 13 ++++++ .../namedFunction.iteration.document.scope | 10 ++++- ...namedFunction.method.iteration.class.scope | 19 +++++++- ...rgument.formal.constructor.iteration.scope | 4 +- .../value.argument.formal.iteration.scope | 4 +- ...lue.argument.formal.method.iteration.scope | 4 +- .../src/scopeSupportFacets/javascript.ts | 22 +++++----- queries/javascript.core.scm | 43 +++++++++++++++++-- queries/javascript.function.scm | 12 ++++++ 32 files changed, 426 insertions(+), 36 deletions(-) create mode 100644 data/fixtures/scopes/javascript.core/branch.loop.scope create mode 100644 data/fixtures/scopes/javascript.core/branch.loop2.scope create mode 100644 data/fixtures/scopes/javascript.core/branch.loop3.scope create mode 100644 data/fixtures/scopes/javascript.core/branch.loop4.scope create mode 100644 data/fixtures/scopes/javascript.core/class.iteration.document.scope create mode 100644 data/fixtures/scopes/javascript.core/className.iteration.document.scope create mode 100644 data/fixtures/scopes/javascript.core/collectionItem.unenclosed.iteration.scope create mode 100644 data/fixtures/scopes/javascript.core/functionName.iteration.block.scope create mode 100644 data/fixtures/scopes/javascript.core/functionName.iteration.block2.scope create mode 100644 data/fixtures/scopes/javascript.core/functionName.iteration.block3.scope create mode 100644 data/fixtures/scopes/javascript.core/functionName.iteration.block4.scope create mode 100644 data/fixtures/scopes/javascript.core/name.iteration.block.scope create mode 100644 data/fixtures/scopes/javascript.core/name.iteration.block2.scope create mode 100644 data/fixtures/scopes/javascript.core/name.iteration.block3.scope create mode 100644 data/fixtures/scopes/javascript.core/name.iteration.block4.scope create mode 100644 data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope create mode 100644 data/fixtures/scopes/javascript.core/namedFunction.iteration.block2.scope create mode 100644 data/fixtures/scopes/javascript.core/namedFunction.iteration.block3.scope create mode 100644 data/fixtures/scopes/javascript.core/namedFunction.iteration.block4.scope diff --git a/data/fixtures/scopes/javascript.core/branch.loop.scope b/data/fixtures/scopes/javascript.core/branch.loop.scope new file mode 100644 index 0000000000..2309add85a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/branch.loop.scope @@ -0,0 +1,10 @@ +for (let i = 0; i < size; ++i) { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:34 + >----------------------------------< +0| for (let i = 0; i < size; ++i) { } + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/branch.loop2.scope b/data/fixtures/scopes/javascript.core/branch.loop2.scope new file mode 100644 index 0000000000..23da216aa5 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/branch.loop2.scope @@ -0,0 +1,10 @@ +for (const v of values) { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:27 + >---------------------------< +0| for (const v of values) { } + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/branch.loop3.scope b/data/fixtures/scopes/javascript.core/branch.loop3.scope new file mode 100644 index 0000000000..5beb4d4731 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/branch.loop3.scope @@ -0,0 +1,10 @@ +while(true) { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:15 + >---------------< +0| while(true) { } + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/branch.loop4.scope b/data/fixtures/scopes/javascript.core/branch.loop4.scope new file mode 100644 index 0000000000..25f6d347bf --- /dev/null +++ b/data/fixtures/scopes/javascript.core/branch.loop4.scope @@ -0,0 +1,10 @@ +do { } while(true); +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:19 + >-------------------< +0| do { } while(true); + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/javascript.core/class.iteration.document.scope b/data/fixtures/scopes/javascript.core/class.iteration.document.scope new file mode 100644 index 0000000000..4d43b4a22a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/class.iteration.document.scope @@ -0,0 +1,8 @@ + +class MyClass { } +--- + +[Range] = +[Domain] = 1:0-1:17 + >-----------------< +1| class MyClass { } diff --git a/data/fixtures/scopes/javascript.core/className.iteration.document.scope b/data/fixtures/scopes/javascript.core/className.iteration.document.scope new file mode 100644 index 0000000000..4d43b4a22a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/className.iteration.document.scope @@ -0,0 +1,8 @@ + +class MyClass { } +--- + +[Range] = +[Domain] = 1:0-1:17 + >-----------------< +1| class MyClass { } diff --git a/data/fixtures/scopes/javascript.core/collectionItem.unenclosed.iteration.scope b/data/fixtures/scopes/javascript.core/collectionItem.unenclosed.iteration.scope new file mode 100644 index 0000000000..a38a824b04 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/collectionItem.unenclosed.iteration.scope @@ -0,0 +1,10 @@ +let foo, bar; +--- + +[Range] = 0:4-0:12 + >--------< +0| let foo, bar; + +[Domain] = 0:0-0:13 + >-------------< +0| let foo, bar; diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.block.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.block.scope new file mode 100644 index 0000000000..cb73f4ef7c --- /dev/null +++ b/data/fixtures/scopes/javascript.core/functionName.iteration.block.scope @@ -0,0 +1,27 @@ +class MyClass { + myFunk() { } +} +--- + +[#1 Range] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| myFunk() { } +2| } + -< + + +[#2 Range] = +[#2 Domain] = 0:15-2:0 + > +0| class MyClass { +1| myFunk() { } +2| } + < + + +[#3 Range] = +[#3 Domain] = 1:14-1:15 + >-< +1| myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.block2.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.block2.scope new file mode 100644 index 0000000000..da00f553fb --- /dev/null +++ b/data/fixtures/scopes/javascript.core/functionName.iteration.block2.scope @@ -0,0 +1,13 @@ +function myFunk() { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:21 + >---------------------< +0| function myFunk() { } + + +[#2 Range] = +[#2 Domain] = 0:19-0:20 + >-< +0| function myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.block3.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.block3.scope new file mode 100644 index 0000000000..d37573c3aa --- /dev/null +++ b/data/fixtures/scopes/javascript.core/functionName.iteration.block3.scope @@ -0,0 +1,22 @@ +if (true) { } +else { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-1:8 + >------------- +0| if (true) { } +1| else { } + --------< + + +[#2 Range] = +[#2 Domain] = 0:11-0:12 + >-< +0| if (true) { } + + +[#3 Range] = +[#3 Domain] = 1:6-1:7 + >-< +1| else { } diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.block4.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.block4.scope new file mode 100644 index 0000000000..e38a055e01 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/functionName.iteration.block4.scope @@ -0,0 +1,13 @@ +while (true) { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:16 + >----------------< +0| while (true) { } + + +[#2 Range] = +[#2 Domain] = 0:14-0:15 + >-< +0| while (true) { } diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.document.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.document.scope index 8c374bbb0a..841a7ae10a 100644 --- a/data/fixtures/scopes/javascript.core/functionName.iteration.document.scope +++ b/data/fixtures/scopes/javascript.core/functionName.iteration.document.scope @@ -3,10 +3,16 @@ function myFunk() { } // After --- -[Range] = -[Domain] = 0:0-2:8 +[#1 Range] = +[#1 Domain] = 0:0-2:8 >--------- 0| // Before 1| function myFunk() { } 2| // After --------< + + +[#2 Range] = +[#2 Domain] = 1:19-1:20 + >-< +1| function myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope b/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope index 648d870dd9..28b792e309 100644 --- a/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope +++ b/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope @@ -3,10 +3,25 @@ class MyClass { } --- -[Range] = -[Domain] = 0:0-2:1 +[#1 Range] = +[#1 Domain] = 0:0-2:1 >--------------- 0| class MyClass { 1| myFunk() { } 2| } -< + + +[#2 Range] = +[#2 Domain] = 0:15-2:0 + > +0| class MyClass { +1| myFunk() { } +2| } + < + + +[#3 Range] = +[#3 Domain] = 1:12-1:13 + >-< +1| myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/name.argument.formal.constructor.iteration.scope b/data/fixtures/scopes/javascript.core/name.argument.formal.constructor.iteration.scope index f0580a308c..00821cfe98 100644 --- a/data/fixtures/scopes/javascript.core/name.argument.formal.constructor.iteration.scope +++ b/data/fixtures/scopes/javascript.core/name.argument.formal.constructor.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:13-1:23 - >----------< +[#3 Domain] = 1:14-1:22 + >--------< 1| constructor(aaa, bbb) { } diff --git a/data/fixtures/scopes/javascript.core/name.argument.formal.iteration.scope b/data/fixtures/scopes/javascript.core/name.argument.formal.iteration.scope index 5102ca8933..73848e31b8 100644 --- a/data/fixtures/scopes/javascript.core/name.argument.formal.iteration.scope +++ b/data/fixtures/scopes/javascript.core/name.argument.formal.iteration.scope @@ -8,8 +8,8 @@ function myFunk(aaa, bbb) { } [#2 Range] = -[#2 Domain] = 0:15-0:25 - >----------< +[#2 Domain] = 0:16-0:24 + >--------< 0| function myFunk(aaa, bbb) { } diff --git a/data/fixtures/scopes/javascript.core/name.argument.formal.method.iteration.scope b/data/fixtures/scopes/javascript.core/name.argument.formal.method.iteration.scope index 1fc255002e..4291e12396 100644 --- a/data/fixtures/scopes/javascript.core/name.argument.formal.method.iteration.scope +++ b/data/fixtures/scopes/javascript.core/name.argument.formal.method.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:8-1:18 - >----------< +[#3 Domain] = 1:9-1:17 + >--------< 1| myFunk(aaa, bbb) { } diff --git a/data/fixtures/scopes/javascript.core/name.iteration.block.scope b/data/fixtures/scopes/javascript.core/name.iteration.block.scope new file mode 100644 index 0000000000..e1eb393319 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/name.iteration.block.scope @@ -0,0 +1,33 @@ +class MyClass { + myFunk() { } +} +--- + +[#1 Range] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| myFunk() { } +2| } + -< + + +[#2 Range] = +[#2 Domain] = 0:15-2:0 + > +0| class MyClass { +1| myFunk() { } +2| } + < + + +[#3 Range] = +[#3 Domain] = 1:11-1:11 + >< +1| myFunk() { } + + +[#4 Range] = +[#4 Domain] = 1:14-1:15 + >-< +1| myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/name.iteration.block2.scope b/data/fixtures/scopes/javascript.core/name.iteration.block2.scope new file mode 100644 index 0000000000..3cac5d8be0 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/name.iteration.block2.scope @@ -0,0 +1,19 @@ +function myFunk() { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:21 + >---------------------< +0| function myFunk() { } + + +[#2 Range] = +[#2 Domain] = 0:16-0:16 + >< +0| function myFunk() { } + + +[#3 Range] = +[#3 Domain] = 0:19-0:20 + >-< +0| function myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/name.iteration.block3.scope b/data/fixtures/scopes/javascript.core/name.iteration.block3.scope new file mode 100644 index 0000000000..d37573c3aa --- /dev/null +++ b/data/fixtures/scopes/javascript.core/name.iteration.block3.scope @@ -0,0 +1,22 @@ +if (true) { } +else { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-1:8 + >------------- +0| if (true) { } +1| else { } + --------< + + +[#2 Range] = +[#2 Domain] = 0:11-0:12 + >-< +0| if (true) { } + + +[#3 Range] = +[#3 Domain] = 1:6-1:7 + >-< +1| else { } diff --git a/data/fixtures/scopes/javascript.core/name.iteration.block4.scope b/data/fixtures/scopes/javascript.core/name.iteration.block4.scope new file mode 100644 index 0000000000..e38a055e01 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/name.iteration.block4.scope @@ -0,0 +1,13 @@ +while (true) { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:16 + >----------------< +0| while (true) { } + + +[#2 Range] = +[#2 Domain] = 0:14-0:15 + >-< +0| while (true) { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope new file mode 100644 index 0000000000..cb73f4ef7c --- /dev/null +++ b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope @@ -0,0 +1,27 @@ +class MyClass { + myFunk() { } +} +--- + +[#1 Range] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| myFunk() { } +2| } + -< + + +[#2 Range] = +[#2 Domain] = 0:15-2:0 + > +0| class MyClass { +1| myFunk() { } +2| } + < + + +[#3 Range] = +[#3 Domain] = 1:14-1:15 + >-< +1| myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block2.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block2.scope new file mode 100644 index 0000000000..da00f553fb --- /dev/null +++ b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block2.scope @@ -0,0 +1,13 @@ +function myFunk() { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:21 + >---------------------< +0| function myFunk() { } + + +[#2 Range] = +[#2 Domain] = 0:19-0:20 + >-< +0| function myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block3.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block3.scope new file mode 100644 index 0000000000..d37573c3aa --- /dev/null +++ b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block3.scope @@ -0,0 +1,22 @@ +if (true) { } +else { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-1:8 + >------------- +0| if (true) { } +1| else { } + --------< + + +[#2 Range] = +[#2 Domain] = 0:11-0:12 + >-< +0| if (true) { } + + +[#3 Range] = +[#3 Domain] = 1:6-1:7 + >-< +1| else { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block4.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block4.scope new file mode 100644 index 0000000000..e38a055e01 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block4.scope @@ -0,0 +1,13 @@ +while (true) { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:16 + >----------------< +0| while (true) { } + + +[#2 Range] = +[#2 Domain] = 0:14-0:15 + >-< +0| while (true) { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.document.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.document.scope index 8c374bbb0a..841a7ae10a 100644 --- a/data/fixtures/scopes/javascript.core/namedFunction.iteration.document.scope +++ b/data/fixtures/scopes/javascript.core/namedFunction.iteration.document.scope @@ -3,10 +3,16 @@ function myFunk() { } // After --- -[Range] = -[Domain] = 0:0-2:8 +[#1 Range] = +[#1 Domain] = 0:0-2:8 >--------- 0| // Before 1| function myFunk() { } 2| // After --------< + + +[#2 Range] = +[#2 Domain] = 1:19-1:20 + >-< +1| function myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope b/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope index 648d870dd9..28b792e309 100644 --- a/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope +++ b/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope @@ -3,10 +3,25 @@ class MyClass { } --- -[Range] = -[Domain] = 0:0-2:1 +[#1 Range] = +[#1 Domain] = 0:0-2:1 >--------------- 0| class MyClass { 1| myFunk() { } 2| } -< + + +[#2 Range] = +[#2 Domain] = 0:15-2:0 + > +0| class MyClass { +1| myFunk() { } +2| } + < + + +[#3 Range] = +[#3 Domain] = 1:12-1:13 + >-< +1| myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/value.argument.formal.constructor.iteration.scope b/data/fixtures/scopes/javascript.core/value.argument.formal.constructor.iteration.scope index 88ee3edd50..9b4a8f20b3 100644 --- a/data/fixtures/scopes/javascript.core/value.argument.formal.constructor.iteration.scope +++ b/data/fixtures/scopes/javascript.core/value.argument.formal.constructor.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:13-1:31 - >------------------< +[#3 Domain] = 1:14-1:30 + >----------------< 1| constructor(aaa = 0, bbb = 1) { } diff --git a/data/fixtures/scopes/javascript.core/value.argument.formal.iteration.scope b/data/fixtures/scopes/javascript.core/value.argument.formal.iteration.scope index 7f7efb4795..695b1da909 100644 --- a/data/fixtures/scopes/javascript.core/value.argument.formal.iteration.scope +++ b/data/fixtures/scopes/javascript.core/value.argument.formal.iteration.scope @@ -8,8 +8,8 @@ function myFunk(aaa = 0, bbb = 1) { } [#2 Range] = -[#2 Domain] = 0:15-0:33 - >------------------< +[#2 Domain] = 0:16-0:32 + >----------------< 0| function myFunk(aaa = 0, bbb = 1) { } diff --git a/data/fixtures/scopes/javascript.core/value.argument.formal.method.iteration.scope b/data/fixtures/scopes/javascript.core/value.argument.formal.method.iteration.scope index 894ada642a..c6fe878286 100644 --- a/data/fixtures/scopes/javascript.core/value.argument.formal.method.iteration.scope +++ b/data/fixtures/scopes/javascript.core/value.argument.formal.method.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:8-1:26 - >------------------< +[#3 Domain] = 1:9-1:25 + >----------------< 1| myFunk(aaa = 0, bbb = 1) { } diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index a153bc1e5a..19f2534b57 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -14,6 +14,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { pairDelimiter: supported, "collectionItem.unenclosed": supported, + "collectionItem.unenclosed.iteration": supported, "textFragment.string.singleLine": supported, "textFragment.string.multiLine": supported, @@ -28,7 +29,10 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "statement.class": supported, class: supported, + "class.iteration.document": supported, + className: supported, + "className.iteration.document": supported, anonymousFunction: supported, @@ -37,12 +41,14 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "namedFunction.method": supported, "namedFunction.method.iteration.class": supported, "namedFunction.constructor": supported, + "namedFunction.iteration.block": supported, functionName: supported, "functionName.iteration.document": supported, "functionName.method": supported, "functionName.method.iteration.class": supported, "functionName.constructor": supported, + "functionName.iteration.block": supported, functionCall: supported, "functionCall.constructor": supported, @@ -75,6 +81,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "branch.switchCase": supported, "branch.switchCase.iteration": supported, "branch.ternary": supported, + "branch.loop": supported, "condition.if": supported, "condition.while": supported, @@ -101,6 +108,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "name.class": supported, "name.field": supported, "name.iteration.document": supported, + "name.iteration.block": supported, "key.mapPair": supported, "key.mapPair.iteration": supported, @@ -124,18 +132,6 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { // Unsupported - "collectionItem.unenclosed.iteration": unsupported, - "branch.loop": unsupported, - "namedFunction.iteration.block": unsupported, - "functionName.iteration.block": unsupported, - - "class.iteration.block": unsupported, - "class.iteration.document": unsupported, - "className.iteration.block": unsupported, - "className.iteration.document": unsupported, - - "name.iteration.block": unsupported, - "interior.class": unsupported, "interior.function": unsupported, "interior.if": unsupported, @@ -147,6 +143,8 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { // Not applicable + "class.iteration.block": notApplicable, + "className.iteration.block": notApplicable, "interior.cell": notApplicable, "interior.command": notApplicable, "interior.resource": notApplicable, diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index d4ce227e94..1509e1e3ab 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -286,6 +286,13 @@ (#insertion-delimiter! @collectionItem ", ") ) +(lexical_declaration + . + (_) @collectionItem.iteration.start.startOf + (_) @collectionItem.iteration.end.endOf + . +) @collectionItem.iteration.domain + (expression_statement [ ;; name: @@ -415,10 +422,7 @@ right: (_) @value ) @_.domain -[ - (program) - (formal_parameters) -] @name.iteration @value.iteration @type.iteration +(program) @name.iteration @value.iteration @type.iteration ;; Treat interior of all bodies as iteration scopes for `name`, eg ;;!! function foo() { } @@ -564,6 +568,8 @@ ] ) @class @_.domain +(program) @class.iteration @className.iteration + ;;!! true ? 0 : 1; ;;! ^^^^ ;;! ^ ^ @@ -655,6 +661,23 @@ (#not-parent-type? @branch.iteration "else_clause") ) +(if_statement + (statement_block + . + "{" @namedFunction.iteration.start.endOf @functionName.iteration.start.endOf @name.iteration.start.endOf + "}" @namedFunction.iteration.end.startOf @functionName.iteration.end.startOf @name.iteration.end.startOf + . + ) +) +(else_clause + (statement_block + . + "{" @namedFunction.iteration.start.endOf @functionName.iteration.start.endOf @name.iteration.start.endOf + "}" @namedFunction.iteration.end.startOf @functionName.iteration.end.startOf @name.iteration.end.startOf + . + ) +) + ;;!! try () {} ;;! ^^^^^^^^^ (try_statement @@ -678,6 +701,13 @@ ;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (try_statement) @branch.iteration +[ + (for_statement) + (for_in_statement) + (while_statement) + (do_statement) +] @branch + ;;!! { value: 0 } ;;! ^^^^^ ;;! xxxxxxx @@ -769,6 +799,11 @@ ) ) @argumentOrParameter.iteration.domain +(formal_parameters + "(" @name.iteration.start.endOf @value.iteration.start.endOf @type.iteration.start.endOf + ")" @name.iteration.end.startOf @value.iteration.end.startOf @type.iteration.end.startOf +) + (arguments "(" @argumentOrParameter.iteration.start.endOf ")" @argumentOrParameter.iteration.end.startOf diff --git a/queries/javascript.function.scm b/queries/javascript.function.scm index 71d32e00f3..9fccb159ba 100644 --- a/queries/javascript.function.scm +++ b/queries/javascript.function.scm @@ -166,6 +166,18 @@ ) ] @namedFunction.iteration @functionName.iteration +;; Treat interior of all bodies as iteration scopes for `name`, eg +;;!! function foo() { } +;;! *** +(_ + body: (_ + . + "{" @namedFunction.iteration.start.endOf @functionName.iteration.start.endOf + "}" @namedFunction.iteration.end.startOf @functionName.iteration.end.startOf + . + ) +) + ;;!! { funk: function() { } } ;;! ^^^^ (pair From dcaafe99382d0ac210ad9809f99a7d658fe48646 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Wed, 16 Apr 2025 20:19:03 +0200 Subject: [PATCH 03/11] Update typescript fixtures --- .../type.argument.formal.constructor.iteration.scope | 4 ++-- .../typescript.core/type.argument.formal.iteration.scope | 4 ++-- .../type.argument.formal.method.iteration.scope | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.iteration.scope b/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.iteration.scope index 5f18a0f3fe..ee1db1a57c 100644 --- a/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.iteration.scope +++ b/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:13-1:28 - >---------------< +[#3 Domain] = 1:14-1:27 + >-------------< 1| constructor(value: number) { } diff --git a/data/fixtures/scopes/typescript.core/type.argument.formal.iteration.scope b/data/fixtures/scopes/typescript.core/type.argument.formal.iteration.scope index fda6c7495f..92ab7d8a14 100644 --- a/data/fixtures/scopes/typescript.core/type.argument.formal.iteration.scope +++ b/data/fixtures/scopes/typescript.core/type.argument.formal.iteration.scope @@ -8,8 +8,8 @@ function myFunk(value: number) { } [#2 Range] = -[#2 Domain] = 0:15-0:30 - >---------------< +[#2 Domain] = 0:16-0:29 + >-------------< 0| function myFunk(value: number) { } diff --git a/data/fixtures/scopes/typescript.core/type.argument.formal.method.iteration.scope b/data/fixtures/scopes/typescript.core/type.argument.formal.method.iteration.scope index 08ac6944fb..37197136f8 100644 --- a/data/fixtures/scopes/typescript.core/type.argument.formal.method.iteration.scope +++ b/data/fixtures/scopes/typescript.core/type.argument.formal.method.iteration.scope @@ -22,8 +22,8 @@ class MyClass { [#3 Range] = -[#3 Domain] = 1:8-1:23 - >---------------< +[#3 Domain] = 1:9-1:22 + >-------------< 1| myFunk(value: number) { } From feeb89a2b1dfe044e6508a8d7db084dc8d04073c Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Wed, 16 Apr 2025 20:40:08 +0200 Subject: [PATCH 04/11] Remove block iteration scope for classing --- .../functionName.iteration.block.scope | 6 ----- .../functionName.iteration.block2.scope | 13 ----------- .../functionName.iteration.block3.scope | 22 ------------------- .../functionName.iteration.block4.scope | 13 ----------- .../functionName.iteration.document.scope | 10 ++------- .../functionName.method.iteration.class.scope | 6 ----- .../name.iteration.block3.scope | 22 ------------------- .../namedFunction.iteration.block.scope | 6 ----- .../namedFunction.iteration.block2.scope | 13 ----------- .../namedFunction.iteration.block3.scope | 22 ------------------- .../namedFunction.iteration.block4.scope | 13 ----------- .../namedFunction.iteration.document.scope | 10 ++------- ...namedFunction.method.iteration.class.scope | 6 ----- queries/javascript.core.scm | 17 -------------- queries/javascript.function.scm | 15 +++++-------- 15 files changed, 9 insertions(+), 185 deletions(-) delete mode 100644 data/fixtures/scopes/javascript.core/functionName.iteration.block2.scope delete mode 100644 data/fixtures/scopes/javascript.core/functionName.iteration.block3.scope delete mode 100644 data/fixtures/scopes/javascript.core/functionName.iteration.block4.scope delete mode 100644 data/fixtures/scopes/javascript.core/name.iteration.block3.scope delete mode 100644 data/fixtures/scopes/javascript.core/namedFunction.iteration.block2.scope delete mode 100644 data/fixtures/scopes/javascript.core/namedFunction.iteration.block3.scope delete mode 100644 data/fixtures/scopes/javascript.core/namedFunction.iteration.block4.scope diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.block.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.block.scope index cb73f4ef7c..bbeb526cd5 100644 --- a/data/fixtures/scopes/javascript.core/functionName.iteration.block.scope +++ b/data/fixtures/scopes/javascript.core/functionName.iteration.block.scope @@ -19,9 +19,3 @@ class MyClass { 1| myFunk() { } 2| } < - - -[#3 Range] = -[#3 Domain] = 1:14-1:15 - >-< -1| myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.block2.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.block2.scope deleted file mode 100644 index da00f553fb..0000000000 --- a/data/fixtures/scopes/javascript.core/functionName.iteration.block2.scope +++ /dev/null @@ -1,13 +0,0 @@ -function myFunk() { } ---- - -[#1 Range] = -[#1 Domain] = 0:0-0:21 - >---------------------< -0| function myFunk() { } - - -[#2 Range] = -[#2 Domain] = 0:19-0:20 - >-< -0| function myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.block3.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.block3.scope deleted file mode 100644 index d37573c3aa..0000000000 --- a/data/fixtures/scopes/javascript.core/functionName.iteration.block3.scope +++ /dev/null @@ -1,22 +0,0 @@ -if (true) { } -else { } ---- - -[#1 Range] = -[#1 Domain] = 0:0-1:8 - >------------- -0| if (true) { } -1| else { } - --------< - - -[#2 Range] = -[#2 Domain] = 0:11-0:12 - >-< -0| if (true) { } - - -[#3 Range] = -[#3 Domain] = 1:6-1:7 - >-< -1| else { } diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.block4.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.block4.scope deleted file mode 100644 index e38a055e01..0000000000 --- a/data/fixtures/scopes/javascript.core/functionName.iteration.block4.scope +++ /dev/null @@ -1,13 +0,0 @@ -while (true) { } ---- - -[#1 Range] = -[#1 Domain] = 0:0-0:16 - >----------------< -0| while (true) { } - - -[#2 Range] = -[#2 Domain] = 0:14-0:15 - >-< -0| while (true) { } diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.document.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.document.scope index 841a7ae10a..8c374bbb0a 100644 --- a/data/fixtures/scopes/javascript.core/functionName.iteration.document.scope +++ b/data/fixtures/scopes/javascript.core/functionName.iteration.document.scope @@ -3,16 +3,10 @@ function myFunk() { } // After --- -[#1 Range] = -[#1 Domain] = 0:0-2:8 +[Range] = +[Domain] = 0:0-2:8 >--------- 0| // Before 1| function myFunk() { } 2| // After --------< - - -[#2 Range] = -[#2 Domain] = 1:19-1:20 - >-< -1| function myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope b/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope index 28b792e309..6f6128c677 100644 --- a/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope +++ b/data/fixtures/scopes/javascript.core/functionName.method.iteration.class.scope @@ -19,9 +19,3 @@ class MyClass { 1| myFunk() { } 2| } < - - -[#3 Range] = -[#3 Domain] = 1:12-1:13 - >-< -1| myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/name.iteration.block3.scope b/data/fixtures/scopes/javascript.core/name.iteration.block3.scope deleted file mode 100644 index d37573c3aa..0000000000 --- a/data/fixtures/scopes/javascript.core/name.iteration.block3.scope +++ /dev/null @@ -1,22 +0,0 @@ -if (true) { } -else { } ---- - -[#1 Range] = -[#1 Domain] = 0:0-1:8 - >------------- -0| if (true) { } -1| else { } - --------< - - -[#2 Range] = -[#2 Domain] = 0:11-0:12 - >-< -0| if (true) { } - - -[#3 Range] = -[#3 Domain] = 1:6-1:7 - >-< -1| else { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope index cb73f4ef7c..bbeb526cd5 100644 --- a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope +++ b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope @@ -19,9 +19,3 @@ class MyClass { 1| myFunk() { } 2| } < - - -[#3 Range] = -[#3 Domain] = 1:14-1:15 - >-< -1| myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block2.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block2.scope deleted file mode 100644 index da00f553fb..0000000000 --- a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block2.scope +++ /dev/null @@ -1,13 +0,0 @@ -function myFunk() { } ---- - -[#1 Range] = -[#1 Domain] = 0:0-0:21 - >---------------------< -0| function myFunk() { } - - -[#2 Range] = -[#2 Domain] = 0:19-0:20 - >-< -0| function myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block3.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block3.scope deleted file mode 100644 index d37573c3aa..0000000000 --- a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block3.scope +++ /dev/null @@ -1,22 +0,0 @@ -if (true) { } -else { } ---- - -[#1 Range] = -[#1 Domain] = 0:0-1:8 - >------------- -0| if (true) { } -1| else { } - --------< - - -[#2 Range] = -[#2 Domain] = 0:11-0:12 - >-< -0| if (true) { } - - -[#3 Range] = -[#3 Domain] = 1:6-1:7 - >-< -1| else { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block4.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block4.scope deleted file mode 100644 index e38a055e01..0000000000 --- a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block4.scope +++ /dev/null @@ -1,13 +0,0 @@ -while (true) { } ---- - -[#1 Range] = -[#1 Domain] = 0:0-0:16 - >----------------< -0| while (true) { } - - -[#2 Range] = -[#2 Domain] = 0:14-0:15 - >-< -0| while (true) { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.document.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.document.scope index 841a7ae10a..8c374bbb0a 100644 --- a/data/fixtures/scopes/javascript.core/namedFunction.iteration.document.scope +++ b/data/fixtures/scopes/javascript.core/namedFunction.iteration.document.scope @@ -3,16 +3,10 @@ function myFunk() { } // After --- -[#1 Range] = -[#1 Domain] = 0:0-2:8 +[Range] = +[Domain] = 0:0-2:8 >--------- 0| // Before 1| function myFunk() { } 2| // After --------< - - -[#2 Range] = -[#2 Domain] = 1:19-1:20 - >-< -1| function myFunk() { } diff --git a/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope b/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope index 28b792e309..6f6128c677 100644 --- a/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope +++ b/data/fixtures/scopes/javascript.core/namedFunction.method.iteration.class.scope @@ -19,9 +19,3 @@ class MyClass { 1| myFunk() { } 2| } < - - -[#3 Range] = -[#3 Domain] = 1:12-1:13 - >-< -1| myFunk() { } diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index 1509e1e3ab..a8cb15a024 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -661,23 +661,6 @@ (#not-parent-type? @branch.iteration "else_clause") ) -(if_statement - (statement_block - . - "{" @namedFunction.iteration.start.endOf @functionName.iteration.start.endOf @name.iteration.start.endOf - "}" @namedFunction.iteration.end.startOf @functionName.iteration.end.startOf @name.iteration.end.startOf - . - ) -) -(else_clause - (statement_block - . - "{" @namedFunction.iteration.start.endOf @functionName.iteration.start.endOf @name.iteration.start.endOf - "}" @namedFunction.iteration.end.startOf @functionName.iteration.end.startOf @name.iteration.end.startOf - . - ) -) - ;;!! try () {} ;;! ^^^^^^^^^ (try_statement diff --git a/queries/javascript.function.scm b/queries/javascript.function.scm index 9fccb159ba..1253d4979d 100644 --- a/queries/javascript.function.scm +++ b/queries/javascript.function.scm @@ -166,16 +166,11 @@ ) ] @namedFunction.iteration @functionName.iteration -;; Treat interior of all bodies as iteration scopes for `name`, eg -;;!! function foo() { } -;;! *** -(_ - body: (_ - . - "{" @namedFunction.iteration.start.endOf @functionName.iteration.start.endOf - "}" @namedFunction.iteration.end.startOf @functionName.iteration.end.startOf - . - ) +(class_body + . + "{" @namedFunction.iteration.start.endOf @functionName.iteration.start.endOf + "}" @namedFunction.iteration.end.startOf @functionName.iteration.end.startOf + . ) ;;!! { funk: function() { } } From 61e0a837fb97f6b317599f9a43bc093a808a85ed Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Wed, 16 Apr 2025 20:49:53 +0200 Subject: [PATCH 05/11] Added not applicable to typescript --- .../common/src/scopeSupportFacets/typescript.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/common/src/scopeSupportFacets/typescript.ts b/packages/common/src/scopeSupportFacets/typescript.ts index 9e259a71b1..6577074329 100644 --- a/packages/common/src/scopeSupportFacets/typescript.ts +++ b/packages/common/src/scopeSupportFacets/typescript.ts @@ -2,7 +2,7 @@ import { javascriptCoreScopeSupport } from "./javascript"; import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types"; import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types"; -const { supported } = ScopeSupportFacetLevel; +const { supported, notApplicable } = ScopeSupportFacetLevel; export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { ...javascriptCoreScopeSupport, @@ -22,4 +22,15 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { "type.variable": supported, "value.typeAlias": supported, + + // Not applicable + + element: notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + attribute: notApplicable, + "key.attribute": notApplicable, + "value.attribute": notApplicable, + "interior.element": notApplicable, }; From d37b90635721fedebde2bbd9e93689e29596a6b2 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Wed, 16 Apr 2025 20:58:04 +0200 Subject: [PATCH 06/11] Added missing unsupported for typescripts --- packages/common/src/scopeSupportFacets/typescript.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/common/src/scopeSupportFacets/typescript.ts b/packages/common/src/scopeSupportFacets/typescript.ts index 6577074329..2387f1819e 100644 --- a/packages/common/src/scopeSupportFacets/typescript.ts +++ b/packages/common/src/scopeSupportFacets/typescript.ts @@ -2,7 +2,7 @@ import { javascriptCoreScopeSupport } from "./javascript"; import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types"; import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types"; -const { supported, notApplicable } = ScopeSupportFacetLevel; +const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel; export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { ...javascriptCoreScopeSupport, @@ -23,6 +23,14 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { "value.typeAlias": supported, + // Unsupported + + "type.class": unsupported, + "type.field.iteration": unsupported, + "type.foreach": unsupported, + "type.typeArgument": unsupported, + "type.typeArgument.iteration": unsupported, + // Not applicable element: notApplicable, From caff249069b87fd1c387fed6c338632f6fa64e19 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 20 Apr 2025 11:16:54 +0200 Subject: [PATCH 07/11] Class type --- .../scopes/javascript.core/class.scope | 13 ++-- .../scopes/javascript.core/class2.scope | 10 +++ .../scopes/javascript.core/class3.scope | 10 +++ .../scopes/javascript.core/type.class.scope | 10 +++ .../scopes/typescript.core/class.scope | 10 +++ .../scopes/typescript.core/class2.scope | 10 +++ .../scopes/typescript.core/class3.scope | 10 +++ .../type.argument.formal.constructor.scope | 22 +++++-- .../type.argument.formal.method.scope | 22 +++++-- .../scopes/typescript.core/type.class.scope | 10 +++ .../scopes/typescript.core/type.field.scope | 66 ++++++++++++------- .../src/scopeSupportFacets/javascript.ts | 3 +- .../src/scopeSupportFacets/typescript.ts | 3 +- queries/javascript.core.scm | 4 +- queries/typescript.core.scm | 4 +- 15 files changed, 156 insertions(+), 51 deletions(-) create mode 100644 data/fixtures/scopes/javascript.core/class2.scope create mode 100644 data/fixtures/scopes/javascript.core/class3.scope create mode 100644 data/fixtures/scopes/javascript.core/type.class.scope create mode 100644 data/fixtures/scopes/typescript.core/class.scope create mode 100644 data/fixtures/scopes/typescript.core/class2.scope create mode 100644 data/fixtures/scopes/typescript.core/class3.scope create mode 100644 data/fixtures/scopes/typescript.core/type.class.scope diff --git a/data/fixtures/scopes/javascript.core/class.scope b/data/fixtures/scopes/javascript.core/class.scope index 9b0eef7978..e6a25b8f55 100644 --- a/data/fixtures/scopes/javascript.core/class.scope +++ b/data/fixtures/scopes/javascript.core/class.scope @@ -1,15 +1,10 @@ -class MyClass { - -} +class MyClass { } --- [Content] = [Removal] = -[Domain] = 0:0-2:1 - >--------------- -0| class MyClass { -1| -2| } - -< +[Domain] = 0:0-0:17 + >-----------------< +0| class MyClass { } [Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/javascript.core/class2.scope b/data/fixtures/scopes/javascript.core/class2.scope new file mode 100644 index 0000000000..cb0026603b --- /dev/null +++ b/data/fixtures/scopes/javascript.core/class2.scope @@ -0,0 +1,10 @@ +export default class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:32 + >--------------------------------< +0| export default class MyClass { } + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/javascript.core/class3.scope b/data/fixtures/scopes/javascript.core/class3.scope new file mode 100644 index 0000000000..aa5deaa1e1 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/class3.scope @@ -0,0 +1,10 @@ +export class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:24 + >------------------------< +0| export class MyClass { } + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/javascript.core/type.class.scope b/data/fixtures/scopes/javascript.core/type.class.scope new file mode 100644 index 0000000000..696dd5c641 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/type.class.scope @@ -0,0 +1,10 @@ +class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:17 + >-----------------< +0| class MyClass { } + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/class.scope b/data/fixtures/scopes/typescript.core/class.scope new file mode 100644 index 0000000000..c68e199ef9 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/class.scope @@ -0,0 +1,10 @@ +abstract class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:26 + >--------------------------< +0| abstract class MyClass { } + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/typescript.core/class2.scope b/data/fixtures/scopes/typescript.core/class2.scope new file mode 100644 index 0000000000..5b46f476c7 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/class2.scope @@ -0,0 +1,10 @@ +export default abstract class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:41 + >-----------------------------------------< +0| export default abstract class MyClass { } + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/typescript.core/class3.scope b/data/fixtures/scopes/typescript.core/class3.scope new file mode 100644 index 0000000000..104ca4a34f --- /dev/null +++ b/data/fixtures/scopes/typescript.core/class3.scope @@ -0,0 +1,10 @@ +export abstract class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:33 + >---------------------------------< +0| export abstract class MyClass { } + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.scope b/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.scope index af2d709f74..105bedcb56 100644 --- a/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.scope +++ b/data/fixtures/scopes/typescript.core/type.argument.formal.constructor.scope @@ -3,20 +3,32 @@ class MyClass { } --- -[Content] = 1:21-1:27 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| constructor(value: number) { } +2| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:21-1:27 >------< 1| constructor(value: number) { } -[Removal] = 1:19-1:27 +[#2 Removal] = 1:19-1:27 >--------< 1| constructor(value: number) { } -[Leading delimiter] = 1:19-1:21 +[#2 Leading delimiter] = 1:19-1:21 >--< 1| constructor(value: number) { } -[Domain] = 1:14-1:27 +[#2 Domain] = 1:14-1:27 >-------------< 1| constructor(value: number) { } -[Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/type.argument.formal.method.scope b/data/fixtures/scopes/typescript.core/type.argument.formal.method.scope index e81e0e5d59..417343e4f3 100644 --- a/data/fixtures/scopes/typescript.core/type.argument.formal.method.scope +++ b/data/fixtures/scopes/typescript.core/type.argument.formal.method.scope @@ -3,20 +3,32 @@ class MyClass { } --- -[Content] = 1:16-1:22 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| myFunk(value: number) { } +2| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:16-1:22 >------< 1| myFunk(value: number) { } -[Removal] = 1:14-1:22 +[#2 Removal] = 1:14-1:22 >--------< 1| myFunk(value: number) { } -[Leading delimiter] = 1:14-1:16 +[#2 Leading delimiter] = 1:14-1:16 >--< 1| myFunk(value: number) { } -[Domain] = 1:9-1:22 +[#2 Domain] = 1:9-1:22 >-------------< 1| myFunk(value: number) { } -[Insertion delimiter] = " " +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/type.class.scope b/data/fixtures/scopes/typescript.core/type.class.scope new file mode 100644 index 0000000000..3ccc5da772 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/type.class.scope @@ -0,0 +1,10 @@ +abstract class MyClass { } +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:26 + >--------------------------< +0| abstract class MyClass { } + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript.core/type.field.scope b/data/fixtures/scopes/typescript.core/type.field.scope index e2ec66651e..76b55f00ea 100644 --- a/data/fixtures/scopes/typescript.core/type.field.scope +++ b/data/fixtures/scopes/typescript.core/type.field.scope @@ -7,96 +7,112 @@ class Aaa { } --- -[#1 Content] = 1:10-1:16 +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-6:1 + >----------- +0| class Aaa { +1| bbb!: string = undefined; +2| ccc: string = undefined; +3| private eee!: string = undefined; +4| eee: string; +5| fff!: string; +6| } + -< + +[#1 Insertion delimiter] = " " + + +[#2 Content] = 1:10-1:16 >------< 1| bbb!: string = undefined; -[#1 Removal] = 1:7-1:16 +[#2 Removal] = 1:7-1:16 >---------< 1| bbb!: string = undefined; -[#1 Leading delimiter] = 1:7-1:10 +[#2 Leading delimiter] = 1:7-1:10 >---< 1| bbb!: string = undefined; -[#1 Domain] = 1:4-1:29 +[#2 Domain] = 1:4-1:29 >-------------------------< 1| bbb!: string = undefined; -[#1 Insertion delimiter] = " " +[#2 Insertion delimiter] = " " -[#2 Content] = 2:9-2:15 +[#3 Content] = 2:9-2:15 >------< 2| ccc: string = undefined; -[#2 Removal] = 2:7-2:15 +[#3 Removal] = 2:7-2:15 >--------< 2| ccc: string = undefined; -[#2 Leading delimiter] = 2:7-2:9 +[#3 Leading delimiter] = 2:7-2:9 >--< 2| ccc: string = undefined; -[#2 Domain] = 2:4-2:28 +[#3 Domain] = 2:4-2:28 >------------------------< 2| ccc: string = undefined; -[#2 Insertion delimiter] = " " +[#3 Insertion delimiter] = " " -[#3 Content] = 3:18-3:24 +[#4 Content] = 3:18-3:24 >------< 3| private eee!: string = undefined; -[#3 Removal] = 3:15-3:24 +[#4 Removal] = 3:15-3:24 >---------< 3| private eee!: string = undefined; -[#3 Leading delimiter] = 3:15-3:18 +[#4 Leading delimiter] = 3:15-3:18 >---< 3| private eee!: string = undefined; -[#3 Domain] = 3:4-3:37 +[#4 Domain] = 3:4-3:37 >---------------------------------< 3| private eee!: string = undefined; -[#3 Insertion delimiter] = " " +[#4 Insertion delimiter] = " " -[#4 Content] = 4:9-4:15 +[#5 Content] = 4:9-4:15 >------< 4| eee: string; -[#4 Removal] = 4:7-4:15 +[#5 Removal] = 4:7-4:15 >--------< 4| eee: string; -[#4 Leading delimiter] = 4:7-4:9 +[#5 Leading delimiter] = 4:7-4:9 >--< 4| eee: string; -[#4 Domain] = 4:4-4:16 +[#5 Domain] = 4:4-4:16 >------------< 4| eee: string; -[#4 Insertion delimiter] = " " +[#5 Insertion delimiter] = " " -[#5 Content] = 5:10-5:16 +[#6 Content] = 5:10-5:16 >------< 5| fff!: string; -[#5 Removal] = 5:7-5:16 +[#6 Removal] = 5:7-5:16 >---------< 5| fff!: string; -[#5 Leading delimiter] = 5:7-5:10 +[#6 Leading delimiter] = 5:7-5:10 >---< 5| fff!: string; -[#5 Domain] = 5:4-5:17 +[#6 Domain] = 5:4-5:17 >-------------< 5| fff!: string; -[#5 Insertion delimiter] = " " +[#6 Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index 19f2534b57..0b9292fb0b 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -130,6 +130,8 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "value.field": supported, "value.yield": supported, + "type.class": supported, + // Unsupported "interior.class": unsupported, @@ -193,7 +195,6 @@ export const javascriptScopeSupport: LanguageScopeSupportFacetMap = { "type.argument.formal.method": notApplicable, "type.argument.formal": notApplicable, "type.cast": notApplicable, - "type.class": notApplicable, "type.enum": notApplicable, "type.field.iteration": notApplicable, "type.field": notApplicable, diff --git a/packages/common/src/scopeSupportFacets/typescript.ts b/packages/common/src/scopeSupportFacets/typescript.ts index 2387f1819e..e7364ab8ca 100644 --- a/packages/common/src/scopeSupportFacets/typescript.ts +++ b/packages/common/src/scopeSupportFacets/typescript.ts @@ -25,9 +25,7 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { // Unsupported - "type.class": unsupported, "type.field.iteration": unsupported, - "type.foreach": unsupported, "type.typeArgument": unsupported, "type.typeArgument.iteration": unsupported, @@ -40,5 +38,6 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { attribute: notApplicable, "key.attribute": notApplicable, "value.attribute": notApplicable, + "type.foreach": notApplicable, "interior.element": notApplicable, }; diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index a8cb15a024..189642047d 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -551,7 +551,7 @@ (class name: (_) @className ) - ] @class @_.domain + ] @class @type @_.domain (#not-parent-type? @class export_statement) ) @@ -566,7 +566,7 @@ name: (_) @className ) ] -) @class @_.domain +) @class @type @_.domain (program) @class.iteration @className.iteration diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index fa655fe672..4c0a2035a4 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -335,7 +335,7 @@ ( (abstract_class_declaration name: (_) @className - ) @class @_.domain + ) @class @type @_.domain (#not-parent-type? @class export_statement) ) @@ -345,7 +345,7 @@ (abstract_class_declaration name: (_) @className ) -) @class @_.domain +) @class @type @_.domain ;;!! class MyClass {} ;;! ^^^^^^^ From f132dd3f1b06d3116c5859461976da55cc580ffa Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 20 Apr 2025 11:26:05 +0200 Subject: [PATCH 08/11] type field iteration --- .../typescript.core/type.field.iteration.scope | 13 +++++++++++++ .../common/src/scopeSupportFacets/typescript.ts | 2 +- queries/typescript.core.scm | 7 +++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 data/fixtures/scopes/typescript.core/type.field.iteration.scope diff --git a/data/fixtures/scopes/typescript.core/type.field.iteration.scope b/data/fixtures/scopes/typescript.core/type.field.iteration.scope new file mode 100644 index 0000000000..a9bd7ec26f --- /dev/null +++ b/data/fixtures/scopes/typescript.core/type.field.iteration.scope @@ -0,0 +1,13 @@ +class MyClass { } +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:17 + >-----------------< +0| class MyClass { } + + +[#2 Range] = +[#2 Domain] = 0:15-0:16 + >-< +0| class MyClass { } diff --git a/packages/common/src/scopeSupportFacets/typescript.ts b/packages/common/src/scopeSupportFacets/typescript.ts index e7364ab8ca..c696f85046 100644 --- a/packages/common/src/scopeSupportFacets/typescript.ts +++ b/packages/common/src/scopeSupportFacets/typescript.ts @@ -16,6 +16,7 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { "type.alias": supported, "type.cast": supported, "type.field": supported, + "type.field.iteration": supported, "type.interface": supported, "type.enum": supported, "type.return": supported, @@ -25,7 +26,6 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { // Unsupported - "type.field.iteration": unsupported, "type.typeArgument": unsupported, "type.typeArgument.iteration": unsupported, diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index 4c0a2035a4..92b362bf32 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -405,3 +405,10 @@ (function_type "=>" @disqualifyDelimiter ) + +(class_body + . + "{" @type.iteration.start.endOf + "}" @type.iteration.end.startOf + . +) From f0c3aabd1f32b3f580d2c473b8a4fd6b5a1df440 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 20 Apr 2025 11:38:37 +0200 Subject: [PATCH 09/11] Type arguments --- .../type.typeArgument.iteration.scope | 13 ++++++ .../typescript.core/type.typeArgument.scope | 45 +++++++++++++++++++ .../scopes/typescript/type.cast.scope | 17 +++++-- .../src/scopeSupportFacets/typescript.ts | 9 ++-- queries/java.scm | 1 + queries/typescript.core.scm | 17 +++++++ 6 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 data/fixtures/scopes/typescript.core/type.typeArgument.iteration.scope create mode 100644 data/fixtures/scopes/typescript.core/type.typeArgument.scope diff --git a/data/fixtures/scopes/typescript.core/type.typeArgument.iteration.scope b/data/fixtures/scopes/typescript.core/type.typeArgument.iteration.scope new file mode 100644 index 0000000000..11833db77c --- /dev/null +++ b/data/fixtures/scopes/typescript.core/type.typeArgument.iteration.scope @@ -0,0 +1,13 @@ +let value: Map; +--- + +[#1 Range] = +[#1 Domain] = 0:0-0:31 + >-------------------------------< +0| let value: Map; + + +[#2 Range] = +[#2 Domain] = 0:15-0:29 + >--------------< +0| let value: Map; diff --git a/data/fixtures/scopes/typescript.core/type.typeArgument.scope b/data/fixtures/scopes/typescript.core/type.typeArgument.scope new file mode 100644 index 0000000000..af00e8f116 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/type.typeArgument.scope @@ -0,0 +1,45 @@ +let value: Map; +--- + +[#1 Content] = 0:11-0:30 + >-------------------< +0| let value: Map; + +[#1 Removal] = 0:9-0:30 + >---------------------< +0| let value: Map; + +[#1 Leading delimiter] = 0:10-0:11 + >-< +0| let value: Map; + +[#1 Domain] = 0:0-0:31 + >-------------------------------< +0| let value: Map; + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 0:15-0:21 + >------< +0| let value: Map; + +[#2 Insertion delimiter] = " " + + +[#3 Content] = +[#3 Domain] = 0:23-0:29 + >------< +0| let value: Map; + +[#3 Removal] = 0:22-0:29 + >-------< +0| let value: Map; + +[#3 Leading delimiter] = 0:22-0:23 + >-< +0| let value: Map; + +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/typescript/type.cast.scope b/data/fixtures/scopes/typescript/type.cast.scope index 1aa9a73ae6..f3e42b3880 100644 --- a/data/fixtures/scopes/typescript/type.cast.scope +++ b/data/fixtures/scopes/typescript/type.cast.scope @@ -1,16 +1,25 @@ bbb --- -[Content] = 0:1-0:4 +[#1 Content] = 0:1-0:4 >---< 0| bbb -[Removal] = 0:0-0:5 +[#1 Removal] = 0:0-0:5 >-----< 0| bbb -[Domain] = 0:0-0:8 +[#1 Domain] = 0:0-0:8 >--------< 0| bbb -[Insertion delimiter] = " " +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 0:1-0:4 + >---< +0| bbb + +[#2 Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/typescript.ts b/packages/common/src/scopeSupportFacets/typescript.ts index c696f85046..58001edb3c 100644 --- a/packages/common/src/scopeSupportFacets/typescript.ts +++ b/packages/common/src/scopeSupportFacets/typescript.ts @@ -2,7 +2,7 @@ import { javascriptCoreScopeSupport } from "./javascript"; import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types"; import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types"; -const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel; +const { supported, notApplicable } = ScopeSupportFacetLevel; export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { ...javascriptCoreScopeSupport, @@ -21,14 +21,11 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = { "type.enum": supported, "type.return": supported, "type.variable": supported, + "type.typeArgument": supported, + "type.typeArgument.iteration": supported, "value.typeAlias": supported, - // Unsupported - - "type.typeArgument": unsupported, - "type.typeArgument.iteration": unsupported, - // Not applicable element: notApplicable, diff --git a/queries/java.scm b/queries/java.scm index 7650d05ee1..10de4ea448 100644 --- a/queries/java.scm +++ b/queries/java.scm @@ -495,6 +495,7 @@ ">" @type.iteration.end.startOf . ) + ;;!! foo(name: string) {} ;;! ^^^^^^^^^^^^ ( diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index 92b362bf32..b295abb2b4 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -406,9 +406,26 @@ "=>" @disqualifyDelimiter ) +;;!! class Aaa { } +;;! ^ (class_body . "{" @type.iteration.start.endOf "}" @type.iteration.end.startOf . ) + +;;!! Map +;;! ^^^^^^ ^^^^^^ +(type_arguments + (_) @type +) + +;;!! Map +;;! ^^^^^^^^^^^^^^ +(type_arguments + . + "<" @type.iteration.start.endOf + ">" @type.iteration.end.startOf + . +) From ebc58a6f9d5ae4af4d1d07a5f33e523f4e679941 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 20 Apr 2025 11:57:13 +0200 Subject: [PATCH 10/11] cast match --- .../scopes/typescript/type.cast.scope | 17 ++++------------ queries/typescript.core.scm | 20 ++++++++++++------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/data/fixtures/scopes/typescript/type.cast.scope b/data/fixtures/scopes/typescript/type.cast.scope index f3e42b3880..1aa9a73ae6 100644 --- a/data/fixtures/scopes/typescript/type.cast.scope +++ b/data/fixtures/scopes/typescript/type.cast.scope @@ -1,25 +1,16 @@ bbb --- -[#1 Content] = 0:1-0:4 +[Content] = 0:1-0:4 >---< 0| bbb -[#1 Removal] = 0:0-0:5 +[Removal] = 0:0-0:5 >-----< 0| bbb -[#1 Domain] = 0:0-0:8 +[Domain] = 0:0-0:8 >--------< 0| bbb -[#1 Insertion delimiter] = " " - - -[#2 Content] = -[#2 Removal] = -[#2 Domain] = 0:1-0:4 - >---< -0| bbb - -[#2 Insertion delimiter] = " " +[Insertion delimiter] = " " diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index b295abb2b4..382572ac0d 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -417,15 +417,21 @@ ;;!! Map ;;! ^^^^^^ ^^^^^^ -(type_arguments - (_) @type +( + (type_arguments + (_) @type + ) @_dummy + (#not-parent-type? @_dummy type_assertion) ) ;;!! Map ;;! ^^^^^^^^^^^^^^ -(type_arguments - . - "<" @type.iteration.start.endOf - ">" @type.iteration.end.startOf - . +( + (type_arguments + . + "<" @type.iteration.start.endOf + ">" @type.iteration.end.startOf + . + ) @_dummy + (#not-parent-type? @_dummy type_assertion) ) From ada6a75c82be3451efbc31e2dce1c127f13b3f99 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 21 Apr 2025 04:50:35 +0200 Subject: [PATCH 11/11] Remove block --- .../functionName.iteration.block.scope | 21 ------------------- .../namedFunction.iteration.block.scope | 21 ------------------- .../src/scopeSupportFacets/javascript.ts | 4 ++-- 3 files changed, 2 insertions(+), 44 deletions(-) delete mode 100644 data/fixtures/scopes/javascript.core/functionName.iteration.block.scope delete mode 100644 data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope diff --git a/data/fixtures/scopes/javascript.core/functionName.iteration.block.scope b/data/fixtures/scopes/javascript.core/functionName.iteration.block.scope deleted file mode 100644 index bbeb526cd5..0000000000 --- a/data/fixtures/scopes/javascript.core/functionName.iteration.block.scope +++ /dev/null @@ -1,21 +0,0 @@ -class MyClass { - myFunk() { } -} ---- - -[#1 Range] = -[#1 Domain] = 0:0-2:1 - >--------------- -0| class MyClass { -1| myFunk() { } -2| } - -< - - -[#2 Range] = -[#2 Domain] = 0:15-2:0 - > -0| class MyClass { -1| myFunk() { } -2| } - < diff --git a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope b/data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope deleted file mode 100644 index bbeb526cd5..0000000000 --- a/data/fixtures/scopes/javascript.core/namedFunction.iteration.block.scope +++ /dev/null @@ -1,21 +0,0 @@ -class MyClass { - myFunk() { } -} ---- - -[#1 Range] = -[#1 Domain] = 0:0-2:1 - >--------------- -0| class MyClass { -1| myFunk() { } -2| } - -< - - -[#2 Range] = -[#2 Domain] = 0:15-2:0 - > -0| class MyClass { -1| myFunk() { } -2| } - < diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index 0b9292fb0b..636f717e98 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -41,14 +41,12 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "namedFunction.method": supported, "namedFunction.method.iteration.class": supported, "namedFunction.constructor": supported, - "namedFunction.iteration.block": supported, functionName: supported, "functionName.iteration.document": supported, "functionName.method": supported, "functionName.method.iteration.class": supported, "functionName.constructor": supported, - "functionName.iteration.block": supported, functionCall: supported, "functionCall.constructor": supported, @@ -147,6 +145,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "class.iteration.block": notApplicable, "className.iteration.block": notApplicable, + "functionName.iteration.block": notApplicable, "interior.cell": notApplicable, "interior.command": notApplicable, "interior.resource": notApplicable, @@ -154,6 +153,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.actual": notApplicable, "name.resource.iteration": notApplicable, "name.resource": notApplicable, + "namedFunction.iteration.block": notApplicable, "section.iteration.document": notApplicable, "section.iteration.parent": notApplicable, "textFragment.element": notApplicable,