Prettier Java Plugin
Clone or download
Latest commit a95a7d6 Jan 15, 2019

🚧 Work in Progress! 🚧

Build Status

Prettier Java

Prettier Banner

How it works

A Prettier plugin must first parse the source code of the target language into a traversable data structure (Usually an Abstract Syntax Tree) and then print out that data structure in a "pretty" style.

Prettier-Java uses a Java-Parser implemented in JavaScript using the Chevrotain Parser Building Toolkit for JavaScript. What this means is that unlike many other prettier plugins, prettier-java has no additional runtime pre-requisites (e.g: Python executable). It could even be used inside a browser.


  • Parser package alpha version done.
  • Now Investigating the re-printer (actually prettier-java package)

Road map to Alpha

  • Parser Package:

    • POC: optimized backtracking to handle Java Grammar non LL(k) nature.
    • Milestone 1 - Success parsing "Java Design Patterns" repo.
    • Milestone 2 - Success parsing "spring-boot" repo.
    • Investigate performance optimizations.
    • Release Alpha version to npm. -
  • prettier-java package

    • POC: Prettier "Re-writer" based on a Chevrotain CST instead of an AST.
    • Milestone 1 - Success cyclic rewriting "Java Design Patterns" repo.
    • Milestone 2 - Success parsing "spring-boot" repo.


Contributions are very welcome. See the contribution guide to get started. And the Help Wanted issues.


Special thanks to @thorbenvh8 for creating the original prettier-java plugin and the associated Java Parser implemented in JavaScript.