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

[Feature Request] Add Support for Trailing Comma Formatting (Like Python's black) #125

Closed
0samuraiE opened this issue Dec 15, 2024 · 1 comment

Comments

@0samuraiE
Copy link

0samuraiE commented Dec 15, 2024

Description

In Python's black formatter, adding a trailing comma to a tuple ensures that each element is formatted on a separate line. This feature greatly enhances readability for multi-line collections, especially when dealing with large datasets or complex structures.

For example:

# Without trailing comma
my_tuple = ("item1", "item2", "item3")

# With trailing comma
my_tuple = (
    "item1",
    "item2",
    "item3",
)

I would like to request a similar feature in Runic, where trailing commas can dictate line-breaking behavior for collections (e.g., tuples, lists, dictionaries, function arguments). This would align with common formatting standards and improve the readability of formatted code.

Use Case

  • Working with collections that contain many elements.
  • Writing clean and easily reviewable code in collaborative environments.
@fredrikekre
Copy link
Owner

Thanks for trying out Runic.

Runic currently doesn't do much line breaking (#61). The two styles you suggest here are already accepted by Runic so you can manually format it like this (or write an editor macro to do it for you). Even if Runic does line breaking in the future I don't think doing it based on such a suble thing (,) is very nice and I don't think Runic would put one item per line anyway, but rather use as much of the line as permitted.

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