5

My problem is, when I comment out a line using Ctrl + /,

//        comment

and then auto-format the code,

        //        comment

the comment will still contain whitespaces after the "//" that I wouldn't want to keep.

I've already checked the Settings>Editor>Java>Wrapping and Braces options, and also the other tabs.

Thanks in advance.

2 Answers 2

10

I have just solved this problem.

Code Style -> Java -> Code Generation

There is a "Comment Code" and deselect the "Line comment at first column"

Code Style -> Java -> Wrapping and Braces

There is a "Keep when reformatting" and deselect the "Comment at first column"

As follows

Code Generation

Wrapping and Braces

I think your problem can be solved.

Sign up to request clarification or add additional context in comments.

1 Comment

Not work in the version, Chipmunk|2021.2.1 Patch1
0

To apply identation to a document press Ctrl + Alt + L (Option + Command + L in Mac)

But the only way, once you have few comments with that "problem", I guess is to replace ('// ' by '//') (Shortcut to replace: Ctrl + Shift + R)

Hope it hepls.

1 Comment

I mean '// (few spaces or tbas here)' by '//'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.