yapf icon indicating copy to clipboard operation
yapf copied to clipboard

Nested brackets split across multiple lines formats incorrectly with `continuation_align_style = fixed`

Open alexreg opened this issue 4 years ago • 2 comments

An example best illustrates the issue. Clearly, the sample code (pre-formatting) should be left unchanged by yapf, but its indentation is instead messed up.

Sample code (pre-formatting)

foo = Foo(
	[
		(0, 1),
		(0, 1),
		(0, 1),
		(0, 1),
	],
	[],
)

Sample code (post-formatting)

foo = Foo(
    [
    (0, 1),
    (0, 1),
    (0, 1),
    (0, 1),
    ],
    [],
)

Config file

[style]
continuation_align_style = fixed

alexreg avatar Oct 28 '21 19:10 alexreg

Maybe you can set up: continuation_align_style=valign-right

It indeed works on my side.

Jieli12 avatar Nov 03 '21 16:11 Jieli12

@Jieli12 Thank you, that seems to work. Is the behaviour with fixed to be expected that? I wasn't quite clear from the docs what it's meant to do.

alexreg avatar Nov 03 '21 17:11 alexreg