Skip to content

Commit

Permalink
Add "name" / "value" support for Python with (#2162)
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey authored Jan 31, 2024
1 parent d228144 commit 09c28c8
Show file tree
Hide file tree
Showing 15 changed files with 629 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/common/src/scopeSupportFacets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ const { supported, supportedLegacy, notApplicable } = ScopeSupportFacetLevel;

export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
"name.foreach": supported,
"name.resource": supported,
"name.resource.iteration": supported,
"value.foreach": supported,
"value.resource": supported,
"value.resource.iteration": supported,

"argument.actual": supportedLegacy,
"argument.actual.iteration": supportedLegacy,
Expand Down
20 changes: 20 additions & 0 deletions packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,16 @@ export const scopeSupportFacetInfos: Record<
description: "Name (LHS) of a field in a class / interface",
scopeType: "name",
},
"name.resource": {
description: "Name in a 'with' / 'use' / 'using' statement",
scopeType: "name",
},
"name.resource.iteration": {
description:
"Iteration scope for names in a 'with' / 'use' / 'using' statement",
scopeType: "name",
isIteration: true,
},

"key.attribute": {
description: "Key (LHS) of an attribute eg in an xml element",
Expand Down Expand Up @@ -289,6 +299,16 @@ export const scopeSupportFacetInfos: Record<
description: "Value (RHS) of a field in a class / interface",
scopeType: "value",
},
"value.resource": {
description: "Value of a 'with' / 'use' / 'using' statement",
scopeType: "value",
},
"value.resource.iteration": {
description:
"Iteration scope for values in a 'with' / 'use' / 'using' statement",
scopeType: "value",
isIteration: true,
},

