Skip to content

Commit bb40a06

Browse files
author
Yury Selivanov
committed
Highlight '#type:' with 'comment.typehint.directive.notation.python'
1 parent 3f3da35 commit bb40a06

6 files changed

Lines changed: 17 additions & 14 deletions

File tree

grammars/MagicPython.cson

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ repository:
6767
end: "(?:$|(?=\\#))"
6868
beginCaptures:
6969
"1":
70-
name: "keyword.comment.typehint.notation.python"
70+
name: "comment.typehint.directive.notation.python"
7171
patterns: [
7272
{
7373
name: "comment.typehint.ignore.notation.python"
@@ -83,7 +83,8 @@ repository:
8383
(?x)
8484
(?<!\\.)\\b(
8585
bool | bytes | float | int | object | str
86-
| List | Dict | Iterable | Sequence
86+
| List | Dict | Iterable | Sequence | Set
87+
| FrozenSet | Callable | Union | Tuple
8788
| Any | None
8889
)\\b
8990

grammars/MagicPython.syntax.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ repository:
9696
9797
end: (?:$|(?=\#))
9898
beginCaptures:
99-
'1': {name: keyword.comment.typehint.notation.python}
99+
'1': {name: comment.typehint.directive.notation.python}
100100

101101
patterns:
102102
- name: comment.typehint.ignore.notation.python
@@ -109,7 +109,8 @@ repository:
109109
(?x)
110110
(?<!\.)\b(
111111
bool | bytes | float | int | object | str
112-
| List | Dict | Iterable | Sequence
112+
| List | Dict | Iterable | Sequence | Set
113+
| FrozenSet | Callable | Union | Tuple
113114
| Any | None
114115
)\b
115116

grammars/MagicPython.tmLanguage

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<key>1</key>
9797
<dict>
9898
<key>name</key>
99-
<string>keyword.comment.typehint.notation.python</string>
99+
<string>comment.typehint.directive.notation.python</string>
100100
</dict>
101101
</dict>
102102
<key>patterns</key>
@@ -116,7 +116,8 @@
116116
<string>(?x)
117117
(?&lt;!\.)\b(
118118
bool | bytes | float | int | object | str
119-
| List | Dict | Iterable | Sequence
119+
| List | Dict | Iterable | Sequence | Set
120+
| FrozenSet | Callable | Union | Tuple
120121
| Any | None
121122
)\b
122123
</string>

misc/scopes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
comment.line.number-sign.python
22
comment.regexp
3+
comment.typehint.directive.notation.python
34
comment.typehint.ignore.notation.python
45
comment.typehint.puctuation.notation.python
56
comment.typehint.type.notation.python
@@ -37,7 +38,6 @@ invalid.illegal.name.python
3738
invalid.illegal.newline.python
3839
invalid.illegal.prefix.python
3940
keyword.codetag.notation.python
40-
keyword.comment.typehint.notation.python
4141
keyword.control.flow.python
4242
keyword.invalid.illegal.name.python
4343
keyword.operator.assignment.python

test/comments/typing1.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@
1010

1111

1212
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python
13-
type: : comment.line.number-sign.python, keyword.comment.typehint.notation.python, meta.typehint.comment.python, source.python
13+
type: : comment.line.number-sign.python, comment.typehint.directive.notation.python, meta.typehint.comment.python, source.python
1414
: comment.line.number-sign.python, meta.typehint.comment.python, source.python
1515
ignore : comment.line.number-sign.python, comment.typehint.ignore.notation.python, meta.typehint.comment.python, source.python
1616
# : comment.line.number-sign.python, punctuation.definition.comment.python, source.python
1717
test : comment.line.number-sign.python, source.python
1818
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python
19-
type: : comment.line.number-sign.python, keyword.comment.typehint.notation.python, meta.typehint.comment.python, source.python
19+
type: : comment.line.number-sign.python, comment.typehint.directive.notation.python, meta.typehint.comment.python, source.python
2020
: comment.line.number-sign.python, meta.typehint.comment.python, source.python
2121
ignore : comment.line.number-sign.python, comment.typehint.ignore.notation.python, meta.typehint.comment.python, source.python
2222
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python
23-
type: : comment.line.number-sign.python, keyword.comment.typehint.notation.python, meta.typehint.comment.python, source.python
23+
type: : comment.line.number-sign.python, comment.typehint.directive.notation.python, meta.typehint.comment.python, source.python
2424
ignore : comment.line.number-sign.python, comment.typehint.ignore.notation.python, meta.typehint.comment.python, source.python
2525
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python
26-
type: : comment.line.number-sign.python, keyword.comment.typehint.notation.python, meta.typehint.comment.python, source.python
26+
type: : comment.line.number-sign.python, comment.typehint.directive.notation.python, meta.typehint.comment.python, source.python
2727
: comment.line.number-sign.python, meta.typehint.comment.python, source.python
2828
ignore : comment.line.number-sign.python, comment.typehint.variable.notation.python, meta.typehint.comment.python, source.python
2929
1 : comment.line.number-sign.python, meta.typehint.comment.python, source.python
3030
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python
31-
type: : comment.line.number-sign.python, keyword.comment.typehint.notation.python, meta.typehint.comment.python, source.python
31+
type: : comment.line.number-sign.python, comment.typehint.directive.notation.python, meta.typehint.comment.python, source.python
3232
: comment.line.number-sign.python, meta.typehint.comment.python, source.python
3333
1 : comment.line.number-sign.python, meta.typehint.comment.python, source.python
3434
ignore : comment.line.number-sign.python, comment.typehint.variable.notation.python, meta.typehint.comment.python, source.python

test/comments/typing4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
None : constant.language.python, source.python
1010
: source.python
1111
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python
12-
type: : comment.line.number-sign.python, keyword.comment.typehint.notation.python, meta.typehint.comment.python, source.python
12+
type: : comment.line.number-sign.python, comment.typehint.directive.notation.python, meta.typehint.comment.python, source.python
1313
: comment.line.number-sign.python, meta.typehint.comment.python, source.python
1414
List : comment.line.number-sign.python, comment.typehint.type.notation.python, meta.typehint.comment.python, source.python
1515
[ : comment.line.number-sign.python, comment.typehint.puctuation.notation.python, meta.typehint.comment.python, source.python
@@ -24,7 +24,7 @@
2424
None : constant.language.python, source.python
2525
: source.python
2626
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python
27-
type: : comment.line.number-sign.python, keyword.comment.typehint.notation.python, meta.typehint.comment.python, source.python
27+
type: : comment.line.number-sign.python, comment.typehint.directive.notation.python, meta.typehint.comment.python, source.python
2828
: comment.line.number-sign.python, meta.typehint.comment.python, source.python
2929
Dict : comment.line.number-sign.python, comment.typehint.type.notation.python, meta.typehint.comment.python, source.python
3030
[ : comment.line.number-sign.python, comment.typehint.puctuation.notation.python, meta.typehint.comment.python, source.python

0 commit comments

Comments
 (0)