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

Formatting 'switch case' problems #5

Closed
404-nut-pound opened this issue Sep 11, 2022 · 2 comments
Closed

Formatting 'switch case' problems #5

404-nut-pound opened this issue Sep 11, 2022 · 2 comments

Comments

@404-nut-pound
Copy link

404-nut-pound commented Sep 11, 2022

I appreciate for this extension.

But need some enhancement for 'switch case' grammer.

//formatting works
switch(someParam) {
	case "A": //some codes
		break;
	default:
		break;
}
//formatting not works, on JDK 12
switch(someParam) {
	case "A" -> "AA";
	default -> null;
}
//this neither, on JDK 13
switch(someParam) {
	case "A": yield "AA"; //this line can be { } blocked. like case "A" -> { yield "AA"; }
	default: yield null;
}

If some java files have switch line like examples, formatting not works for entire lines in file.

I hope i can get a solution for this issue.

Thx.

@mwpb
Copy link
Owner

mwpb commented Oct 30, 2022

Hi, apologies for the late reaction. Indeed I no longer use Java day-to-day and I don't think this extension can handle the -> form of the switch statement. That said I have updated the various dependencies and republished so you can have another go.

If things still don't work then I would contact https://github.com/jhipster/prettier-java instead. For this issue I'm happy to spend the small amount of time updating this extension to the latest version of the prettier-plugin-java if that will help. It would be more sustainable if this extension could somehow be moved into that project and I've mentioned that here jhipster/prettier-java#501. Thanks,

@404-nut-pound
Copy link
Author

Many thanks. I tried formatting after update plugin, and it works so good.

Thank you for your support again.

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

No branches or pull requests

2 participants