autoformatted comments after } in netbeans?

  • Thread starter nooneinparticular314159
  • Start date
N

nooneinparticular314159

Netbeans has a nice autoformatting tool. But it in the current
version, it seems to want to put comments where I really don't want
them. For example, if I have:

else{
(some code)
}

<---note the white space here, intentionally placed here by me
for readability

//This is a comment
if (blah) ...

and then I tell it to format my code, I wind up with:

else{
(some code)
} //This is a comment
if (blah)

Notice how it moved the comment up to the line containing the
trailing }. This is not where I want that comment, since it doesn't
relate to the code above it.

How do I get netbeans to stop moving my comments to other lines like
that? I want it to clean up my indentation, but not move my comments
around.

Thanks!
 
N

nooneinparticular314159

A followup formatting question:

To make things worse, it is in fact netbeans that is inserting those
braces in the first place. My code says:

else if (condition)
dosomething();

//comment

and netbeans is changing this to:

if (condition){
dosomething();
}//comment

Which is definitely not what I want. How do I get it to stop this?

Thanks!
 
M

Mark Space

A followup formatting question:

To make things worse, it is in fact netbeans that is inserting those
braces in the first place. My code says:

Tools->Options->Java->Formating->Alignment and Braces->Braces Generation
and set "if" to Leave Alone.

Not sure about the comments, it doesn't do that for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top