Skip to content

Commit

Permalink
Merge pull request #22 from JohanMabille/jedi_opt
Browse files Browse the repository at this point in the history
Optinally use jedi for autocompletion
  • Loading branch information
martinRenou authored May 31, 2024
2 parents a9ae835 + 5aac772 commit 36ca15e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions xeus_python_shell/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ def __init__(self, shell=None, config=None, **traits):


class XPythonShell(InteractiveShell):
def __init__(self, *args, **kwargs):
def __init__(self, use_jedi, *args, **kwargs):
super(XPythonShell, self).__init__(*args, **kwargs)

self.kernel = None
self.Completer.use_jedi = False
self.Completer.use_jedi = use_jedi

def enable_gui(self, gui=None):
"""Not implemented yet."""
Expand Down Expand Up @@ -76,15 +76,15 @@ def complete_code(self, code, cursor_pos):


class XPythonShellApp(BaseIPythonApplication, InteractiveShellApp):
def initialize(self, argv=None):
def initialize(self, use_jedi, argv=None):
super(XPythonShellApp, self).initialize(argv)

self.user_ns = {}

# self.init_io() ?

self.init_path()
self.init_shell()
self.init_shell(use_jedi)

if not os.environ.get("MPLBACKEND"):
os.environ["MPLBACKEND"] = "module://matplotlib_inline.backend_inline"
Expand All @@ -96,8 +96,9 @@ def initialize(self, argv=None):
sys.stdout.flush()
sys.stderr.flush()

def init_shell(self):
def init_shell(self, use_jedi):
self.shell = XPythonShell.instance(
use_jedi,
display_pub_class=XDisplayPublisher,
displayhook_class=XDisplayHook,
compiler_class=XCachingCompiler,
Expand Down

0 comments on commit 36ca15e

Please sign in to comment.