Skip to content

Commit c0f8d51

Browse files
committed
Add a meta.member.access.python scope.
Add a `meta.member.access.python` scope wrapping around any attribute access or method call. Fixes #188.
1 parent e57ccc1 commit c0f8d51

32 files changed

+1068
-1036
lines changed

grammars/MagicPython.cson

+2
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ repository:
407407
}
408408
]
409409
"member-access":
410+
name: "meta.member.access.python"
410411
begin: "(\\.)\\s*(?!\\.)"
411412
end: '''
412413
(?x)
@@ -1167,6 +1168,7 @@ repository:
11671168
"1":
11681169
name: "entity.other.inherited-class.python"
11691170
"member-access-class":
1171+
name: "meta.member.access.python"
11701172
begin: "(\\.)\\s*(?!\\.)"
11711173
end: "(?<=\\S)(?=\\W)|$"
11721174
beginCaptures:

grammars/MagicPython.tmLanguage

+4
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,8 @@ it's probably control flow like:
614614
</dict>
615615
<key>member-access</key>
616616
<dict>
617+
<key>name</key>
618+
<string>meta.member.access.python</string>
617619
<key>begin</key>
618620
<string>(\.)\s*(?!\.)</string>
619621
<key>end</key>
@@ -1796,6 +1798,8 @@ it's probably control flow like:
17961798
</dict>
17971799
<key>member-access-class</key>
17981800
<dict>
1801+
<key>name</key>
1802+
<string>meta.member.access.python</string>
17991803
<key>begin</key>
18001804
<string>(\.)\s*(?!\.)</string>
18011805
<key>end</key>

grammars/src/MagicPython.syntax.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ repository:
433433
match: (?x) \b ([[:alpha:]_]\w*) \b
434434

435435
member-access:
436+
name: meta.member.access.python
436437
begin: (\.)\s*(?!\.)
437438
end: |
438439
(?x)
@@ -947,6 +948,7 @@ repository:
947948
'1': {name: entity.other.inherited-class.python}
948949

949950
member-access-class:
951+
name: meta.member.access.python
950952
begin: (\.)\s*(?!\.)
951953
end: (?<=\S)(?=\W)|$
952954
beginCaptures:

misc/scopes

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ meta.function.parameters.python
7575
meta.function.python
7676
meta.item-access.python
7777
meta.lambda-function.python
78+
meta.member.access.python
7879
meta.named.regexp
7980
meta.typehint.comment.python
8081
punctuation.character.set.begin.regexp

test/atom-spec/python-spec.js

+518-518
Large diffs are not rendered by default.

test/builtins/builtins3.py

+78-78
Original file line numberDiff line numberDiff line change
@@ -60,127 +60,127 @@
6060
' : punctuation.definition.string.end.python, source.python, string.quoted.single.python
6161
] : punctuation.definition.list.end.python, source.python
6262
some : source.python
63-
. : punctuation.separator.period.python, source.python
64-
__bases__ : source.python, support.variable.magic.python
63+
. : meta.member.access.python, punctuation.separator.period.python, source.python
64+
__bases__ : meta.member.access.python, source.python, support.variable.magic.python
6565
some : source.python
66-
. : punctuation.separator.period.python, source.python
67-
__class__ : source.python, support.variable.magic.python
66+
. : meta.member.access.python, punctuation.separator.period.python, source.python
67+
__class__ : meta.member.access.python, source.python, support.variable.magic.python
6868
assert : keyword.control.flow.python, source.python
6969
: source.python
7070
__debug__ : source.python, support.variable.magic.python
7171
__builtins__ : source.python, support.variable.magic.python
7272
__builtins__ : source.python, support.variable.magic.python
73-
. : punctuation.separator.period.python, source.python
74-
len : source.python
73+
. : meta.member.access.python, punctuation.separator.period.python, source.python
74+
len : meta.member.access.python, source.python
7575
print : meta.function-call.python, source.python, support.function.builtin.python
7676
( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python
7777
__builtins__ : meta.function-call.arguments.python, meta.function-call.python, source.python, support.variable.magic.python
7878
) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python
7979
some : source.python
80-
. : punctuation.separator.period.python, source.python
81-
__dict__ : source.python, support.variable.magic.python
80+
. : meta.member.access.python, punctuation.separator.period.python, source.python
81+
__dict__ : meta.member.access.python, source.python, support.variable.magic.python
8282
some : source.python
83-
. : punctuation.separator.period.python, source.python
84-
__doc__ : source.python, support.variable.magic.python
83+
. : meta.member.access.python, punctuation.separator.period.python, source.python
84+
__doc__ : meta.member.access.python, source.python, support.variable.magic.python
8585
some : source.python
86-
. : punctuation.separator.period.python, source.python
87-
__file__ : source.python, support.variable.magic.python
86+
. : meta.member.access.python, punctuation.separator.period.python, source.python
87+
__file__ : meta.member.access.python, source.python, support.variable.magic.python
8888
some : source.python
89-
. : punctuation.separator.period.python, source.python
90-
__members__ : source.python, support.variable.magic.python
89+
. : meta.member.access.python, punctuation.separator.period.python, source.python
90+
__members__ : meta.member.access.python, source.python, support.variable.magic.python
9191
some : source.python
92-
. : punctuation.separator.period.python, source.python
93-
__metaclass__ : source.python, support.variable.magic.python
92+
. : meta.member.access.python, punctuation.separator.period.python, source.python
93+
__metaclass__ : meta.member.access.python, source.python, support.variable.magic.python
9494
some : source.python
95-
. : punctuation.separator.period.python, source.python
96-
__methods__ : source.python, support.variable.magic.python
95+
. : meta.member.access.python, punctuation.separator.period.python, source.python
96+
__methods__ : meta.member.access.python, source.python, support.variable.magic.python
9797
some : source.python
98-
. : punctuation.separator.period.python, source.python
99-
__module__ : source.python, support.variable.magic.python
98+
. : meta.member.access.python, punctuation.separator.period.python, source.python
99+
__module__ : meta.member.access.python, source.python, support.variable.magic.python
100100
some : source.python
101-
. : punctuation.separator.period.python, source.python
102-
__mro__ : source.python, support.variable.magic.python
101+
. : meta.member.access.python, punctuation.separator.period.python, source.python
102+
__mro__ : meta.member.access.python, source.python, support.variable.magic.python
103103
some : source.python
104-
. : punctuation.separator.period.python, source.python
105-
__name__ : source.python, support.variable.magic.python
104+
. : meta.member.access.python, punctuation.separator.period.python, source.python
105+
__name__ : meta.member.access.python, source.python, support.variable.magic.python
106106
some : source.python
107-
. : punctuation.separator.period.python, source.python
108-
__slots__ : source.python, support.variable.magic.python
107+
. : meta.member.access.python, punctuation.separator.period.python, source.python
108+
__slots__ : meta.member.access.python, source.python, support.variable.magic.python
109109
some : source.python
110-
. : punctuation.separator.period.python, source.python
111-
__subclasses__ : source.python, support.variable.magic.python
110+
. : meta.member.access.python, punctuation.separator.period.python, source.python
111+
__subclasses__ : meta.member.access.python, source.python, support.variable.magic.python
112112
some : source.python
113-
. : punctuation.separator.period.python, source.python
114-
__version__ : source.python, support.variable.magic.python
113+
. : meta.member.access.python, punctuation.separator.period.python, source.python
114+
__version__ : meta.member.access.python, source.python, support.variable.magic.python
115115
some : source.python
116-
. : punctuation.separator.period.python, source.python
117-
__weakref__ : source.python, support.variable.magic.python
116+
. : meta.member.access.python, punctuation.separator.period.python, source.python
117+
__weakref__ : meta.member.access.python, source.python, support.variable.magic.python
118118
some : source.python
119-
. : punctuation.separator.period.python, source.python
120-
__qualname__ : source.python, support.variable.magic.python
119+
. : meta.member.access.python, punctuation.separator.period.python, source.python
120+
__qualname__ : meta.member.access.python, source.python, support.variable.magic.python
121121
some : source.python
122-
. : punctuation.separator.period.python, source.python
123-
__code__ : source.python, support.variable.magic.python
122+
. : meta.member.access.python, punctuation.separator.period.python, source.python
123+
__code__ : meta.member.access.python, source.python, support.variable.magic.python
124124
some : source.python
125-
. : punctuation.separator.period.python, source.python
126-
__wrapped__ : source.python, support.variable.magic.python
125+
. : meta.member.access.python, punctuation.separator.period.python, source.python
126+
__wrapped__ : meta.member.access.python, source.python, support.variable.magic.python
127127
some : source.python
128-
. : punctuation.separator.period.python, source.python
129-
__signature__ : source.python, support.variable.magic.python
128+
. : meta.member.access.python, punctuation.separator.period.python, source.python
129+
__signature__ : meta.member.access.python, source.python, support.variable.magic.python
130130
some : source.python
131-
. : punctuation.separator.period.python, source.python
132-
__defaults__ : source.python, support.variable.magic.python
131+
. : meta.member.access.python, punctuation.separator.period.python, source.python
132+
__defaults__ : meta.member.access.python, source.python, support.variable.magic.python
133133
some : source.python
134-
. : punctuation.separator.period.python, source.python
135-
__func__ : source.python, support.variable.magic.python
134+
. : meta.member.access.python, punctuation.separator.period.python, source.python
135+
__func__ : meta.member.access.python, source.python, support.variable.magic.python
136136
some : source.python
137-
. : punctuation.separator.period.python, source.python
138-
__self__ : source.python, support.variable.magic.python
137+
. : meta.member.access.python, punctuation.separator.period.python, source.python
138+
__self__ : meta.member.access.python, source.python, support.variable.magic.python
139139
some : source.python
140-
. : punctuation.separator.period.python, source.python
141-
__kwdefaults__ : source.python, support.variable.magic.python
140+
. : meta.member.access.python, punctuation.separator.period.python, source.python
141+
__kwdefaults__ : meta.member.access.python, source.python, support.variable.magic.python
142142
some : source.python
143-
. : punctuation.separator.period.python, source.python
144-
__matmul__ : source.python, support.function.magic.python
143+
. : meta.member.access.python, punctuation.separator.period.python, source.python
144+
__matmul__ : meta.member.access.python, source.python, support.function.magic.python
145145
some : source.python
146-
. : punctuation.separator.period.python, source.python
147-
__imatmul__ : source.python, support.function.magic.python
146+
. : meta.member.access.python, punctuation.separator.period.python, source.python
147+
__imatmul__ : meta.member.access.python, source.python, support.function.magic.python
148148
some : source.python
149-
. : punctuation.separator.period.python, source.python
150-
__rmatmul__ : source.python, support.function.magic.python
149+
. : meta.member.access.python, punctuation.separator.period.python, source.python
150+
__rmatmul__ : meta.member.access.python, source.python, support.function.magic.python
151151
some : source.python
152-
. : punctuation.separator.period.python, source.python
153-
__annotations__ : source.python, support.variable.magic.python
152+
. : meta.member.access.python, punctuation.separator.period.python, source.python
153+
__annotations__ : meta.member.access.python, source.python, support.variable.magic.python
154154
some : source.python
155-
. : punctuation.separator.period.python, source.python
156-
__init_subclass__ : source.python, support.function.magic.python
155+
. : meta.member.access.python, punctuation.separator.period.python, source.python
156+
__init_subclass__ : meta.member.access.python, source.python, support.function.magic.python
157157
some : source.python
158-
. : punctuation.separator.period.python, source.python
159-
__set_name__ : source.python, support.function.magic.python
158+
. : meta.member.access.python, punctuation.separator.period.python, source.python
159+
__set_name__ : meta.member.access.python, source.python, support.function.magic.python
160160
some : source.python
161-
. : punctuation.separator.period.python, source.python
162-
__fspath__ : source.python, support.function.magic.python
161+
. : meta.member.access.python, punctuation.separator.period.python, source.python
162+
__fspath__ : meta.member.access.python, source.python, support.function.magic.python
163163
some : source.python
164-
. : punctuation.separator.period.python, source.python
165-
__classcell__ : source.python, support.variable.magic.python
164+
. : meta.member.access.python, punctuation.separator.period.python, source.python
165+
__classcell__ : meta.member.access.python, source.python, support.variable.magic.python
166166
some : source.python
167-
. : punctuation.separator.period.python, source.python
168-
__bytes__ : source.python, support.function.magic.python
167+
. : meta.member.access.python, punctuation.separator.period.python, source.python
168+
__bytes__ : meta.member.access.python, source.python, support.function.magic.python
169169
some : source.python
170-
. : punctuation.separator.period.python, source.python
171-
__spec__ : source.python, support.variable.magic.python
170+
. : meta.member.access.python, punctuation.separator.period.python, source.python
171+
__spec__ : meta.member.access.python, source.python, support.variable.magic.python
172172
some : source.python
173-
. : punctuation.separator.period.python, source.python
174-
__path__ : source.python, support.variable.magic.python
173+
. : meta.member.access.python, punctuation.separator.period.python, source.python
174+
__path__ : meta.member.access.python, source.python, support.variable.magic.python
175175
some : source.python
176-
. : punctuation.separator.period.python, source.python
177-
__prepare__ : source.python, support.function.magic.python
176+
. : meta.member.access.python, punctuation.separator.period.python, source.python
177+
__prepare__ : meta.member.access.python, source.python, support.function.magic.python
178178
some : source.python
179-
. : punctuation.separator.period.python, source.python
180-
__package__ : source.python, support.variable.magic.python
179+
. : meta.member.access.python, punctuation.separator.period.python, source.python
180+
__package__ : meta.member.access.python, source.python, support.variable.magic.python
181181
some : source.python
182-
. : punctuation.separator.period.python, source.python
183-
__traceback__ : source.python, support.variable.magic.python
182+
. : meta.member.access.python, punctuation.separator.period.python, source.python
183+
__traceback__ : meta.member.access.python, source.python, support.variable.magic.python
184184
some : source.python
185-
. : punctuation.separator.period.python, source.python
186-
__notspecial__ : source.python
185+
. : meta.member.access.python, punctuation.separator.period.python, source.python
186+
__notspecial__ : meta.member.access.python, source.python

test/builtins/builtins4.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@
77

88

99

10+
1011
some : source.python
11-
. : punctuation.separator.period.python, source.python
12-
int : source.python
12+
. : meta.member.access.python, punctuation.separator.period.python, source.python
13+
int : meta.member.access.python, source.python
1314
some : source.python
14-
. : punctuation.separator.period.python, source.python
15-
sum : source.python
15+
. : meta.member.access.python, punctuation.separator.period.python, source.python
16+
sum : meta.member.access.python, source.python
1617
some : source.python
17-
. : punctuation.separator.period.python, source.python
18-
super : source.python
18+
. : meta.member.access.python, punctuation.separator.period.python, source.python
19+
super : meta.member.access.python, source.python
1920
some : source.python
20-
. : punctuation.separator.period.python, source.python
21-
unicode : source.python
21+
. : meta.member.access.python, punctuation.separator.period.python, source.python
22+
unicode : meta.member.access.python, source.python
2223
some : source.python
23-
. : punctuation.separator.period.python, source.python
24-
foo : source.python
24+
. : meta.member.access.python, punctuation.separator.period.python, source.python
25+
foo : meta.member.access.python, source.python
2526
some : source.python
26-
. : punctuation.separator.period.python, source.python
27-
Exception : source.python
27+
. : meta.member.access.python, punctuation.separator.period.python, source.python
28+
Exception : meta.member.access.python, source.python

test/builtins/builtins5.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77

88

99

10+
1011
some : source.python
11-
. : punctuation.separator.period.python, source.python
12-
: source.python
13-
True : keyword.illegal.name.python, source.python
12+
. : meta.member.access.python, punctuation.separator.period.python, source.python
13+
: meta.member.access.python, source.python
14+
True : keyword.illegal.name.python, meta.member.access.python, source.python
1415
some : source.python
15-
. : punctuation.separator.period.python, source.python
16-
: source.python
17-
\ : punctuation.separator.continuation.line.python, source.python
18-
: source.python
19-
: source.python
20-
True : keyword.illegal.name.python, source.python
16+
. : meta.member.access.python, punctuation.separator.period.python, source.python
17+
: meta.member.access.python, source.python
18+
\ : meta.member.access.python, punctuation.separator.continuation.line.python, source.python
19+
: meta.member.access.python, source.python
20+
: meta.member.access.python, source.python
21+
True : keyword.illegal.name.python, meta.member.access.python, source.python
2122
True : constant.language.python, source.python
2223
some : source.python
23-
. : punctuation.separator.period.python, source.python
24-
: source.python
25-
: source.python
26-
True : keyword.illegal.name.python, source.python
24+
. : meta.member.access.python, punctuation.separator.period.python, source.python
25+
: meta.member.access.python, source.python
26+
: meta.member.access.python, source.python
27+
True : keyword.illegal.name.python, meta.member.access.python, source.python

0 commit comments

Comments
 (0)