/externalcodeformatter_for_netbeans

Several external (e.g. Eclipse, Google, Spring, ...) code formatters integration for NetBeans

Eclipse Public License 2.0EPL-2.0

Release Build Status Linux Build Status Windows Build Status Coverage Status Code Coverage Codacy Badge Maven Central GitHub All Releases GitHub issues Eclipse Public License, Version 2.0 Follow Me On Twitter

External Code Formatters for NetBeans

(formerly known as Eclipse Java Code Formatter for NetBeans)

What is External Code Formatters Plugin for NetBeans

This plugin helps you to apply to a common code style in a team of Eclipse, IntelliJ and NetBeans IDE users. You can use several external code formatters inside the NetBeans IDE (see below), depending on whatever your co-workers use. The original formatting engine of Eclipse, the Google Code Formatter, the Spring Java Formatter and others are embedded and allow you to format the source code the same way as e.g. your co-workers do with their Eclipse IDE.

Global settings Project settings

Supported formatters

Features

  • Makes use of the internal NetBeans formatting API, which makes it possible to reuse built-in features like the format on save action or format only selected lines ... (since 1.13)
  • Global configuration and project specific configuration
  • Shows the used formatter in a notification (Disabled by default)
  • Supports profiles (since 1.6)
  • Preserve breakpoints (experimental) (since 1.8)
  • Code templates for @formatter:on/off (since 1.9)
  • Supports Workspace Mechanic configuration file (since 1.10)
  • Support configuration from .settings/org.eclipse.jdt.core.prefs (absolute and relative paths) (since 1.10)
  • Support configuration of linefeed (since 1.10)
  • Support configuration of source level (since 1.10)
  • Support for macro invocation (since 1.12)
  • Support for guarded documents (documents that are created by the NetBeans GUI builder, guarded blocks are skipped of course, but everything in between can be formatted), only for Eclipse Java Code Formatter (since 1.13)
  • Support for Google code formatter (since 1.13)
  • Support for Spring Java formatter (since 1.14)
  • Support for Eclipse Javascript formatter (since 1.14)
  • Support for revelc.net XML formatter (since 1.14)
  • Support for Jsoup XML formatter (since 1.14)
  • Support for Jackson Json formatter (since 1.14)
  • Support for manticore JSQLFormatter (Special thanks to Andreas Reichel for the contribution) (since 1.14.1)
  • Support for remote configurations for Eclipse formatters (since 1.14.1)
  • Support for Palantir Java Formatter (since 1.15.0)
  • Support for Vertical Blank SQL Formatter (since 1.15.0)
  • Support for DBeaver (via Spotless) (since 1.15.0)
  • Option to organize imports with Google and Palantir Formatter instead of NetBeans (since 1.15.2)
  • Support for Jsoup HTML formatter (since 1.15.3)
  • Support for CSS Parser (since 1.15.3)

Compatibility

Compatible with NetBeans 12.0+ and JDK 17+.

Downloads

The latest version should be available in the plugin catalog of your NetBeans IDE, but just in case you can find the download links here.

Known issues

Please check the open GitHub Issues and see here

Note

Please note that this plugin only provides support for formatting. Eclipse users may miss the application of save-actions like "adding @Override annotations" or "member sort order". Such AST-based transformations are not provided by this plugin.

Feedback

Provide defects, requests for enhancements or general feedback at the GitHub issues page. Please check the known issues (see above) before you create an issue and check if your issue also appears in the latest development version (download links can be found here).

Changelog

You can find the changelog of all versions here

Licensing

This plugin is licensed under the Eclipse Public License, Version 2.0. This plugin uses third-party libraries, which are needed to provide its functionality, please check their licenses here.

The history of this project

  • The original idea is based on this blog entry from Willie Scholtz
  • Geertjan Wielenga made further investigations on that idea and put everything together to create a first NetBeans Plugin out of this idea
  • This was then forked by Benno Markiewicz
  • Benno Markiewicz stopped the development on the plugin and so Geertjan Wielenga forked it again and was looking for someone who wanted to take it over
  • I think I used this plugin since I use NetBeans, because in every company I was so far, I had exactly this circumstance that the formatting configuration was always there for Eclipse, but not for NetBeans. And because I prefer NetBeans over Eclipse I had to find a way to use NetBeans but the code style configuration from Eclipse. I'm happy that I can give back something to the community now by continuing the development of this plugin.

Support

Keep this project alive by supporting it: one-time Donate or Patreon! or become a Sponsor or just Buy me a drink

If you can't or don't want to spend money you can also say thanks