Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jedi/api/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def _complete_python(self, leaf):
)
elif nonterminals[-1] in ('trailer', 'dotted_name') and nodes[-1] == '.':
dot = self._module_node.get_leaf_for_position(self._position)
if dot.type == "endmarker":
if dot.type in ("endmarker", "newline"):
# This is a bit of a weird edge case, maybe we can somehow
# generalize this.
dot = leaf.get_previous_leaf()
Expand Down
5 changes: 5 additions & 0 deletions test/test_api/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,3 +461,8 @@ def test_module_completions(Script, module):

def test_whitespace_at_end_after_dot(Script):
assert 'strip' in [c.name for c in Script('str. ').complete()]


def test_whitespace_and_newline_after_dot(Script):
"""Regression test for issue #1954."""
assert 'mro' in [c.name for c in Script('object. \n').complete(1, 8)]