mformat: force multiline arguments with comma

Force multiline arguments when there is a trailing comma.
This is the behavior of muon.

Fixes #14721.
This commit is contained in:
Charles Brunet
2025-08-01 13:47:46 -04:00
committed by Eli Schwartz
parent 70b0de49f6
commit 0188454717
2 changed files with 12 additions and 0 deletions

View File

@ -242,6 +242,10 @@ class MultilineArgumentDetector(FullAstVisitor):
if node.is_multiline:
self.is_multiline = True
nargs = len(node)
if nargs and nargs == len(node.commas):
self.is_multiline = True
if self.is_multiline:
return

View File

@ -92,3 +92,11 @@ if meson.project_version().version_compare('>1.2')
# comment
endif
endif
# Test for trailing comma:
m = [1, 2, 3]
n = [
1,
2,
3,
]