Giter Club home page Giter Club logo

prettier-java's Introduction

๐Ÿšง Work in Progress! ๐Ÿšง

Azure DevOps Build Status 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.

Subpackages

This project contains 2 packages:

Status

  • Parser package alpha version done, it can parse most of Java code. However, we still need to make some tweaks and improvements.
  • The printer (actually prettier-java package) is mostly done, it can output formatted code but needs to be improved on some cases.

Install

This need to updated when the next version will be released.

In the meantime, you can run the plugin by following these steps:

git clone https://github.com/jhipster/prettier-java
cd prettier-java
yarn
cd packages/prettier-plugin-java/scripts
node update-test-output.js -single

It will format the code contained in packages/prettier-plugin-java/scripts/single-printer-run/_input.java and ouput the formatted code in packages/prettier-plugin-java/scripts/single-printer-run/_output_.java.

It is also possible to format a folder with the following command: node update-test-output.js -repository path-to-folder. The output will be stored in packages/prettier-plugin-java/test-samples/.

Contributing

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

Credits

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

prettier-java's People

Contributors

azz avatar bd82 avatar clementdessoude avatar fauxfaux avatar graham42 avatar hawkurane avatar iamandrewluca avatar jdubois avatar lipis avatar pascalgrimaud avatar shaolans avatar victornoel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.