Skip to content

A VS Code extension that formats Java files with the Prettier formatter

License

Notifications You must be signed in to change notification settings

dcordz/java-prettier-formatter

 
 

Repository files navigation

Java prettier formatter

A formatter for Java files that uses the Prettier formatter.

Installation

Install via the VS Code marketplace.

Usage

For one time use:-

  • Open the Command Palette (ctrl+shift+p).
  • Select 'Format Document With...' or 'Format Document' if this formatter is the only Java formatter installed.
  • Select 'Java prettier formatter'.

To set as default formatter for Java files:-

  • Open the Command Palette (ctrl+shift+p).
  • Select 'Preferences: Configure Language Specific Settings'.
  • Select 'Java'.
  • Add
"editor.defaultFormatter": "mwpb.java-prettier-formatter"

into the [java] section. Then the formatter should be available with Alt+Shift+f on windows and `Ctrl+Shift+i1 on Linux.

Configuration

Place a .prettierrc in your workspace. (Or alternatively an appropriate .editorconfig.) Changes require restart to take effect.

Summary of deploy process

  • npm i -g vsce
  • vsce package
  • vsce publish

Acknowledgments

This package completes the 'last yard' to use Prettier with Java files in VS Code in a standalone way. The hard work and credit is due to:-

About

A VS Code extension that formats Java files with the Prettier formatter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%