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

Formatting of multi-line list literals #133

Closed
ovatsus opened this issue Feb 6, 2014 · 1 comment
Closed

Formatting of multi-line list literals #133

ovatsus opened this issue Feb 6, 2014 · 1 comment

Comments

@ovatsus
Copy link

ovatsus commented Feb 6, 2014

This:

let xxxxxxxxxxxx = ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                    "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                    "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]

is turned into this:

let xxxxxxxxxxxx = 
    [ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ]

I think the first is better when the items of the list are that long. Even if the full list fits into the 120 chars, if each element is bigger than a given threshold (say 30), we should put it on separate lines instead of adding the semi colons

Interestingly, I had this which fitted on the 120:

    for abcdefg in [[]; [abcdef]; [abcdefghijk]; [abcdefghijk;abcdef]] do

and it was turned into this:

    for abcdefg in [ []
                     [ abcdef ]
                     [ abcdefghijk ]
                     [ abcdefghijk; abcdef ] ] do
@nojaf
Copy link
Contributor

nojaf commented Jul 12, 2019

If the list or array as a whole is a code construct that spans over multiple lines, Fantomas will now put each item on its own line.
In case it is small and fits on one line, it will format it that way.

@nojaf nojaf closed this as completed Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants