aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorWill Ayd <william.ayd@icloud.com>2025-04-22 14:12:04 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2025-04-29 13:22:54 +0300
commitd028502e8fd6dbc7fbdb8992f164fcb749757c87 (patch)
tree22a6c4c9ee1ec53def87f60f6e0680edd90a3140 /mesonbuild
parent14cf183194768449e571fc6e5b7e20f10afde30f (diff)
downloadmeson-d028502e8fd6dbc7fbdb8992f164fcb749757c87.zip
meson-d028502e8fd6dbc7fbdb8992f164fcb749757c87.tar.gz
meson-d028502e8fd6dbc7fbdb8992f164fcb749757c87.tar.bz2
Fix meson format with multi line parenthesized expressions
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/mformat.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/mesonbuild/mformat.py b/mesonbuild/mformat.py
index 92729a0..1e134f5 100644
--- a/mesonbuild/mformat.py
+++ b/mesonbuild/mformat.py
@@ -536,7 +536,7 @@ class TrimWhitespaces(FullAstVisitor):
def visit_ParenthesizedNode(self, node: mparser.ParenthesizedNode) -> None:
self.enter_node(node)
- is_multiline = node.lpar.whitespaces and '#' in node.lpar.whitespaces.value
+ is_multiline = node.lpar.lineno != node.rpar.lineno
if is_multiline:
self.indent_comments += self.config.indent_by
@@ -546,7 +546,8 @@ class TrimWhitespaces(FullAstVisitor):
if is_multiline:
node.inner.whitespaces.value = self.dedent(node.inner.whitespaces.value)
self.indent_comments = self.dedent(self.indent_comments)
- self.add_nl_after(node.inner)
+ if node.lpar.whitespaces and '\n' in node.lpar.whitespaces.value:
+ self.add_nl_after(node.inner)
node.rpar.accept(self)
self.move_whitespaces(node.rpar, node)