"type.assignment": {
description: "Type of variable in an assignment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ const scopeSupportFacets = [
"name.function",
"name.class",
"name.field",
"name.resource",
"name.resource.iteration",

"key.attribute",
"key.mapPair",
Expand All @@ -76,6 +78,8 @@ const scopeSupportFacets = [
"value.return",
"value.return.lambda",
"value.field",
"value.resource",
"value.resource.iteration",

"type.assignment",
"type.formalParameter",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
with aaa, bbb as ccc:
pass
---

[#1 Range] = 0:5-0:20
0| with aaa, bbb as ccc:
>---------------<

[#1 Domain] = 0:0-1:8
0| with aaa, bbb as ccc:
>---------------------
1| pass
--------<


[#2 Range] =
[#2 Domain] = 1:4-1:8
1| pass
>----<
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
with aaa as bbb:
pass
---

[Content] = 0:12-0:15
0| with aaa as bbb:
>---<

[Removal] = 0:8-0:15
0| with aaa as bbb:
>-------<

[Leading delimiter] = 0:8-0:12
0| with aaa as bbb:
>----<

[Domain] = 0:0-1:8
0| with aaa as bbb:
>----------------
1| pass
--------<

[Insertion delimiter] = " "
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
with aaa, bbb as ccc:
pass
---

[#1.1 Content] = 0:5-0:8
0| with aaa, bbb as ccc:
>---<

[#1.1 Removal] = 0:5-0:10
0| with aaa, bbb as ccc:
>-----<

[#1.1 Trailing delimiter] = 0:8-0:10
0| with aaa, bbb as ccc:
>--<

[#1.1 Insertion delimiter] = " "

[#1.2 Content] = 0:17-0:20
0| with aaa, bbb as ccc:
>---<

[#1.2 Removal] = 0:13-0:20
0| with aaa, bbb as ccc:
>-------<

[#1.2 Leading delimiter] = 0:13-0:17
0| with aaa, bbb as ccc:
>----<

[#1.2 Insertion delimiter] = " "

[#1 Domain] = 0:0-1:8
0| with aaa, bbb as ccc:
>---------------------
1| pass
--------<


[#2 Content] =
[#2 Domain] = 0:5-0:8
0| with aaa, bbb as ccc:
>---<

[#2 Removal] = 0:5-0:10
0| with aaa, bbb as ccc:
>-----<

[#2 Trailing delimiter] = 0:8-0:10
0| with aaa, bbb as ccc:
>--<

[#2 Insertion delimiter] = " "


[#3 Content] = 0:17-0:20
0| with aaa, bbb as ccc:
>---<

[#3 Removal] = 0:13-0:20
0| with aaa, bbb as ccc:
>-------<

[#3 Leading delimiter] = 0:13-0:17
0| with aaa, bbb as ccc:
>----<

[#3 Domain] = 0:10-0:20
0| with aaa, bbb as ccc:
>----------<

[#3 Insertion delimiter] = " "
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
with aaa as bbb, ccc as ddd:
pass
---

[#1.1 Content] = 0:12-0:15
0| with aaa as bbb, ccc as ddd:
>---<

[#1.1 Removal] = 0:8-0:15
0| with aaa as bbb, ccc as ddd:
>-------<

[#1.1 Leading delimiter] = 0:8-0:12
0| with aaa as bbb, ccc as ddd:
>----<

[#1.1 Insertion delimiter] = " "

[#1.2 Content] = 0:24-0:27
0| with aaa as bbb, ccc as ddd:
>---<

[#1.2 Removal] = 0:20-0:27
0| with aaa as bbb, ccc as ddd:
>-------<

[#1.2 Leading delimiter] = 0:20-0:24
0| with aaa as bbb, ccc as ddd:
>----<

[#1.2 Insertion delimiter] = " "

[#1 Domain] = 0:0-1:8
0| with aaa as bbb, ccc as ddd:
>----------------------------
1| pass
--------<


[#2 Content] = 0:12-0:15
0| with aaa as bbb, ccc as ddd:
>---<

[#2 Removal] = 0:8-0:15
0| with aaa as bbb, ccc as ddd:
>-------<

[#2 Leading delimiter] = 0:8-0:12
0| with aaa as bbb, ccc as ddd:
>----<

[#2 Domain] = 0:5-0:15
0| with aaa as bbb, ccc as ddd:
>----------<

[#2 Insertion delimiter] = " "


[#3 Content] = 0:24-0:27
0| with aaa as bbb, ccc as ddd:
>---<

[#3 Removal] = 0:20-0:27
0| with aaa as bbb, ccc as ddd:
>-------<

[#3 Leading delimiter] = 0:20-0:24
0| with aaa as bbb, ccc as ddd:
>----<

[#3 Domain] = 0:17-0:27
0| with aaa as bbb, ccc as ddd:
>----------<

[#3 Insertion delimiter] = " "
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
with aaa, bbb as ccc:
pass
---

[#1 Range] = 0:5-0:20
0| with aaa, bbb as ccc:
>---------------<

[#1 Domain] = 0:0-1:8
0| with aaa, bbb as ccc:
>---------------------
1| pass
--------<


[#2 Range] =
[#2 Domain] = 1:4-1:8
1| pass
>----<
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
with aaa:
pass

bbb = ccc
ddd = eee
---

[#1 Range] = 0:5-0:8
0| with aaa:
>---<

[#1 Domain] = 0:0-1:8
0| with aaa:
>---------
1| pass
--------<


[#2 Range] =
[#2 Domain] = 0:0-4:9
0| with aaa:
>---------
1| pass
--------
2|

3| bbb = ccc
---------
4| ddd = eee
---------<


[#3 Range] =
[#3 Domain] = 1:4-1:8
1| pass
>----<
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
with aaa:
pass
---

[Content] = 0:5-0:8
0| with aaa:
>---<

[Removal] = 0:4-0:8
0| with aaa:
>----<

[Leading delimiter] = 0:4-0:5
0| with aaa:
>-<

[Domain] = 0:0-1:8
0| with aaa:
>---------
1| pass
--------<

[Insertion delimiter] = " "
Loading

0 comments on commit 09c28c8

Please sign in to comment.