@@ -232,42 +232,49 @@ def match_selector(selector, offset=0):
232232 return all (self .view .match_selector (point + offset , selector )
233233 for point in locations )
234234
235+ result = None
236+
235237 # None of our business
236238 if not match_selector ("- comment - (source.regexp - keyword.other.variable)" ):
237- return None
239+ result = None
238240
239241 # 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 )
242244
243245 # Auto-completion for include values using the 'contexts' keys and for
244- if match_selector (
246+ elif match_selector (
245247 "meta.expect-context-list-or-content | meta.context-list-or-content" ,
246248 - 1 ,
247249 ):
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+ )
250254
251255 # Auto-completion for include values using the 'contexts' keys
252- if match_selector (
256+ elif match_selector (
253257 "meta.expect-context-list | meta.expect-context | meta.include | meta.context-list" ,
254258 - 1 ,
255259 ):
256- return self ._complete_context (prefix , locations ) or None
260+ result = self ._complete_context (prefix , locations ) or None
257261
258262 # Auto-completion for branch points with 'fail' key
259- if match_selector (
263+ elif match_selector (
260264 "meta.expect-branch-point-reference | meta.branch-point-reference" ,
261265 - 1 ,
262266 ):
263- return self ._complete_branch_point ()
267+ result = self ._complete_branch_point ()
264268
265269 # 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 )
268276
269- # Standard completions for unmatched regions
270- return self ._complete_keyword (prefix , locations )
277+ return result
271278
272279 def _line_prefix (self , point ):
273280 _ , col = self .view .rowcol (point )
0 commit comments