Turn off code formatting for certain lines in Eclipse 3.6+

Often, we do not want eclipse to auto-format some lines. In Eclipse 3.6+ you can turn off code formatting:

  • Preferences -> Java ->  Code Style -> Formatter
  • Create your own profile if you have not done it yet: New... 
  • Edit your profile, in the Off/On Tags, Enable Off/On Tags

Now in the source code you can
   // @format off
   ... ... ..
   // @format on

See also New features in Eclipse 3.6

No comments:

Post a Comment