(
self, suggestion, word_before_cursor, alias=False)
| 664 | return self.find_matches(word_before_cursor, conds, meta='join') |
| 665 | |
| 666 | def get_function_matches( |
| 667 | self, suggestion, word_before_cursor, alias=False): |
| 668 | if suggestion.usage == 'from': |
| 669 | # Only suggest functions allowed in FROM clause |
| 670 | def filt(f): |
| 671 | return not f.is_aggregate and not f.is_window |
| 672 | else: |
| 673 | alias = False |
| 674 | |
| 675 | def filt(_): |
| 676 | return True |
| 677 | arg_mode = { |
| 678 | 'signature': 'signature', |
| 679 | 'special': None, |
| 680 | }.get(suggestion.usage, 'call') |
| 681 | # Function overloading means we way have multiple functions of the same |
| 682 | # name at this point, so keep unique names only |
| 683 | funcs = set( |
| 684 | self._make_cand(f, alias, suggestion, arg_mode) |
| 685 | for f in self.populate_functions(suggestion.schema, filt) |
| 686 | ) |
| 687 | |
| 688 | matches = self.find_matches(word_before_cursor, funcs, meta='function') |
| 689 | |
| 690 | if not suggestion.schema and not suggestion.usage: |
| 691 | # also suggest hardcoded functions using startswith matching |
| 692 | predefined_funcs = self.find_matches( |
| 693 | word_before_cursor, self.functions, mode='strict', |
| 694 | meta='function') |
| 695 | matches.extend(predefined_funcs) |
| 696 | |
| 697 | return matches |
| 698 | |
| 699 | def get_schema_matches(self, suggestion, word_before_cursor): |
| 700 | schema_names = self.dbmetadata['tables'].keys() |
no test coverage detected