Skip to content

Commit 5e97cab

Browse files
committed
Avoid attaching multiple scopes at once
Sublime Text handles whitespace-separated scope list pretty well, but Atom (or the 'first-mate' library to be precise) would fail to do that.
1 parent d7855f9 commit 5e97cab

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

grammars/MagicPython.cson

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ repository:
6161
comments:
6262
patterns: [
6363
{
64-
name: "comment.line.number-sign.python meta.typehint.comment.python"
64+
name: "comment.line.number-sign.python"
65+
contentName: "meta.typehint.comment.python"
6566
begin: '''
6667
(?x)
6768
(?:
@@ -75,6 +76,8 @@ repository:
7576
'''
7677
end: "(?:$|(?=\\#))"
7778
beginCaptures:
79+
"0":
80+
name: "meta.typehint.comment.python"
7881
"1":
7982
name: "comment.typehint.directive.notation.python"
8083
patterns: [
@@ -1241,15 +1244,17 @@ repository:
12411244
"parameter-special":
12421245
match: '''
12431246
(?x)
1244-
(?: \\b (self)|(cls) \\b) \\s*(?:(,)|(?=\\)))
1247+
\\b ((self)|(cls)) \\b \\s*(?:(,)|(?=\\)))
12451248
12461249
'''
12471250
captures:
12481251
"1":
1249-
name: "variable.parameter.function.language.python variable.parameter.function.language.special.self.python"
1252+
name: "variable.parameter.function.language.python"
12501253
"2":
1251-
name: "variable.parameter.function.language.python variable.parameter.function.language.special.cls.python"
1254+
name: "variable.parameter.function.language.special.self.python"
12521255
"3":
1256+
name: "variable.parameter.function.language.special.cls.python"
1257+
"4":
12531258
name: "punctuation.separator.parameters.python"
12541259
"parameter-with-default":
12551260
begin: '''

grammars/MagicPython.tmLanguage

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@
9494
<array>
9595
<dict>
9696
<key>name</key>
97-
<string>comment.line.number-sign.python meta.typehint.comment.python</string>
97+
<string>comment.line.number-sign.python</string>
98+
<key>contentName</key>
99+
<string>meta.typehint.comment.python</string>
98100
<key>begin</key>
99101
<string>(?x)
100102
(?:
@@ -109,6 +111,11 @@
109111
<string>(?:$|(?=\#))</string>
110112
<key>beginCaptures</key>
111113
<dict>
114+
<key>0</key>
115+
<dict>
116+
<key>name</key>
117+
<string>meta.typehint.comment.python</string>
118+
</dict>
112119
<key>1</key>
113120
<dict>
114121
<key>name</key>
@@ -1992,21 +1999,26 @@ it's not tokenized as ellipsis.
19921999
<dict>
19932000
<key>match</key>
19942001
<string>(?x)
1995-
(?: \b (self)|(cls) \b) \s*(?:(,)|(?=\)))
2002+
\b ((self)|(cls)) \b \s*(?:(,)|(?=\)))
19962003
</string>
19972004
<key>captures</key>
19982005
<dict>
19992006
<key>1</key>
20002007
<dict>
20012008
<key>name</key>
2002-
<string>variable.parameter.function.language.python variable.parameter.function.language.special.self.python</string>
2009+
<string>variable.parameter.function.language.python</string>
20032010
</dict>
20042011
<key>2</key>
20052012
<dict>
20062013
<key>name</key>
2007-
<string>variable.parameter.function.language.python variable.parameter.function.language.special.cls.python</string>
2014+
<string>variable.parameter.function.language.special.self.python</string>
20082015
</dict>
20092016
<key>3</key>
2017+
<dict>
2018+
<key>name</key>
2019+
<string>variable.parameter.function.language.special.cls.python</string>
2020+
</dict>
2021+
<key>4</key>
20102022
<dict>
20112023
<key>name</key>
20122024
<string>punctuation.separator.parameters.python</string>

grammars/src/MagicPython.syntax.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ repository:
8989
comments:
9090
patterns:
9191
- name: comment.line.number-sign.python
92-
meta.typehint.comment.python
92+
contentName: meta.typehint.comment.python
9393

9494
begin: |
9595
(?x)
@@ -103,6 +103,7 @@ repository:
103103
104104
end: (?:$|(?=\#))
105105
beginCaptures:
106+
'0': {name: meta.typehint.comment.python}
106107
'1': {name: comment.typehint.directive.notation.python}
107108

108109
patterns:
@@ -841,13 +842,12 @@ repository:
841842
parameter-special:
842843
match: |
843844
(?x)
844-
(?: \b (self)|(cls) \b) \s*(?:(,)|(?=\)))
845+
\b ((self)|(cls)) \b \s*(?:(,)|(?=\)))
845846
captures:
846-
'1': {name: variable.parameter.function.language.python
847-
variable.parameter.function.language.special.self.python}
848-
'2': {name: variable.parameter.function.language.python
849-
variable.parameter.function.language.special.cls.python}
850-
'3': {name: punctuation.separator.parameters.python}
847+
'1': {name: variable.parameter.function.language.python}
848+
'2': {name: variable.parameter.function.language.special.self.python}
849+
'3': {name: variable.parameter.function.language.special.cls.python}
850+
'4': {name: punctuation.separator.parameters.python}
851851

852852
parameter-with-default:
853853
begin: |

0 commit comments

Comments
 (0)