Skip to content

Commit 22e0131

Browse files
fix dictionary autocompletion
1 parent dc05752 commit 22e0131

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bpython/autocomplete.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ def get_completer(cursor_offset, current_line, locals_, argspec, full_code, mode
6868
kwargs = {'locals_':locals_, 'argspec':argspec, 'full_code':full_code,
6969
'mode':mode, 'complete_magic_methods':complete_magic_methods}
7070

71+
# mutually exclusive if matches: If one of these returns [], try the next one
72+
for completer in [DictKeyCompletion]:
73+
matches = completer.matches(cursor_offset, current_line, **kwargs)
74+
if matches:
75+
return sorted(set(matches)), completer
76+
7177
# mutually exclusive matchers: if one returns [], don't go on
7278
for completer in [StringLiteralAttrCompletion, ImportCompletion,
7379
FilenameCompletion, MagicMethodCompletion, GlobalCompletion]:
7480
matches = completer.matches(cursor_offset, current_line, **kwargs)
7581
if matches is not None:
7682
return sorted(set(matches)), completer
7783

78-
# mutually exclusive if matches: If one of these returns [], try the next one
79-
for completer in [DictKeyCompletion]:
80-
matches = completer.matches(cursor_offset, current_line, **kwargs)
81-
if matches:
82-
return sorted(set(matches)), completer
83-
8484
matches = AttrCompletion.matches(cursor_offset, current_line, **kwargs)
8585

8686
# cumulative completions - try them all

0 commit comments

Comments
 (0)