Skip to content

Commit 77903ed

Browse files
Type argument
1 parent 1fa7450 commit 77903ed

File tree

7 files changed

+164
-13
lines changed

7 files changed

+164
-13
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
value: map[str, int]
2+
---
3+
4+
[Range] =
5+
[Domain] = 0:11-0:19
6+
>--------<
7+
0| value: map[str, int]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
value: list[int]
2+
---
3+
4+
[#1 Content] = 0:7-0:16
5+
>---------<
6+
0| value: list[int]
7+
8+
[#1 Removal] = 0:5-0:16
9+
>-----------<
10+
0| value: list[int]
11+
12+
[#1 Leading delimiter] = 0:5-0:7
13+
>--<
14+
0| value: list[int]
15+
16+
[#1 Domain] = 0:0-0:16
17+
>----------------<
18+
0| value: list[int]
19+
20+
[#1 Insertion delimiter] = " "
21+
22+
23+
[#2 Content] =
24+
[#2 Removal] =
25+
[#2 Domain] = 0:12-0:15
26+
>---<
27+
0| value: list[int]
28+
29+
[#2 Insertion delimiter] = " "
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
value: map[str, int]
2+
---
3+
4+
[#1 Content] = 0:7-0:20
5+
>-------------<
6+
0| value: map[str, int]
7+
8+
[#1 Removal] = 0:5-0:20
9+
>---------------<
10+
0| value: map[str, int]
11+
12+
[#1 Leading delimiter] = 0:5-0:7
13+
>--<
14+
0| value: map[str, int]
15+
16+
[#1 Domain] = 0:0-0:20
17+
>--------------------<
18+
0| value: map[str, int]
19+
20+
[#1 Insertion delimiter] = " "
21+
22+
23+
[#2 Content] =
24+
[#2 Domain] = 0:11-0:14
25+
>---<
26+
0| value: map[str, int]
27+
28+
[#2 Removal] = 0:11-0:16
29+
>-----<
30+
0| value: map[str, int]
31+
32+
[#2 Trailing delimiter] = 0:14-0:16
33+
>--<
34+
0| value: map[str, int]
35+
36+
[#2 Insertion delimiter] = " "
37+
38+
39+
[#3 Content] =
40+
[#3 Domain] = 0:16-0:19
41+
>---<
42+
0| value: map[str, int]
43+
44+
[#3 Removal] = 0:14-0:19
45+
>-----<
46+
0| value: map[str, int]
47+
48+
[#3 Leading delimiter] = 0:14-0:16
49+
>--<
50+
0| value: map[str, int]
51+
52+
[#3 Insertion delimiter] = " "
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
value: int
2+
---
3+
4+
[Content] = 0:7-0:10
5+
>---<
6+
0| value: int
7+
8+
[Removal] = 0:5-0:10
9+
>-----<
10+
0| value: int
11+
12+
[Leading delimiter] = 0:5-0:7
13+
>--<
14+
0| value: int
15+
16+
[Domain] = 0:0-0:10
17+
>----------<
18+
0| value: int
19+
20+
[Insertion delimiter] = " "
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
value: int = 0
2+
---
3+
4+
[Content] = 0:7-0:10
5+
>---<
6+
0| value: int = 0
7+
8+
[Removal] = 0:5-0:10
9+
>-----<
10+
0| value: int = 0
11+
12+
[Leading delimiter] = 0:5-0:7
13+
>--<
14+
0| value: int = 0
15+
16+
[Domain] = 0:0-0:14
17+
>--------------<
18+
0| value: int = 0
19+
20+
[Insertion delimiter] = " "

packages/common/src/scopeSupportFacets/python.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,19 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
4848
"value.variable": supported,
4949
"value.variable.pattern": supported,
5050

51-
"type.class": supported,
52-
"type.argument.formal": supported,
5351
"type.argument.formal.constructor": supported,
5452
"type.argument.formal.constructor.iteration": supported,
5553
"type.argument.formal.iteration": supported,
5654
"type.argument.formal.method": supported,
5755
"type.argument.formal.method.iteration": supported,
58-
"type.return": supported,
56+
"type.argument.formal": supported,
57+
"type.class": supported,
5958
"type.field": supported,
6059
"type.field.iteration": supported,
60+
"type.return": supported,
61+
"type.typeArgument": supported,
62+
"type.typeArgument.iteration": supported,
63+
"type.variable": supported,
6164

6265
anonymousFunction: supported,
6366
namedFunction: supported,
@@ -191,14 +194,10 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
191194
startTag: notApplicable,
192195
tags: notApplicable,
193196
"type.alias": notApplicable,
194-
195-
// "type.cast": notApplicable,
196-
// "type.enum": notApplicable,
197-
// "type.foreach": notApplicable,
198-
// "type.interface": notApplicable,
199-
// "type.resource": notApplicable,
200-
// "type.resource.iteration": notApplicable,
201-
// "type.typeArgument": notApplicable,
202-
// "type.typeArgument.iteration": notApplicable,
203-
// "type.variable": notApplicable,
197+
"type.enum": notApplicable,
198+
"type.cast": notApplicable,
199+
"type.foreach": notApplicable,
200+
"type.resource": notApplicable,
201+
"type.resource.iteration": notApplicable,
202+
"type.interface": notApplicable,
204203
};

queries/python.scm

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,30 @@
100100
type: (_) @type
101101
) @_.domain
102102

103+
;;!! map[int, str]
104+
;;! ^^^ ^^^
105+
(generic_type
106+
(type_parameter
107+
(type)? @_.leading.endOf
108+
.
109+
(type) @type
110+
.
111+
(type)? @_.trailing.startOf
112+
)
113+
)
114+
115+
;;!! map[int, str]
116+
;;! ^^^^^^^^
117+
;;! -------------
118+
(generic_type
119+
(type_parameter
120+
.
121+
"[" @type.iteration.start.endOf
122+
"]" @type.iteration.end.startOf
123+
.
124+
)
125+
)
126+
103127
;;!! def aaa() -> str:
104128
;;! ^^^
105129
;;! xxxxxxx

0 commit comments

Comments
 (0)