Skip to content

Commit

Permalink
Fix indentantion of opening parenthesis in condition syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
BlankSpruce committed Jun 23, 2020
1 parent 01c1fcc commit d03a59e
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion gersemi/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
__license__ = "MPL 2.0"
__title__ = "gersemi"
__url__ = "https://github.com/BlankSpruce/gersemi"
__version__ = "0.2.1"
__version__ = "0.2.2"
2 changes: 1 addition & 1 deletion gersemi/base_command_invocation_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(")")
Expand Down
7 changes: 7 additions & 0 deletions tests/formatter/condition_syntax.in.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
36 changes: 36 additions & 0 deletions tests/formatter/condition_syntax.out.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d03a59e

Please sign in to comment.