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

Knob to modify dict alignment #346

Open
advance512 opened this issue Dec 13, 2016 · 2 comments
Open

Knob to modify dict alignment #346

advance512 opened this issue Dec 13, 2016 · 2 comments

Comments

@advance512
Copy link

PyCharm support the following formatting configuration for dicts:

Original:

{"green": 42, "eggs and ham": -0.0e0}

Dict alignment: align on value

{
    "green":        42,
    "eggs and ham": -0.0e0,
}

Dict alignment: align on colon

{
    "green"       : 42,
    "eggs and ham": -0.0e0,
}

A knob to modify this setting in yapf would be great, and would prevent the yapf / PyCharm style formatting loop I've found myself in.

@bwendling
Copy link
Member

A knob would be okay. But first tell me more about what this formatting would be like. For instance, if the value is multiline or starts on the line following the key, would the colons still line up?

{
    "green"       :
        this_is_a_very_long_function_name_that_does_not_fit(42, 29, 23)
    "eggs and ham":
        -0.0e0,
}

@advance512
Copy link
Author

Yes, they do still line up:

Align on colon:

{
    "green"       :
        this_is_a_very_long_function_name_that_does_not_fit(42, 29, 23)
    "eggs and ham":
        -0.0e0,
}

align on value:

{
    "green":
        this_is_a_very_long_function_name_that_does_not_fit(42, 29, 23)
    "eggs and ham":
        -0.0e0,
}

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

2 participants