MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / _make_cand

Method _make_cand

mssqlcli/mssqlcompleter.py:765–789  ·  view source on GitHub ↗

Returns a Candidate namedtuple. :param tbl is a SchemaObject :param arg_mode determines what type of arg list to suffix for functions. Possible values: call, signature

(self, tbl, do_alias, suggestion, arg_mode=None)

Source from the content-addressed store, hash-verified

763 )
764
765 def _make_cand(self, tbl, do_alias, suggestion, arg_mode=None):
766 """Returns a Candidate namedtuple.
767
768 :param tbl is a SchemaObject
769 :param arg_mode determines what type of arg list to suffix for functions.
770 Possible values: call, signature
771
772 """
773 cased_tbl = self.case(tbl.name)
774 if do_alias:
775 alias = self.alias(cased_tbl, suggestion.table_refs)
776 synonyms = (cased_tbl, generate_alias(cased_tbl))
777 maybe_alias = (' ' + alias) if do_alias else ''
778 maybe_schema = (self.case(tbl.schema) + '.') if tbl.schema else ''
779 suffix = self._arg_list_cache[arg_mode][tbl.meta] if arg_mode else ''
780 if arg_mode == 'call':
781 display_suffix = self._arg_list_cache['call_display'][tbl.meta]
782 elif arg_mode == 'signature':
783 display_suffix = self._arg_list_cache['signature'][tbl.meta]
784 else:
785 display_suffix = ''
786 item = maybe_schema + cased_tbl + suffix + maybe_alias
787 display = maybe_schema + cased_tbl + display_suffix + maybe_alias
788 prio2 = 0 if tbl.schema else 1
789 return Candidate(item, synonyms=synonyms, prio2=prio2, display=display)
790
791 def get_table_matches(self, suggestion, word_before_cursor, alias=False):
792 tables = self.populate_schema_objects(suggestion.schema, 'tables')

Callers 4

get_function_matchesMethod · 0.95
get_table_matchesMethod · 0.95
get_view_matchesMethod · 0.95
get_datatype_matchesMethod · 0.95

Calls 4

caseMethod · 0.95
aliasMethod · 0.95
generate_aliasFunction · 0.85
CandidateFunction · 0.85

Tested by

no test coverage detected