From 23c14f68263db51b16247e00885dc931092a770c Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sat, 9 Mar 2019 13:35:54 +0100 Subject: [PATCH] With typeshed coming to Jedi, builtin modules should be displayed (If there's a module_path (which most will have)). This change is still backwards compatible and can be used with older Jedi versions (<0.14.0). --- pythonx/jedi_vim.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pythonx/jedi_vim.py b/pythonx/jedi_vim.py index 4419b48..71dbf20 100644 --- a/pythonx/jedi_vim.py +++ b/pythonx/jedi_vim.py @@ -309,7 +309,7 @@ def goto(mode="goto"): echo_highlight("Couldn't find any definitions for this.") elif len(definitions) == 1 and mode != "related_name": d = list(definitions)[0] - if d.in_builtin_module(): + if d.module_path is None: if d.is_keyword: echo_highlight("Cannot get the definition of Python keywords.") else: @@ -372,9 +372,7 @@ def show_goto_multi_results(definitions): """Create a quickfix list for multiple definitions.""" lst = [] for d in definitions: - if d.in_builtin_module(): - lst.append(dict(text=PythonToVimStr('Builtin ' + d.description))) - elif d.module_path is None: + if d.module_path is None: # Typically a namespace, in the future maybe other things as # well. lst.append(dict(text=PythonToVimStr(d.description))) @@ -740,7 +738,7 @@ def py_import(): except IndexError: echo_highlight('Cannot find %s in sys.path!' % import_path) else: - if completion.in_builtin_module(): + if completion.module_path is None: echo_highlight('%s is a builtin module.' % import_path) else: cmd_args = ' '.join([a.replace(' ', '\\ ') for a in args])