Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent double indenting when splitting function parameters in if or with #982

Open
char101 opened this issue Dec 15, 2021 · 3 comments
Open

Comments

@char101
Copy link
Contributor

char101 commented Dec 15, 2021

Hi, is this supported by yapf configuration if I want to prevent the function parameters from being indented twice in this case:

if func(
    a,
    b,
):
    pass

Output:

if func(
        a,
        b,
):
    pass

Desired output:

if func(
    a,
    b,
):
    pass

I can get the output that I want by changing https://github.com/google/yapf/blob/main/yapf/yapflib/format_decision_state.py#L980 from

return token_indent + style.Get('CONTINUATION_INDENT_WIDTH')

to

return token_indent

But I wonder if this is configurable.

@sinoroc
Copy link

sinoroc commented Jan 16, 2022

Looks like I have the opposite issue: #843 ; maybe you find something helpful in this ticket and its links.

@NoamNol
Copy link

NoamNol commented Jun 22, 2022

It's only when CONTINUATION_INDENT_WIDTH = 4 ):
DEDENT_CLOSING_BRACKETS = true solved it in function definition but not in function call

@quancs
Copy link

quancs commented Jul 31, 2024

mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants