forked from VimPlug/jedi
Fix issues around whitespace after dot completions, fixes #1954
This commit is contained in:
@@ -291,6 +291,8 @@ class Completion:
|
|||||||
)
|
)
|
||||||
elif nonterminals[-1] in ('trailer', 'dotted_name') and nodes[-1] == '.':
|
elif nonterminals[-1] in ('trailer', 'dotted_name') and nodes[-1] == '.':
|
||||||
dot = self._module_node.get_leaf_for_position(self._position)
|
dot = self._module_node.get_leaf_for_position(self._position)
|
||||||
|
if dot.type == "newline":
|
||||||
|
dot = dot.get_previous_leaf()
|
||||||
if dot.type == "endmarker":
|
if dot.type == "endmarker":
|
||||||
# This is a bit of a weird edge case, maybe we can somehow
|
# This is a bit of a weird edge case, maybe we can somehow
|
||||||
# generalize this.
|
# generalize this.
|
||||||
|
|||||||
@@ -867,3 +867,9 @@ def test_star_import_completions():
|
|||||||
|
|
||||||
assert 'dump' in names
|
assert 'dump' in names
|
||||||
assert 'dumps' in names
|
assert 'dumps' in names
|
||||||
|
|
||||||
|
|
||||||
|
def test_whitespace_after_dot_completion(Script):
|
||||||
|
# From #1954
|
||||||
|
completions = jedi.Interpreter("object. \n", []).complete(1, 8)
|
||||||
|
assert "mro" in [c.name for c in completions]
|
||||||
|
|||||||
Reference in New Issue
Block a user