Search code examples
javaeclipseparenthesescurly-braces

Curly Braces not working in Eclipse


See the image, basically if I go to enter shift+[ or shift+] aka { or } in eclipse

I expect the editor to update the .java source with a { or }.

Instead it seems to be indenting...

Now I'm using a standard macbook pro, with English any ideas why eclipse won't let me enter the curly brace. It worked about 2 weeks ago, did an update... using Mountain Lion... now it's not working. enter image description here Any ideas?


Solution

  • This behavior is controlled by the following preference.

    Go to Preferences -> Java -> Editor -> Typing and confirm that the Automatically close -> Braces option is selected like so :

    enter image description here

    For what it's worth, I have never had the problem you have been experiencing on Mountain Lion OSX and for the past few days I have been switching between Eclipse Indigo, Helios and Juno.

    If the above does not work, try switching to a new workspace and try there ? I am not aware of any other preference which might be controlling this brace-closing behavior.

    Question : Which version of Eclipse are you on ?