##// END OF EJS Templates
Don't catch failure to import Jedi...
Thomas Kluyver -
Show More
@@ -77,13 +77,9 b' from IPython.utils.process import arg_split'
77 from IPython.utils.py3compat import builtin_mod, string_types, PY3, cast_unicode_py2
77 from IPython.utils.py3compat import builtin_mod, string_types, PY3, cast_unicode_py2
78 from traitlets import CBool, Enum
78 from traitlets import CBool, Enum
79
79
80 try:
80 import jedi
81 import jedi
81 import jedi.api.helpers
82 import jedi.api.helpers
82 import jedi.parser.user_context
83 import jedi.parser.user_context
84 JEDI_INSTALLED = True
85 except ImportError:
86 JEDI_INSTALLED = False
87
83
88 #-----------------------------------------------------------------------------
84 #-----------------------------------------------------------------------------
89 # Globals
85 # Globals
@@ -586,9 +582,6 b' class IPCompleter(Completer):'
586 When False [default]: the __all__ attribute is ignored
582 When False [default]: the __all__ attribute is ignored
587 """
583 """
588 )
584 )
589 use_jedi_completions = CBool(default_value=JEDI_INSTALLED, config=True,
590 help="""Use Jedi to generate autocompletions.
591 """)
592
585
593 def __init__(self, shell=None, namespace=None, global_namespace=None,
586 def __init__(self, shell=None, namespace=None, global_namespace=None,
594 use_readline=True, config=None, **kwargs):
587 use_readline=True, config=None, **kwargs):
@@ -832,8 +825,6 b' class IPCompleter(Completer):'
832
825
833 def python_matches(self, text):
826 def python_matches(self, text):
834 """Match attributes or global python names"""
827 """Match attributes or global python names"""
835 # Jedi completion
836
837 if "." in text:
828 if "." in text:
838 try:
829 try:
839 matches = self.attr_matches(text)
830 matches = self.attr_matches(text)
@@ -1264,8 +1255,7 b' class IPCompleter(Completer):'
1264 # different types of objects. The rlcomplete() method could then
1255 # different types of objects. The rlcomplete() method could then
1265 # simply collapse the dict into a list for readline, but we'd have
1256 # simply collapse the dict into a list for readline, but we'd have
1266 # richer completion semantics in other evironments.
1257 # richer completion semantics in other evironments.
1267 if self.use_jedi_completions:
1258 self.matches.extend(self.python_jedi_matches(text, line_buffer, cursor_pos))
1268 self.matches.extend(self.python_jedi_matches(text, line_buffer, cursor_pos))
1269
1259
1270 self.matches = sorted(set(self.matches), key=completions_sorting_key)
1260 self.matches = sorted(set(self.matches), key=completions_sorting_key)
1271
1261
General Comments 0
You need to be logged in to leave comments. Login now