spring-io/spring-javaformat

line wrap at 90 chars, instead of 120

Closed this issue · 8 comments

The source formatter uses 120 chars for wrapping. This aims to strike a balance between making use of available horizontal space in your IDE and avoiding unwanted additional wrapping when viewing code on GitHub and the like.

but it seems in both intellij and vscode, the line breaks at 90 chars

It was a conscious decision to move from 90 chars to 120 and it's unlikely that we'll drop back to 90 again.

but it seems in both intellij and vscode, the line breaks at 90 chars

When configured to use this formatter, both IntelliJ and vscode should honor its 120 char line width. Is that not what you're seeing?

I'm afraid not, the line indeed breaks at col 90, I'm using IntelliJ along with the formatter for a Java project, not using Maven or Gradle

Given that you're not using Maven or Gradle, do you have the .springjavaformatconfig file that is required to activate the formatter? The status bar should indicate if the formatter's active.

If you believe that the required file's in place but the formatter's not active, or the formatter's active but it's not formatting the code as expected, please share a minimal IntelliJ project that reproduces the problem and we can take a look.

CleanShot 2024-11-10 at 00 20 05@2x
CleanShot 2024-11-10 at 00 17 12@2x

We still wrap javadoc and comments at 90 chars (see this part of the config). This was an intentional choice since we thought it would be useful to still have readable javadoc on smaller screens. I'm not totally sure that we should change it at this point, although it is a little inconsistent with the code wrapping.

Thanks

We still wrap javadoc and comments at 90 chars (see this part of the config). This was an intentional choice since we thought it would be useful to still have readable javadoc on smaller screens. I'm not totally sure that we should change it at this point, although it is a little inconsistent with the code wrapping.

@philwebb is it possible to overwrite this setting in IntelliJ to align with the 120 chars?

@andreasevers, only by forking the project I'm afraid. We're intentionally trying to limit the configuration options we support. From the README:

Since the aim of this project is to provide consistency, each plugin is not generally configurable. You need to change your code to match the required conventions. You can’t configure the plugin conventions to match your style!