@@ -232,42 +232,49 @@ def match_selector(selector, offset=0):
232
232
return all (self .view .match_selector (point + offset , selector )
233
233
for point in locations )
234
234
235
+ result = None
236
+
235
237
# None of our business
236
238
if not match_selector ("- comment - (source.regexp - keyword.other.variable)" ):
237
- return None
239
+ result = None
238
240
239
241
# Scope name completions based on our scope_data database
240
- if match_selector ("meta.expect-scope, meta.scope" , - 1 ):
241
- return self ._complete_scope (prefix , locations )
242
+ elif match_selector ("meta.expect-scope, meta.scope" , - 1 ):
243
+ result = self ._complete_scope (prefix , locations )
242
244
243
245
# Auto-completion for include values using the 'contexts' keys and for
244
- if match_selector (
246
+ elif match_selector (
245
247
"meta.expect-context-list-or-content | meta.context-list-or-content" ,
246
248
- 1 ,
247
249
):
248
- return ((self ._complete_keyword (prefix , locations ) or [])
249
- + self ._complete_context (prefix , locations ))
250
+ result = (
251
+ (self ._complete_keyword (prefix , locations ) or [])
252
+ + self ._complete_context (prefix , locations )
253
+ )
250
254
251
255
# Auto-completion for include values using the 'contexts' keys
252
- if match_selector (
256
+ elif match_selector (
253
257
"meta.expect-context-list | meta.expect-context | meta.include | meta.context-list" ,
254
258
- 1 ,
255
259
):
256
- return self ._complete_context (prefix , locations ) or None
260
+ result = self ._complete_context (prefix , locations ) or None
257
261
258
262
# Auto-completion for branch points with 'fail' key
259
- if match_selector (
263
+ elif match_selector (
260
264
"meta.expect-branch-point-reference | meta.branch-point-reference" ,
261
265
- 1 ,
262
266
):
263
- return self ._complete_branch_point ()
267
+ result = self ._complete_branch_point ()
264
268
265
269
# Auto-completion for variables in match patterns using 'variables' keys
266
- if match_selector ("keyword.other.variable" ):
267
- return self ._complete_variable ()
270
+ elif match_selector ("keyword.other.variable" ):
271
+ result = self ._complete_variable ()
272
+
273
+ else :
274
+ # Standard completions for unmatched regions
275
+ result = self ._complete_keyword (prefix , locations )
268
276
269
- # Standard completions for unmatched regions
270
- return self ._complete_keyword (prefix , locations )
277
+ return result
271
278
272
279
def _line_prefix (self , point ):
273
280
_ , col = self .view .rowcol (point )
0 commit comments