-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Comment Formatting #679
Comments
found the same behavior prettier-plugin-java additionally found out that prettier will do the formating twice of the same file as it will format the comment section wrong. example Input: private boolean isClassList(Class<?> clazz) {
if (clazz.isArray()) { //test
return true;
} else {
return false;
}
} Output after first format call to prettier private boolean isClassList(Class<?> clazz) {
if (
clazz.isArray()
) { //test
return true;
} else {
return false;
}
} Output after second call to same file with no additional editing: private boolean isClassList(Class<?> clazz) {
if (clazz.isArray()) { //test
return true;
} else {
return false;
}
} |
This is similar to #651, which asked for the same, though specifically mentioned Javadocs. At the moment, this plugin does not modify the contents of comments in any way, it merely moves them as necessary. Prettier itself has not yet implemented this either (see prettier/prettier#265), which I think is the primary reason we haven't done so in this plugin. The Prettier team seemed receptive to the idea of formatting comments when that issue was opened in 2017, but it's had very little activity since then. None of that is to say that we couldn't implement this ourselves, we just wouldn't be able to lean on the Prettier team's decisions made surrounding it. The issue mentioned by @storylord85 is unrelated to wrapping comment contents, but instead seems to be related to #592. |
prettier-plugin-java
version: 2.6.4
# Options (if any): --print-width 120
Input:
Output:
Expected behavior:
Does Prettier not format comment sections? As I see, it has even issues with formatting the code which is in one line with a comment. Is it right? Or there is some new version with fixed comment formatting?
The text was updated successfully, but these errors were encountered: