Modules should be accessible if column is not None

This commit is contained in:
Dave Halter
2019-06-20 23:46:34 +02:00
parent 1a053d2a23
commit 73289427ba

View File

@@ -311,7 +311,7 @@ def goto(mode="goto"):
echo_highlight("Couldn't find any definitions for this.") echo_highlight("Couldn't find any definitions for this.")
elif len(definitions) == 1 and mode != "related_name": elif len(definitions) == 1 and mode != "related_name":
d = list(definitions)[0] d = list(definitions)[0]
if d.module_path is None: if d.column is None:
if d.is_keyword: if d.is_keyword:
echo_highlight("Cannot get the definition of Python keywords.") echo_highlight("Cannot get the definition of Python keywords.")
else: else:
@@ -374,7 +374,7 @@ def show_goto_multi_results(definitions):
"""Create a quickfix list for multiple definitions.""" """Create a quickfix list for multiple definitions."""
lst = [] lst = []
for d in definitions: for d in definitions:
if d.module_path is None: if d.column is None:
# Typically a namespace, in the future maybe other things as # Typically a namespace, in the future maybe other things as
# well. # well.
lst.append(dict(text=PythonToVimStr(d.description))) lst.append(dict(text=PythonToVimStr(d.description)))
@@ -740,7 +740,7 @@ def py_import():
except IndexError: except IndexError:
echo_highlight('Cannot find %s in sys.path!' % import_path) echo_highlight('Cannot find %s in sys.path!' % import_path)
else: else:
if completion.module_path is None: if completion.column is None: # Python modules always have a line number.
echo_highlight('%s is a builtin module.' % import_path) echo_highlight('%s is a builtin module.' % import_path)
else: else:
cmd_args = ' '.join([a.replace(' ', '\\ ') for a in args]) cmd_args = ' '.join([a.replace(' ', '\\ ') for a in args])