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

Support JDK 22 string templates #618

Closed
clementdessoude opened this issue Nov 12, 2023 · 1 comment · Fixed by #640
Closed

Support JDK 22 string templates #618

clementdessoude opened this issue Nov 12, 2023 · 1 comment · Fixed by #640

Comments

@clementdessoude
Copy link
Contributor

Prettier Java does not supports (yet) string templates (JEP 430, specs)

// Embedded expressions can be strings
String firstName = "Bill";
String lastName  = "Duck";
String fullName  = STR."\{firstName} \{lastName}";
| "Bill Duck"
String sortName  = STR."\{lastName}, \{firstName}";
| "Duck, Bill"

// Embedded expressions can perform arithmetic
int x = 10, y = 20;
String s = STR."\{x} + \{y} = \{x + y}";
| "10 + 20 = 30"

// Embedded expressions can invoke methods and access fields
String s = STR."You have a \{getOfferType()} waiting for you!";
| "You have a gift waiting for you!"
String t = STR."Access at \{req.date} \{req.time} from \{req.ipAddress}";
| "Access at 2022-03-25 15:34 from 8.8.8.8"
@halexiev-hedgeserv
Copy link

halexiev-hedgeserv commented Dec 11, 2023

Hello,

Is there a workaround for this issue until support is ready?

This does not seem to work: // prettier-ignore

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 a pull request may close this issue.

2 participants