MCPcopy Index your code
hub / github.com/dbcli/pgcli / get_keyword_matches

Method get_keyword_matches

pgcli/pgcompleter.py:814–834  ·  view source on GitHub ↗
(self, suggestion, word_before_cursor)

Source from the content-addressed store, hash-verified

812 return self.find_matches(word_before_cursor, self.databases, meta="database")
813
814 def get_keyword_matches(self, suggestion, word_before_cursor):
815 keywords = self.keywords_tree.keys()
816 # Get well known following keywords for the last token. If any, narrow
817 # candidates to this list.
818 next_keywords = self.keywords_tree.get(suggestion.last_token, [])
819 if next_keywords:
820 keywords = next_keywords
821
822 casing = self.keyword_casing
823 if casing == "auto":
824 if word_before_cursor and word_before_cursor[-1].islower():
825 casing = "lower"
826 else:
827 casing = "upper"
828
829 if casing == "upper":
830 keywords = [k.upper() for k in keywords]
831 else:
832 keywords = [k.lower() for k in keywords]
833
834 return self.find_matches(word_before_cursor, keywords, mode="strict", meta="keyword")
835
836 def get_path_matches(self, _, word_before_cursor):
837 completer = PathCompleter(expanduser=True)

Callers

nothing calls this directly

Calls 1

find_matchesMethod · 0.95

Tested by

no test coverage detected