diff options
author | Amjith Ramanujam <amjith@newrelic.com> | 2015-01-04 16:33:09 -0800 |
---|---|---|
committer | Amjith Ramanujam <amjith@newrelic.com> | 2015-01-04 16:33:09 -0800 |
commit | bc7884a0087adf1b3eb86ea6e2258fe8898def98 (patch) | |
tree | e573c91c8c44dbc0d954498b3c35f3550c472587 | |
parent | 976ee2f0142a75f5ceada488bcbb4630a2c3a4c1 (diff) |
Add smart_completion as a default param to get_completions.
-rw-r--r-- | pgcli/pgcompleter.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pgcli/pgcompleter.py b/pgcli/pgcompleter.py index 39343c18..bf8bc718 100644 --- a/pgcli/pgcompleter.py +++ b/pgcli/pgcompleter.py @@ -75,13 +75,14 @@ class PGCompleter(Completer): if item.startswith(text) or item.startswith(text.upper()): yield Completion(item, -len(text)) - def get_completions(self, document, complete_event): - + def get_completions(self, document, complete_event, smart_completion=None): word_before_cursor = document.get_word_before_cursor(WORD=True) + if smart_completion is None: + smart_completion = self.smart_completion # If smart_completion is off then match any word that starts with # 'word_before_cursor'. - if not self.smart_completion: + if not smart_completion: return self.find_matches(word_before_cursor, self.all_completions) category, scope = suggest_type(document.text, |