diff --git a/jedi/api/helpers.py b/jedi/api/helpers.py index dd5a97bb..4f92b09f 100644 --- a/jedi/api/helpers.py +++ b/jedi/api/helpers.py @@ -6,7 +6,7 @@ from collections import namedtuple from jedi import common from jedi.evaluate import imports -from jedi.evaluate.helpers import deep_ast_copy, call_of_leaf +from jedi.evaluate.helpers import call_of_leaf from jedi import parser from jedi.parser import tokenize, token diff --git a/jedi/parser/fast.py b/jedi/parser/fast.py index af372542..291243d9 100644 --- a/jedi/parser/fast.py +++ b/jedi/parser/fast.py @@ -532,7 +532,8 @@ class FastTokenizer(object): self._parentheses_level = 0 # We need to simulate a newline before the indent, because the # open parentheses ignored them. - previous_type = NEWLINE + if re.search('\n\s*', prefix): + previous_type = NEWLINE # Parentheses ignore the indentation rules. The other three stand for # new lines.