External Java Code Formatters for NetBeans

GroupId: de.funfried.netbeans.plugins
ArtifactId: externalcodeformatter
Author:Fabian Bahle
License:Eclipse Public License, Version 2.0
Homepage:https://funfried.github.io/externalcodeformatter_for_netbeans/

2020-02-09     2024-11-20     153,975

Editing  


Download matrix

Plugin version NetBeans compatible
1.13.0 NB 13   NB 12.0   NB 11.0  
1.14.0 NB 13   NB 12.0   NB 11.0 - Verified  
1.14.1 NB 13   NB 12.0  
1.14.2 NB 13   NB 12.0  
1.14.3 NB 13   NB 12.0  
1.14.4 NB 13   NB 12.0  
1.14.5 NB 13   NB 12.0  
1.15.0 NB 13   NB 12.0  
1.15.1 NB 15   NB 14   NB 13 - Verified   NB 12.0 - Verified  
1.15.2 NB 17   NB 16 - Verified   NB 13   NB 12.0   NB 15 - Verified   NB 14 - Verified  
1.15.3 NB 21   NB 20   NB 19   NB 18   NB 16   NB 15   NB 14   NB 13   NB 12.0   NB 17  
1.15.4 NB 23   NB 22   NB 21   NB 20   NB 19   NB 18   NB 17  
1.15.5 NB 24 - Verification pending   NB 23 - Verified   NB 22 - Verified   NB 21 - Verified   NB 20 - Verified   NB 19 - Verified   NB 18 - Verified   NB 17 - Verified  

Intro

External Code Formatters (Eclipse Java and JS Formatter, Google Java Formatter, Spring Java Formatter, Palantir Java Formatter, Jackson JSON Formatter, JSQLFormatter, DBeaver SQL Formatter, ...) Integration for NetBeans. This plugin will allow you to use formatters which might be used from your co-workers or have become the business standard in your workplace. You can choose a default formatter for each supported language and you can override it (also with the default NetBeans formatter) per project in the NetBeans project settings.

Description

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, 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.

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 external formatter configuration for all projects and/or project specific configurations
  • Can show the used formatter in a NetBeans notification (Disabled by default)
  • Eclipse formatter (profiles, custom linefeeds, custom source levels, macro invocation, remote and Workspace Mechanic configurations as well as .settings/org.eclipse.jdt.core.prefs (absolute and relative paths), ...)
  • Code templates for @formatter:on/off (not supported by all formatters, but e.g. Eclipse formatter, Spring formatter, ...)
  • 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), not supported by the Google Java Code Formatter
  • Includes many well-known Java formatters like the Google code formatter, the Spring Java formatter, Eclipse Java formatter and more
  • Includes also non-Java formatters like XML formatters (revelc.net and Jsoup) as well as the Jackson JSON formatter and even an SQL formatter (manticore JSQLFormatter; special thanks to Andreas Reichel for the contribution)

global.png

project.png

Known issues:

  • Updating the breakpoints after formatting acts not exactly the same way as for the internal NetBeans formatter, but it's pretty close.
  • Guarded blocks are not supported for the Google Java Code Formatter. There seems to be a bug in the Google Java Code Formatter which prevents this feature to work. Further details on this bug can be watched 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.

This plugin uses third-party libraries, which are needed to provide its functionality, please check their licenses here

For more information go to http://funfried.github.io/externalcodeformatter_for_netbeans/ or https://github.com/funfried/externalcodeformatter_for_netbeans

Provide defects, request for enhancements and feedback at https://github.com/funfried/externalcodeformatter_for_netbeans/issues

Donate via PayPal

Become a patron

Buy me a virtual drink

Say Thanks