Skip to content

Commit 83d912d

Browse files
committed
Add a fix for wrapping of container literals in function args.
1 parent 510ac63 commit 83d912d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

yapf/yapflib/format_decision_state.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ def MustSplit(self):
199199

200200
# Avoid breaking in a container that fits in the current line if possible
201201
opening = _GetOpeningBracket(current)
202+
# If at the start of a container, then we need to double check if it is
203+
# actually nested.
204+
if opening == current:
205+
opening = _GetOpeningBracket(previous)
202206

203207
# Can't find opening bracket, behave the same way as
204208
# SPLIT_ALL_COMMA_SEPARATED_VALUES.
@@ -384,7 +388,6 @@ def SurroundedByParens(token):
384388

385389
###########################################################################
386390
# Argument List Splitting
387-
388391
if style.Get('SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED'):
389392
# Split before arguments in a function call or definition if the
390393
# arguments are terminated by a comma.

0 commit comments

Comments
 (0)