palantir-java-format icon indicating copy to clipboard operation
palantir-java-format copied to clipboard

Allow overriding the formatter config (avoid breaking long method names into new lines)

Open mauriciogeneroso opened this issue 8 months ago • 0 comments

What happened?

The formatter should allow the users to set a config file and override the default formatting. There is a special case where I'd like to override the formatter config to avoid breaking long method names into new lines and it is not possible.

In Java, sometimes we have long method names for testing, and the formatter is formatting the method name to a new line:

    @Test
    void
            i_am_a_long_method_name_that_will_break_into_a_new_line_but_I_should_not_and_allow_something_to_override_it_and_customize_according_what_the_users_want() {}

What did you want to happen?

The formatter should allow to override configurations via config file. We could have properties like line-length-limit: X and then break to new line only when the method name is bigger than what is set in the config.

The expected output I'd like to get from the above example is:

@Test
void i_am_a_long_method_name_that_will_break_into_a_new_line_but_I_should_not_and_allow_something_to_override_it_and_customize_according_what_the_users_want() {}

mauriciogeneroso avatar Oct 20 '23 10:10 mauriciogeneroso