Cannot reformat pasted comments with code
When I paste code that has comments into Intellij (Java), it will correctly reformat the code, but it appears to not recognize that the comments (line or block) should be kept with that code segment (it does not auto-indent and reformatting manually doesn't help)
i.e.
If the code I'm pasting inside a function is is
//My first line Calendar comment//My second line Calendar comment
Calendar mycal = Calendar.getInstance();
Calendar mycal = Calendar.getInstance();
/**
* My block calendar comment
*/
Calendar myOtherCal = Calendar.getInstance();
I end up getting
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
//My first line Calendar comment
Calendar mycal = Calendar.getInstance();
//My second line Calendar comment
Calendar mycal = Calendar.getInstance();
/**
* My block calendar comment
*/
Calendar myOtherCal = Calendar.getInstance();
Is there a way to resolve this or is this just a bug? I looked through the formatting options and didn't see anything.
Thanks
Please sign in to leave a comment.
Try to disable "Settings | Code Style | Java | Wrapping and Braces | Keep when reformatting | Comments at first line". Does it help?
This works great, thanks! It seems like an odd default to have this enabled.