##// END OF EJS Templates
Merge pull request #11583 from LucianaMarques/completer-dev...
Matthias Bussonnier -
r24947:15563bc4 merge
parent child Browse files
Show More
@@ -67,9 +67,9 b' Experimental'
67
67
68 Starting with IPython 6.0, this module can make use of the Jedi library to
68 Starting with IPython 6.0, this module can make use of the Jedi library to
69 generate completions both using static analysis of the code, and dynamically
69 generate completions both using static analysis of the code, and dynamically
70 inspecting multiple namespaces. The APIs attached to this new mechanism is
70 inspecting multiple namespaces. Jedi is an autocompletion and static analysis
71 unstable and will raise unless use in an :any:`provisionalcompleter` context
71 for Python. The APIs attached to this new mechanism is unstable and will
72 manager.
72 raise unless use in an :any:`provisionalcompleter` context manager.
73
73
74 You will find that the following are experimental:
74 You will find that the following are experimental:
75
75
@@ -84,7 +84,7 b' You will find that the following are experimental:'
84
84
85 We welcome any feedback on these new API, and we also encourage you to try this
85 We welcome any feedback on these new API, and we also encourage you to try this
86 module in debug mode (start IPython with ``--Completer.debug=True``) in order
86 module in debug mode (start IPython with ``--Completer.debug=True``) in order
87 to have extra logging information is :any:`jedi` is crashing, or if current
87 to have extra logging information if :any:`jedi` is crashing, or if current
88 IPython completer pending deprecations are returning results not yet handled
88 IPython completer pending deprecations are returning results not yet handled
89 by :any:`jedi`
89 by :any:`jedi`
90
90
@@ -168,6 +168,12 b' MATCHES_LIMIT = 500'
168
168
169 _deprecation_readline_sentinel = object()
169 _deprecation_readline_sentinel = object()
170
170
171 names = []
172 for c in range(0,0x10FFFF + 1):
173 try:
174 names.append(unicodedata.name(chr(c)))
175 except ValueError:
176 pass
171
177
172 class ProvisionalCompleterWarning(FutureWarning):
178 class ProvisionalCompleterWarning(FutureWarning):
173 """
179 """
@@ -1989,7 +1995,8 b' class IPCompleter(Completer):'
1989 return latex_text, latex_matches, ['latex_matches']*len(latex_matches), ()
1995 return latex_text, latex_matches, ['latex_matches']*len(latex_matches), ()
1990 name_text = ''
1996 name_text = ''
1991 name_matches = []
1997 name_matches = []
1992 for meth in (self.unicode_name_matches, back_latex_name_matches, back_unicode_name_matches):
1998 # need to add self.fwd_unicode_match() function here when done
1999 for meth in (self.unicode_name_matches, back_latex_name_matches, back_unicode_name_matches, self.fwd_unicode_match):
1993 name_text, name_matches = meth(base_text)
2000 name_text, name_matches = meth(base_text)
1994 if name_text:
2001 if name_text:
1995 return name_text, name_matches[:MATCHES_LIMIT], \
2002 return name_text, name_matches[:MATCHES_LIMIT], \
@@ -2064,3 +2071,19 b' class IPCompleter(Completer):'
2064 self.matches = _matches
2071 self.matches = _matches
2065
2072
2066 return text, _matches, origins, completions
2073 return text, _matches, origins, completions
2074
2075 def fwd_unicode_match(self, text:str) -> Tuple[str, list]:
2076 # initial code based on latex_matches() method
2077 slashpos = text.rfind('\\')
2078 # if text starts with slash
2079 if slashpos > -1:
2080 s = text[slashpos+1:]
2081 candidates = [x for x in names if x.startswith(s)]
2082 if candidates:
2083 return s, [x for x in names if x.startswith(s)]
2084 else:
2085 return '', ()
2086
2087 # if text does not start with slash
2088 else:
2089 return u'', ()
@@ -31,9 +31,12 b' def test_debug_magic_passes_through_generators():'
31 env = os.environ.copy()
31 env = os.environ.copy()
32 child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor', '--simple-prompt'],
32 child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor', '--simple-prompt'],
33 env=env)
33 env=env)
34 child.timeout = 2
34 child.timeout = 15
35
35
36 child.expect(in_prompt)
36 child.expect(in_prompt)
37
38 child.timeout = 2
39
37 child.sendline("def f(x):")
40 child.sendline("def f(x):")
38 child.sendline(" raise Exception")
41 child.sendline(" raise Exception")
39 child.sendline("")
42 child.sendline("")
General Comments 0
You need to be logged in to leave comments. Login now