diff --git a/jedi/parser/fast.py b/jedi/parser/fast.py index 0904d7e6..ac0f2aef 100644 --- a/jedi/parser/fast.py +++ b/jedi/parser/fast.py @@ -419,8 +419,11 @@ class FastTokenizer(object): self.closed = True raise common.MultiLevelStopIteration() - # ignore comments/ newlines - if self.previous.type in (None, NEWLINE) and tok_type not in (COMMENT, NEWLINE): + # Ignore comments/newlines/closing parentheses, because they are all + # irrelevant for the indentation. + if self.previous.type in (None, NEWLINE) \ + and tok_type not in (COMMENT, NEWLINE) \ + and tok_str not in ')]}': # print c, tok_name[c[0]] indent = current.start_pos[1] if indent < self.parser_indent: # -> dedent @@ -428,6 +431,7 @@ class FastTokenizer(object): self.new_indent = False if not self.in_flow or indent < self.old_parser_indent: close() + self.in_flow = False elif self.new_indent: self.parser_indent = indent @@ -438,6 +442,7 @@ class FastTokenizer(object): self.in_flow = tok_str in FLOWS if not self.is_decorator and not self.in_flow: close() + self.is_decorator = '@' == tok_str if not self.is_decorator: self.old_parser_indent = self.parser_indent diff --git a/test/completion/parser.py b/test/completion/parser.py index 60c84787..5de5b337 100644 --- a/test/completion/parser.py +++ b/test/completion/parser.py @@ -3,7 +3,11 @@ Issues with the parser not the completion engine should be here. """ class C(): - """ issue jedi-vim#288 """ + """ + issue jedi-vim#288 + Which is really a fast parser issue. It used to start a new block at the + parentheses, because it had problems with the indentation. + """ def indent_issues( self, ):