Show More
@@ -886,8 +886,7 b' class IPCompleter(Completer):' | |||||
886 | # parenthesis before the cursor |
|
886 | # parenthesis before the cursor | |
887 | # e.g. for "foo (1+bar(x), pa<cursor>,a=1)", the candidate is "foo" |
|
887 | # e.g. for "foo (1+bar(x), pa<cursor>,a=1)", the candidate is "foo" | |
888 | tokens = regexp.findall(self.text_until_cursor) |
|
888 | tokens = regexp.findall(self.text_until_cursor) | |
889 |
tokens |
|
889 | iterTokens = reversed(tokens); openPar = 0 | |
890 | iterTokens = iter(tokens); openPar = 0 |
|
|||
891 |
|
890 | |||
892 | for token in iterTokens: |
|
891 | for token in iterTokens: | |
893 | if token == ')': |
|
892 | if token == ')': | |
@@ -912,6 +911,25 b' class IPCompleter(Completer):' | |||||
912 | break |
|
911 | break | |
913 | except StopIteration: |
|
912 | except StopIteration: | |
914 | break |
|
913 | break | |
|
914 | ||||
|
915 | # Find all named arguments already assigned to, as to avoid suggesting | |||
|
916 | # them again | |||
|
917 | usedNamedArgs = set() | |||
|
918 | par_level = -1 | |||
|
919 | for token, next_token in itertools.izip(tokens, tokens[1:]): | |||
|
920 | if token == '(': | |||
|
921 | par_level += 1 | |||
|
922 | elif token == ')': | |||
|
923 | par_level -= 1 | |||
|
924 | ||||
|
925 | if par_level != 0: | |||
|
926 | continue | |||
|
927 | ||||
|
928 | if next_token != '=': | |||
|
929 | continue | |||
|
930 | ||||
|
931 | usedNamedArgs.add(token) | |||
|
932 | ||||
915 | # lookup the candidate callable matches either using global_matches |
|
933 | # lookup the candidate callable matches either using global_matches | |
916 | # or attr_matches for dotted names |
|
934 | # or attr_matches for dotted names | |
917 | if len(ids) == 1: |
|
935 | if len(ids) == 1: | |
@@ -926,7 +944,8 b' class IPCompleter(Completer):' | |||||
926 | except: |
|
944 | except: | |
927 | continue |
|
945 | continue | |
928 |
|
946 | |||
929 | for namedArg in namedArgs: |
|
947 | # Remove used named arguments from the list, no need to show twice | |
|
948 | for namedArg in set(namedArgs) - usedNamedArgs: | |||
930 | if namedArg.startswith(text): |
|
949 | if namedArg.startswith(text): | |
931 | argMatches.append(u"%s=" %namedArg) |
|
950 | argMatches.append(u"%s=" %namedArg) | |
932 | return argMatches |
|
951 | return argMatches |
General Comments 0
You need to be logged in to leave comments.
Login now