Skip to content

Commit 05ac152

Browse files
committed
Fix a typehinting regression
1 parent f73668c commit 05ac152

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

grammars/MagicPython.cson

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ repository:
7373
name: "comment.typehint.ignore.notation.python"
7474
match: '''
7575
(?x)
76-
\\G ignore \\s* ($|(?=\\#))
76+
\\G ignore
77+
(?= \\s* (?: $ | \\#))
7778
7879
'''
7980
}

grammars/MagicPython.syntax.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ repository:
102102
- name: comment.typehint.ignore.notation.python
103103
match: |
104104
(?x)
105-
\G ignore \s* ($|(?=\#))
105+
\G ignore
106+
(?= \s* (?: $ | \#))
106107
107108
- name: comment.typehint.type.notation.python
108109
match: |

grammars/MagicPython.tmLanguage

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@
106106
<string>comment.typehint.ignore.notation.python</string>
107107
<key>match</key>
108108
<string>(?x)
109-
\G ignore \s* ($|(?=\#))
109+
\G ignore
110+
(?= \s* (?: $ | \#))
110111
</string>
111112
</dict>
112113
<dict>

test/comments/typing1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
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
16+
: comment.line.number-sign.python, meta.typehint.comment.python, source.python
1617
# : comment.line.number-sign.python, punctuation.definition.comment.python, source.python
1718
test : comment.line.number-sign.python, source.python
1819
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python

test/comments/typing5.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
if isinstance(t1, TypeVar): # type: ignore
2+
continue
3+
4+
5+
6+
if : keyword.control.flow.python, source.python
7+
: source.python
8+
isinstance : meta.function-call.python, source.python, support.function.builtin.python
9+
( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python
10+
t1 : meta.function-call.arguments.python, meta.function-call.python, source.python
11+
, : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python
12+
TypeVar : meta.function-call.arguments.python, meta.function-call.python, source.python
13+
) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python
14+
: : source.python
15+
: source.python
16+
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python
17+
type: : comment.line.number-sign.python, comment.typehint.directive.notation.python, meta.typehint.comment.python, source.python
18+
: comment.line.number-sign.python, meta.typehint.comment.python, source.python
19+
ignore : comment.line.number-sign.python, comment.typehint.ignore.notation.python, meta.typehint.comment.python, source.python
20+
: source.python
21+
continue : keyword.control.flow.python, source.python

0 commit comments

Comments
 (0)