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

Non-deterministic indentation when 2nd, 4th, etc arguments of methods are long #1061

Open
marquiswang opened this issue Mar 22, 2024 · 0 comments

Comments

@marquiswang
Copy link

marquiswang commented Mar 22, 2024

What happened?

Both of the following indentation levels are allowed, and depending on what the state of the code was before running the formatter, it is non-deterministic which one is output.

    Object object = foo(
            foo,
                    veryVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVeryyyyyyyyyyyyyVeryVeryLongVariableName,
            foo,
                    veryVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVeryyyyyyyyyyyyyVeryVeryLongVariableName);
    Object object = foo(
            foo,
            veryVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVeryyyyyyyyyyyyyVeryVeryLongVariableName,
            foo,
            veryVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVerVeryVeryyyyyyyyyyyyyVeryVeryLongVariableName);

What did you want to happen?

We should be deterministic/consistent about which indentation level is output by the formatter. I think the latter makes the most sense. In our case, we discovered this while using Map.of(), where the former indentation level does make some sense, but I don't think it makes sense to allow that just for Map.of().

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

1 participant