-1

Is there a way to not let code blocks become one line? Example:

                /*
                 * for (String word : tokens) { if (!StringUtil.hasUppercaseOrNonletter(word)) { filtered.add(word); } }
                 */

I don't want to reduce the length of my comment line. For other general comments, I still want to keep the line length.

user697911
  • 10,043
  • 25
  • 95
  • 169

2 Answers2

1

If the comment is code that you want, then you can just use the eclipse toggle comment which is Ctrl + /

That just makes every line a normal comment so the formatting doesn't get messed up. You can just redo the command if you want to uncomment. That's what I do when commenting code

Jamal H
  • 934
  • 7
  • 23
0

After you write the block, just add /* to the line before the block, and */ after the block, like this:

    /*
    for (String word : tokens) {
        if (!StringUtil.hasUppercaseOrNonletter(word)) {
            filtered.add(word);
        } 
    }
    */

This will comment the whole block of code, without changing the formatting. Just write/paste the block first.

Or you can do command + /on a mac(for windows use + /), which will make the block look like this:

//      for (String word : tokens) {
//          if (!StringUtil.hasUppercaseOrNonletter(word)) {
//              filtered.add(word);
//          } 
//      }