简体   繁体   中英

How to configure eclipse formatter to run only when there are no compile errors

I have a very annoying problem with Eclipse.

I've configured the formatter and use save action to have formatted code with every save.

The problem is the formatter itself. Nearly every time when I save with a compile error the formatter removes lines (sometimes more then 100 lines) of my code. This problem is reproducable when starting the formatter manually.

And a 'compile error' is not only missing braces, even a missing semicolon causes text blocks to fly away.

I use Eclipse Mars but I think this problem already was in Eclipse Indigo. I'm not 100% sure but I think before Indigo the formatter only started when there were no compile errors to avoid such problems.

How can I get this behaviour back that formatter only runs with zero compile errors?

I am also using Eclipse Mars with the similar auto-format-on-Save settings. However, do not face such issues. Its correctly formatting the code, deleting none even in case of compilation errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM