I'm writing code guidelines for some of our projects on Android. I'd actually like to facilitate this by using Android Studio code style preferences. I'm almost done setting parameters there: Android Studio->Preferences->Editor->Code Style->Java.
One thing I'm missing is that we want comments to be formatted like this :
// a useful comment
Instead of :
//a useful comment
How do I tell Android Studio to but a space between slashes and the text in the comment? Thanks!
If you press CTRL / or CMD / it will put // at the beginning of the line and the comment will be properly indented.
// comment with two indents
For this to work Comment at first column must be checked in Editor->CodeStyle->Java->Wrapping and Braces->Keep when reformatting like mentioned in another answer.

If you want to write multiline comment you can use CTRL SHIFT / or CMD SHIFT / That way when you go into new line, you will have one space after the comment start
/*
* there is space before this*/
I have just solved this problem.
I think you can find Code Style -> Java -> Code Generation
There is a Comment Code and select the Add a space at comment start
I think your problem can be solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With