How to disable auto formatting upon save in Eclipse?

后端 未结 5 1098
南笙
南笙 2020-12-15 15:49

Eclipse keeps auto formatting upon save, for example: it is insisting the following code should be in a single line once I save, despite breaking it up the way I want to.

5条回答
  •  独厮守ぢ
    2020-12-15 16:19

    If you wish to keep the auto-formatter, but don't want this behavior, you can also configure it in the fomatter :

    right click on the project -> properties -> java code style -> formatter
    

    (If you don't have a project specific formatter the global configuration can be accessed this way : Window -> Preference -> Java -> Code Style -> Formatter).

    Edit... the active profile, open the Line Wrapping tab, and there check the Never join already wrapped lines option.

    This way you can wrap lines wherever you want and eclipse won't remove your line breaks (which is a must if you wish to have readable lambda expressions), but keep the formatter active.

    This option is there at least since eclipse Luna

    Here is a screenshot where this option is :

提交回复
热议问题