Show More
@@ -1538,24 +1538,19 b' class IPCompleter(Completer):' | |||
|
1538 | 1538 | |
|
1539 | 1539 | usedNamedArgs.add(token) |
|
1540 | 1540 | |
|
1541 | # lookup the candidate callable matches either using global_matches | |
|
1542 | # or attr_matches for dotted names | |
|
1543 | if len(ids) == 1: | |
|
1544 | callableMatches = self.global_matches(ids[0]) | |
|
1545 | else: | |
|
1546 | callableMatches = self.attr_matches('.'.join(ids[::-1])) | |
|
1547 | 1541 | argMatches = [] |
|
1548 | for callableMatch in callableMatches: | |
|
1549 | try: | |
|
1550 |
|
|
|
1551 |
|
|
|
1552 | except: | |
|
1553 | continue | |
|
1542 | try: | |
|
1543 | callableObj = '.'.join(ids[::-1]) | |
|
1544 | namedArgs = self._default_arguments(eval(callableObj, | |
|
1545 | self.namespace)) | |
|
1554 | 1546 | |
|
1555 | 1547 | # Remove used named arguments from the list, no need to show twice |
|
1556 | 1548 | for namedArg in set(namedArgs) - usedNamedArgs: |
|
1557 | 1549 | if namedArg.startswith(text): |
|
1558 | 1550 | argMatches.append(u"%s=" %namedArg) |
|
1551 | except: | |
|
1552 | pass | |
|
1553 | ||
|
1559 | 1554 | return argMatches |
|
1560 | 1555 | |
|
1561 | 1556 | def dict_key_matches(self, text): |
@@ -1027,3 +1027,23 b' def test_snake_case_completion():' | |||
|
1027 | 1027 | _, matches = ip.complete("s_", "print(s_f") |
|
1028 | 1028 | nt.assert_in('some_three', matches) |
|
1029 | 1029 | nt.assert_in('some_four', matches) |
|
1030 | ||
|
1031 | def test_mix_terms(): | |
|
1032 | ip = get_ipython() | |
|
1033 | from textwrap import dedent | |
|
1034 | ip.Completer.use_jedi = False | |
|
1035 | ip.ex(dedent(""" | |
|
1036 | class Test: | |
|
1037 | def meth(self, meth_arg1): | |
|
1038 | print("meth") | |
|
1039 | ||
|
1040 | def meth_1(self, meth1_arg1, meth1_arg2): | |
|
1041 | print("meth1") | |
|
1042 | ||
|
1043 | def meth_2(self, meth2_arg1, meth2_arg2): | |
|
1044 | print("meth2") | |
|
1045 | test = Test() | |
|
1046 | """)) | |
|
1047 | _, matches = ip.complete(None, "test.meth(") | |
|
1048 | nt.assert_in('meth_arg1=', matches) | |
|
1049 | nt.assert_not_in('meth2_arg1=', matches) |
General Comments 0
You need to be logged in to leave comments.
Login now