How to stop Eclipse from moving cursor for closing java parenthesis?

889 views Asked by At

One problem with Eclipse I am having is the editor will move my cursor when attempting to add a closing parenthesis in java code.

I will begin typing

class.method

And then ctrl + space to auto complete the method attributes

class.method(string, anotherString)

Which conveniently highlights the first attribute and moves my cursor to just after the g in string.

The problem comes when I backspace and change string, for example, to a second method call.

class.method(anotherMethod(, anotherString)

When I type the closing parenthesis to the opening parenthesis of anotherMethod, my cursor is moved to the end of the line and highlights the closing parenthesis after anotherString.

This is a rather annoying pain, as I have to move the cursor back to where it was originally to complete anotherMethod.

I have unchecked Preferences -> java -> editor -> typing -> "automatically close" but the problem persists. I also thought it had to do with my formatting settings, but restoring those to default doesn't fix the issue either.

Is there a way to tell Eclipse to stop moving my cursor?

1

There are 1 answers

0
maus On

This doesn't happen for me if I check "automatically close" for parentheses. It seems that if you don't let Eclipse close parentheses it'll assume the next closing paren you've typed is the one you want. If you let it close parens, it'll add a paren after anotherMethod( and the cursor will stay there. Auto-close of parens isn't that bad since you can usually type over it without it resulting in two close parens.