-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do we need to install "prettier-java" seperately when we already install prettier? #317
Comments
Hi @PranavBhattarai ! As it is a community plugin, you have to install the prettier and prettier-plugin-java packages to make it work. Let me know if you have issues installing them :) |
@clementdessoude Do I have to install npm or yarn inorder to have this? |
When you say "main extension" do you mean the main npm package "prettier" or some IDE extension? |
@bd82 When I say the main extension, I mean "Prettier extension" when we (everyone's) installs. Why prettier for java functionality is sperated like this? |
Prettier Java is a community plug-in, so we are not integrated in the main Prettier library. We are not in the same project as it would be a burden for the Prettier team to maintain this, so we offered to develop this on our own. For the moment, to install prettier-plugin-java, you have to install it with npm or yarn (either locally or globally). You can also check this maven plug-in developed by @jhaber if you use maven. The docs are not exhaustive, but it should be explained in the Readme |
@clementdessoude What if I made feature-request about java support in the Prettier repo? Installing another unknown package manager like yarn or npm, just to use prettier-java is the representation underdevelopment. I might sound bad, but don't take it in the wrong way. I'm just learning how things are. Sorry in advance |
There is some documentation on prettier plugins here: In particular:
There are even "official" plugins that live in the Prettier org on GitHub but are still kept in separate repositories and must be installed separately: I think if you made such a feature request on Prettier repo they would just point you at this documentation. It has a plugin system precisely because they want prettier to be extensible, not monolithic. |
I'm also not sure what you mean by this:
Installing prettier itself requires either yarn or npm: |
I still don't fully understand. I am not sure your terminology is accurate...
I see multiple separate issues here: GitHub OrganizationWould moving this project to the prettier organization help consumption/usage/discovery in any manner? Inclusion as part of the main prettier package.
Providing a standalone executable for prettier-javaMany of the potential users of prettier-java may not have node.js/npm/yarn installed.
Providing prettier-java as a maven / gradle pluginSame concern as above to make consumption easy for potential users who do not have |
@jhaber Prettier can be install by going on Extension > Search "Prettier" > Select "Enable". I don't see yarn or npm commands, do I? |
I believe you are confusing IDE / Editor extensions and the core prettier package and plugins packages... The VSCode Prettier extension does seem to support plugins: However it assumes a local version of pettier and a local package.json (npm/node project). This is similar to some of the topics I described above (standalone executable / JVM ecosystem build tools integration). |
So the original prettier extension does mention plugins And there does not seem to be a solution to avoid npm/node/package.json dependency. I think that prettier-java has a real need to de-couple itself from the node/npm eco-system. But I am not sure that such de-coupling should happen via IDE extensions (at least initially). It seems to me a stand-alone executable should be the first step in achieving said "de-coupling" for multiple scenarios (Build-Tools/Local Dev Env/IDE Ext/...) |
@bd82 |
@PranavBhattarai I think you do need npm/yarn. I do not use VSCode much, but if I understand the instructions correctly: You need a package.json with a dependency to both prettier and prettier-plugin-java. I will mention again that this repository has absolutely nothing to do with VSCode extensions/plugins. This repository artifacts are published as npm packages. Anyhow unrelated to VSCode we should consider a standalone binary artifact because many in the JVM ecosystem do not have node/npm... |
How does this integrate into vscode, other than using the terminal built into vscode? So means I need to have node and npm installed on a dev system that I will not touch Js, only Java. How does this project compare to https://marketplace.visualstudio.com/items?itemName=mwpb.java-prettier-formatter |
I think you can integrate with VSCode Prettier extension (see plugins section). This project was created because of a need to format generated Java Code in a pure JS env, without needing Java. BTW I found some reference to a binary artifact release, but I can't seem to actually find the binary anywhere :) |
Because the original prettier doesn't mention this as u can see in this screenshot.

So wondering if installing "prettier" will also support java files/program, right?
(noob)
The text was updated successfully, but these errors were encountered: