Skip to content

Commit 325d8df

Browse files
vpetrovykhYury Selivanov
authored andcommitted
Fix highlighting of decorators preceded by ':'
1 parent 2d115b5 commit 325d8df

4 files changed

Lines changed: 27 additions & 0 deletions

File tree

grammars/MagicPython.cson

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ repository:
5656
(?! \\s | \\# | [rR]?(\\'\\'\\'|\\"\\"\\"|\\'|\\") | $)
5757
|
5858
(?<=\\'\\'\\'|\\"\\"\\"|\\'|\\")
59+
|
60+
^(?= \\s* @)
5961
6062
'''
6163
endCaptures:

grammars/MagicPython.syntax.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ repository:
8686
(?! \s | \# | [rR]?(\'\'\'|\"\"\"|\'|\") | $)
8787
|
8888
(?<=\'\'\'|\"\"\"|\'|\")
89+
|
90+
^(?= \s* @)
8991
endCaptures:
9092
'1': {name: punctuation.definition.string.end.python}
9193
patterns:

grammars/MagicPython.tmLanguage

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
(?! \s | \# | [rR]?(\&apos;\&apos;\&apos;|\&quot;\&quot;\&quot;|\&apos;|\&quot;) | $)
8282
|
8383
(?&lt;=\&apos;\&apos;\&apos;|\&quot;\&quot;\&quot;|\&apos;|\&quot;)
84+
|
85+
^(?= \s* @)
8486
</string>
8587
<key>endCaptures</key>
8688
<dict>

test/docstrings/regr1.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#:
2+
@asd
3+
def foo():
4+
pass
5+
6+
7+
8+
# : comment.line.number-sign.python, punctuation.definition.comment.python, source.python
9+
: : comment.line.number-sign.python, source.python
10+
: meta.function.decorator.python, source.python
11+
@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python
12+
asd : entity.name.function.decorator.python, meta.function.decorator.python, source.python
13+
: meta.function.python, source.python
14+
def : meta.function.python, source.python, storage.type.function.python
15+
: meta.function.python, source.python
16+
foo : entity.name.function.python, meta.function.python, source.python
17+
( : meta.function.parameters.python, meta.function.python, punctuation.definition.parameters.begin.python, source.python
18+
) : meta.function.parameters.python, meta.function.python, punctuation.definition.parameters.end.python, source.python
19+
: : meta.function.python, punctuation.section.function.begin.python, source.python
20+
: source.python
21+
pass : keyword.control.flow.python, source.python

0 commit comments

Comments
 (0)