Skip to content

Commit 0935b72

Browse files
committed
Don't highlight lone '...' and '>>>' in docstrings
1 parent d5be718 commit 0935b72

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

grammars/MagicPython.cson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ repository:
245245
(?x)
246246
(?:
247247
(?:^|\\G) \\s* (?# '\\G' is necessary for ST)
248-
((?:>>>|\\.\\.\\.) \\s)
248+
((?:>>>|\\.\\.\\.) \\s) (?=\\s*\\S)
249249
)
250250
251251
'''

grammars/MagicPython.syntax.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ repository:
207207
(?x)
208208
(?:
209209
(?:^|\G) \s* (?# '\G' is necessary for ST)
210-
((?:>>>|\.\.\.) \s)
210+
((?:>>>|\.\.\.) \s) (?=\s*\S)
211211
)
212212
captures:
213213
'1': {name: keyword.control.flow.python}

grammars/MagicPython.tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@
387387
<string>(?x)
388388
(?:
389389
(?:^|\G) \s* (?# &apos;\G&apos; is necessary for ST)
390-
((?:&gt;&gt;&gt;|\.\.\.) \s)
390+
((?:&gt;&gt;&gt;|\.\.\.) \s) (?=\s*\S)
391391
)
392392
</string>
393393
<key>captures</key>

test/docstrings/prompt2.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
def foo():
3+
...
4+
>>>
5+
"""
6+
7+
8+
9+
""" : punctuation.definition.string.begin.python, source.python, string.quoted.docstring.multi.python
10+
def foo(): : source.python, string.quoted.docstring.multi.python
11+
... : source.python, string.quoted.docstring.multi.python
12+
>>> : source.python, string.quoted.docstring.multi.python
13+
""" : punctuation.definition.string.end.python, source.python, string.quoted.docstring.multi.python

test/docstrings/prompt3.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'''...'''
2+
...
3+
4+
5+
6+
''' : punctuation.definition.string.begin.python, source.python, string.quoted.docstring.multi.python
7+
... : source.python, string.quoted.docstring.multi.python
8+
''' : punctuation.definition.string.end.python, source.python, string.quoted.docstring.multi.python
9+
... : constant.other.ellipsis.python, source.python

0 commit comments

Comments
 (0)