Skip to content
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

CLDR-15381 Java formatting with prettier, tabWidth 4, printWidth 120 #1919

Closed
wants to merge 1 commit into from

Conversation

btangmu
Copy link
Member

@btangmu btangmu commented Apr 14, 2022

-Add .prettierrc.json with custom settings for .java files

-Only java files in tools/cldr-code/src/main/java/org/unicode/cldr/util

CLDR-15381

  • This PR completes the ticket.

-Add .prettierrc.json with custom settings for .java files

-Only java files in tools/cldr-code/src/main/java/org/unicode/cldr/util
Copy link
Member

@srl295 srl295 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally LGTM… 

"🚴‍♂️",
"🚴🏿‍♂️",
"🚴‍♀️",
"🚴🏿‍♀️"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still blew it out to 22 lines

final String shortName = eng.getShortName(s);
final Set<String> keywords = eng.getKeywords(s);
System.out.println("{\"" + s + "\",\"" + shortName + "\",\"" + Joiner.on("|")
.join(keywords) + "\"},");
System.out.println("{\"" + s + "\",\"" + shortName + "\",\"" + Joiner.on("|").join(keywords) + "\"},");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… but generally, it's not mangling these lines anymore

0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x2000, 0xf800, 0xf800, 0xf800, 0xf800
0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uggg. Any way to manually override (eg with comments) to prevent mangling? We shouldn't have to make code changes just because of a pretty printer!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I use // @Formatter:off and // @Formatter:on, it works well.

per jhipster/prettier-java#505 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"// @Formatter:off and // @Formatter:on" -- that looks promising

maybe that wouldn't be needed very often; the utf16Fixup array is unusual due to the performance optimization

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually "@Formatter" doesn't work for me, but "// prettier-ignore" does, for java, although the documentation is for javascript:

https://prettier.io/docs/en/ignore.html#javascript

@srl295
Copy link
Member

srl295 commented Apr 14, 2022

@macchiati @btangmu prettier is explicitly an opinionated formatter.

per https://prettier.io/docs/en/option-philosophy.html

Please note that as option requests are out of scope for Prettier, they will be closed without discussion

perhaps we need to look for something else, at least for the java side. I think it's been pretty uch 100% perfect for the JS side.

@btangmu btangmu closed this Sep 19, 2022
@btangmu btangmu deleted the t15381_h branch September 19, 2022 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants