Skip to content

bash-spbu/intellij-java-code-aligner

Repository files navigation

Java Code Aligner

Build Version Downloads

Provides displaying the Java code as aligned horizontally in columns without actual formatting of the code.

It mainly serves for increasing code readability and reducing tension when reading dozens of tightly placed code lines with different elements.

More formally the plugin provides:

  • alignment of consecutive fields, local variables and params in columns of annotations, modifiers, types, names, initializers;
  • alignment of consecutive assignments by the equal sign;
  • pretty rich set of alignment settings in File | Settings | Editor | Inlay Hints | Java | Java Code Aligner.

Please note, that fields alignment is performed only if its modifiers are placed in the canonical order.

From the technical side, plugin works by adding invisible inlay hints (like the ones shown as parameter names for method calls), which can be made visible via Enable debug mode in settings above.

Additionally, the plugin provides folding of explicit types to var and final var for local variable declarations, which can be enabled in File | Settings | Editor | General | Code Folding | Java Code Aligner.

Screenshots

Fields alignment:

Fields alignment demo

Params alignment:

Params alignment

Local variables declaration alignment:

Local variables declaration alignment demo

Local variables declaration with folded types alignment:

Local variables declaration with folded types demo

Alignment settings:

Alignment settings demo

Local variables types folding settings:

Local variables types folding settings demo

Installation

  • Using IDE built-in plugin system:

    Settings/Preferences > Plugins > Marketplace > Search for " intellij-java-code-aligner" > Install Plugin

  • Manually:

    Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...


Plugin based on the IntelliJ Platform Plugin Template.