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
Calendar mycal = Calendar.getInstance();
//My second line Calendar comment
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

2 comments
Comment actions Permalink

Try to disable "Settings | Code Style | Java | Wrapping and Braces | Keep when reformatting | Comments at first line". Does it help?

0
Comment actions Permalink

This works great, thanks!  It seems like an odd default to have this enabled.

0

Please sign in to leave a comment.