@@ -340,63 +340,6 @@ def list_attributes(self, obj):
340
340
return dir (obj )
341
341
342
342
343
- class ArrayItemMembersCompletion (BaseCompletionType ):
344
-
345
- def __init__ (self , shown_before_tab = True , mode = SIMPLE ):
346
- self ._shown_before_tab = shown_before_tab
347
- self .completer = AttrCompletion (mode = mode )
348
-
349
- def matches (self , cursor_offset , line , ** kwargs ):
350
- if 'locals_' not in kwargs :
351
- return None
352
- locals_ = kwargs ['locals_' ]
353
-
354
- full = self .locate (cursor_offset , line )
355
- if full is None :
356
- return None
357
-
358
- arr = lineparts .current_indexed_member_access_identifier (
359
- cursor_offset , line )
360
- index = lineparts .current_indexed_member_access_identifier_with_index (
361
- cursor_offset , line )
362
- member = lineparts .current_indexed_member_access_member (
363
- cursor_offset , line )
364
-
365
- try :
366
- obj = safe_eval (arr .word , locals_ )
367
- except EvaluationError :
368
- return None
369
- if type (obj ) not in (list , tuple ) + string_types :
370
- # then is may be unsafe to do attribute lookup on it
371
- return None
372
-
373
- try :
374
- locals_ ['temp_val_from_array' ] = safe_eval (index .word , locals_ )
375
- except (EvaluationError , IndexError ):
376
- return None
377
-
378
- temp_line = line .replace (index .word , 'temp_val_from_array.' )
379
-
380
- matches = self .completer .matches (len (temp_line ), temp_line , ** kwargs )
381
- if matches is None :
382
- return None
383
-
384
- matches_with_correct_name = \
385
- set (match .replace ('temp_val_from_array.' , index .word + '.' )
386
- for match in matches if match [20 :].startswith (member .word ))
387
-
388
- del locals_ ['temp_val_from_array' ]
389
-
390
- return matches_with_correct_name
391
-
392
- def locate (self , current_offset , line ):
393
- a = lineparts .current_indexed_member_access (current_offset , line )
394
- return a
395
-
396
- def format (self , match ):
397
- return after_last_dot (match )
398
-
399
-
400
343
class DictKeyCompletion (BaseCompletionType ):
401
344
402
345
def matches (self , cursor_offset , line , ** kwargs ):
@@ -526,8 +469,7 @@ def locate(self, current_offset, line):
526
469
527
470
528
471
class ExpressionAttributeCompletion (AttrCompletion ):
529
- # could replace ArrayItemMember completion and attr completion
530
- # as a more general case
472
+ # could replace attr completion as a more general case with some work
531
473
def locate (self , current_offset , line ):
532
474
return lineparts .current_expression_attribute (current_offset , line )
533
475
@@ -676,7 +618,6 @@ def get_default_completer(mode=SIMPLE):
676
618
mode = mode ),
677
619
AttrCompletion (mode = mode ),
678
620
ExpressionAttributeCompletion (mode = mode ),
679
- ArrayItemMembersCompletion (mode = mode ),
680
621
)
681
622
682
623
0 commit comments