forked from VimPlug/jedi
Fix an issue with call signatures in empty files.
This commit is contained in:
@@ -252,7 +252,10 @@ def get_call_signature_details(module, position):
|
|||||||
leaf = module.get_leaf_for_position(position, include_prefixes=True)
|
leaf = module.get_leaf_for_position(position, include_prefixes=True)
|
||||||
if leaf.start_pos >= position:
|
if leaf.start_pos >= position:
|
||||||
# Whitespace / comments after the leaf count towards the previous leaf.
|
# Whitespace / comments after the leaf count towards the previous leaf.
|
||||||
leaf = leaf.get_previous_leaf()
|
try:
|
||||||
|
leaf = leaf.get_previous_leaf()
|
||||||
|
except IndexError:
|
||||||
|
return None
|
||||||
|
|
||||||
if leaf == ')':
|
if leaf == ')':
|
||||||
if leaf.end_pos == position:
|
if leaf.end_pos == position:
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ def test_no_signature():
|
|||||||
X()(""")
|
X()(""")
|
||||||
assert Script(s).call_signatures() == []
|
assert Script(s).call_signatures() == []
|
||||||
assert len(Script(s, column=2).call_signatures()) == 1
|
assert len(Script(s, column=2).call_signatures()) == 1
|
||||||
|
assert Script('').call_signatures() == []
|
||||||
|
|
||||||
|
|
||||||
def test_dict_literal_in_incomplete_call():
|
def test_dict_literal_in_incomplete_call():
|
||||||
|
|||||||
Reference in New Issue
Block a user