diff --git a/CHANGELOG.md b/CHANGELOG.md index 73b55bd..d228b6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [0.2.2] 2020-06-23 + +### Fixed +- fixed condition syntax formatting edge-case with opening parenthesis indentation + ## [0.2.1] 2020-06-20 ### Fixed diff --git a/gersemi/__version__.py b/gersemi/__version__.py index 88f56c2..0b6f644 100644 --- a/gersemi/__version__.py +++ b/gersemi/__version__.py @@ -4,4 +4,4 @@ __license__ = "MPL 2.0" __title__ = "gersemi" __url__ = "https://github.com/BlankSpruce/gersemi" -__version__ = "0.2.1" +__version__ = "0.2.2" diff --git a/gersemi/base_command_invocation_dumper.py b/gersemi/base_command_invocation_dumper.py index 30fb9d9..b5c897b 100644 --- a/gersemi/base_command_invocation_dumper.py +++ b/gersemi/base_command_invocation_dumper.py @@ -54,7 +54,7 @@ def complex_argument(self, tree): if result is not None: return result - begin = "(\n" + begin = self._indent("(\n") with self.indented(): formatted_arguments = self.visit(arguments) end = self._indent(")") diff --git a/tests/formatter/condition_syntax.in.cmake b/tests/formatter/condition_syntax.in.cmake index 50490a6..7e11cb7 100644 --- a/tests/formatter/condition_syntax.in.cmake +++ b/tests/formatter/condition_syntax.in.cmake @@ -11,6 +11,13 @@ endif() if(FOO AND BAR AND BAZ) endif() +if((FOO__________________________________________________ AND BAR__________________________________________________) OR (BAZ__________________________________________________ OR QUX__________________________________________________)) +endif() + +if(((FOO__________________________________________________ AND BAR__________________________________________________) OR (BAZ__________________________________________________ OR QUX__________________________________________________)) AND ((FOO__________________________________________________ AND BAR__________________________________________________) OR (BAZ__________________________________________________ OR QUX__________________________________________________))) +endif() + + if(FOO AND BAR #BAR AND BAZ #BAZ ) diff --git a/tests/formatter/condition_syntax.out.cmake b/tests/formatter/condition_syntax.out.cmake index cbf6181..d2711eb 100644 --- a/tests/formatter/condition_syntax.out.cmake +++ b/tests/formatter/condition_syntax.out.cmake @@ -12,6 +12,42 @@ endif() if(FOO AND BAR AND BAZ) endif() +if( + ( + FOO__________________________________________________ + AND BAR__________________________________________________ + ) + OR ( + BAZ__________________________________________________ + OR QUX__________________________________________________ + ) +) +endif() + +if( + ( + ( + FOO__________________________________________________ + AND BAR__________________________________________________ + ) + OR ( + BAZ__________________________________________________ + OR QUX__________________________________________________ + ) + ) + AND ( + ( + FOO__________________________________________________ + AND BAR__________________________________________________ + ) + OR ( + BAZ__________________________________________________ + OR QUX__________________________________________________ + ) + ) +) +endif() + if( FOO AND BAR #BAR