Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » stop eclipse java formatter from collapsing spaces in comments(stop eclipse java formatter from collapsing spaces in comments)
stop eclipse java formatter from collapsing spaces in comments [message #1707194] Thu, 03 September 2015 00:04 Go to next message
Eclipse UserFriend
When I use Eclipse's java-conventions built-in java formatter, the formatter collapses multiple spaces into one space.

For example the following comment is

//              5
//             / \
//            4   8
//           /   / \
//          11  13  4
//         /  \      \
//        7    2      1


is modified into after pressing ctrl + shift + f(windows)

// 5
// / \
// 4 8
// / / \
// 11 13 4
// / \ \
// 7 2 1


How to configure Eclipse to not collapse the extra space.
Re: stop eclipse java formatter from collapsing spaces in comments [message #1707320 is a reply to message #1707194] Thu, 03 September 2015 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Precede your comment with

// @formatter:off

and follow it with

// @formatter:on

Re: stop eclipse java formatter from collapsing spaces in comments [message #1707435 is a reply to message #1707320] Fri, 04 September 2015 13:13 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for the reply.

Howerver, "Enable Off/On tags" is not on by default. So all developers may not have it turned on. Is there any other alternative.

Thanks
Re: stop eclipse java formatter from collapsing spaces in comments [message #1707471 is a reply to message #1707435] Fri, 04 September 2015 19:42 Go to previous message
Eclipse UserFriend
You asked how to configure Eclipse, then you don't like the answer because it's not default configuration? You can't change the configuration and still have the default Smile

Another solution is to disable line comment formatting, but you probably know that.

There is a trick that works with the default configuration - you can use non-breaking space characters instead of normal space. You can type it in LibreOffice Writer or MS Word by pressing Ctrl+Shift+Space, then copy the character and paste it into your java comment. This character may not be available in some encodings.
Previous Topic:Unable to start eclipse
Next Topic:Mars unable to install blackberry plugin
Goto Forum:
  


Current Time: Sat Apr 19 11:25:45 EDT 2025

Powered by FUDForum. Page generated in 0.05033 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top