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

Unstable formatting of parenthesized implicit string concatenation #5893

Closed
konstin opened this issue Jul 19, 2023 · 2 comments · Fixed by #6852
Closed

Unstable formatting of parenthesized implicit string concatenation #5893

konstin opened this issue Jul 19, 2023 · 2 comments · Fixed by #6852
Assignees
Labels
bug Something isn't working formatter Related to the formatter

Comments

@konstin
Copy link
Member

konstin commented Jul 19, 2023

This snippet causes unstable formatting:

x = ("""aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa""" """bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb""")

We first break it, then realize it fits in a line without the parentheses and undo that:

---
--- Formatted once
+++ Formatted twice
@@ -1,4 +1 @@
-x = (
-    """aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"""
-    """bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"""
-)
+x = """aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa""" """bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"""
---

Formatted once:
---
x = (
    """aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"""
    """bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"""
)
---

Formatted twice:
---
x = """aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa""" """bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"""
---
@konstin konstin added bug Something isn't working formatter Related to the formatter labels Jul 19, 2023
@MichaReiser
Copy link
Member

This could be related to it being in the assignment position.

Playground

@MichaReiser MichaReiser added this to the Formatter: Alpha milestone Aug 16, 2023
@MichaReiser MichaReiser self-assigned this Aug 22, 2023
@MichaReiser
Copy link
Member

I'm taking this on as it seems to be fixed in my local branch for #6271

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatter Related to the formatter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants