forked from VimPlug/jedi-vim
goto: fix return value to always be a list
Fixes https://github.com/davidhalter/jedi-vim/issues/414#issuecomment-101341260
This commit is contained in:
@@ -199,9 +199,10 @@ def completions():
|
|||||||
@catch_and_print_exceptions
|
@catch_and_print_exceptions
|
||||||
def goto(mode = "goto", no_output=False):
|
def goto(mode = "goto", no_output=False):
|
||||||
"""
|
"""
|
||||||
mode: "related_name", "definition", "assignment", "auto".
|
:param str mode: "related_name", "definition", "assignment", "auto"
|
||||||
|
:return: list of definitions/assignments
|
||||||
|
:rtype: list
|
||||||
"""
|
"""
|
||||||
definitions = []
|
|
||||||
script = get_script()
|
script = get_script()
|
||||||
try:
|
try:
|
||||||
if mode == "goto":
|
if mode == "goto":
|
||||||
@@ -217,6 +218,7 @@ def goto(mode = "goto", no_output=False):
|
|||||||
definitions = script.goto_assignments()
|
definitions = script.goto_assignments()
|
||||||
except jedi.NotFoundError:
|
except jedi.NotFoundError:
|
||||||
echo_highlight("Cannot follow nothing. Put your cursor on a valid name.")
|
echo_highlight("Cannot follow nothing. Put your cursor on a valid name.")
|
||||||
|
definitions = []
|
||||||
else:
|
else:
|
||||||
if no_output:
|
if no_output:
|
||||||
return definitions
|
return definitions
|
||||||
@@ -239,7 +241,7 @@ def goto(mode = "goto", no_output=False):
|
|||||||
if d.module_path != vim.current.buffer.name:
|
if d.module_path != vim.current.buffer.name:
|
||||||
result = new_buffer(d.module_path)
|
result = new_buffer(d.module_path)
|
||||||
if not result:
|
if not result:
|
||||||
return
|
return []
|
||||||
vim.current.window.cursor = d.line, d.column
|
vim.current.window.cursor = d.line, d.column
|
||||||
else:
|
else:
|
||||||
# multiple solutions
|
# multiple solutions
|
||||||
|
|||||||
Reference in New Issue
Block a user