Skip to content

Commit a625d69

Browse files
committed
Make it possible to disable auto completion (fixes #883)
1 parent 5fac24d commit a625d69

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bpython/autocomplete.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
# Autocomplete modes
4444
class AutocompleteModes(Enum):
45+
NONE = "none"
4546
SIMPLE = "simple"
4647
SUBSTRING = "substring"
4748
FUZZY = "fuzzy"
@@ -178,6 +179,10 @@ def few_enough_underscores(current, match):
178179
return not match.startswith("_")
179180

180181

182+
def method_match_none(word, size, text):
183+
return False
184+
185+
181186
def method_match_simple(word, size, text):
182187
return word[:size] == text
183188

@@ -192,6 +197,7 @@ def method_match_fuzzy(word, size, text):
192197

193198

194199
MODES_MAP = {
200+
AutocompleteModes.NONE: method_match_none,
195201
AutocompleteModes.SIMPLE: method_match_simple,
196202
AutocompleteModes.SUBSTRING: method_match_substring,
197203
AutocompleteModes.FUZZY: method_match_fuzzy,
@@ -669,7 +675,7 @@ def get_default_completer(mode=AutocompleteModes.SIMPLE, module_gatherer=None):
669675
),
670676
AttrCompletion(mode=mode),
671677
ExpressionAttributeCompletion(mode=mode),
672-
)
678+
) if mode != AutocompleteModes.NONE else tuple()
673679

674680

675681
def _callable_postfix(value, word):

0 commit comments

Comments
 (0)