简体   繁体   English

Curly Braces在Eclipse中不起作用

[英]Curly Braces not working in Eclipse

See the image, basically if I go to enter shift+[ or shift+] aka { or } in eclipse 看看图像,基本上如果我在eclipse中输入shift + [或shift +] aka {或}

I expect the editor to update the .java source with a { or }. 我希望编辑器用{或}更新.java源代码。

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. 现在我正在使用一个标准的macbook pro,用英语任何想法为什么eclipse不会让我进入大括号。 It worked about 2 weeks ago, did an update... using Mountain Lion... now it's not working. 它工作了大约两周前,做了更新...使用Mountain Lion ...现在它没有用。 在此输入图像描述 Any ideas? 有任何想法吗?

My solution was: 我的解决方案是:

Help -> Key Assist then find skip Skip all Breakpoints. 帮助 - >键辅助然后找到跳过跳过所有断点。

Select it and press ctrl + shift + L . 选择它并按ctrl + shift + L It will open a preferences window and then just delete binding.( ctrl + alt + b ) 它将打开一个首选项窗口,然后只删除绑定。( ctrl + alt + b

I hope it solved your problem! 我希望它能解决你的问题!

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 : 转到Preferences -> Java -> Editor -> Typing并确认选中Automatically close -> Braces选项,如下所示:

在此输入图像描述

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. 对于它的价值,我从来没有遇到过你在Mountain Lion OSX上遇到的问题,过去几天我一直在Eclipse Indigo,Helios和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 ? 问题 :您使用的是哪个版本的Eclipse?

在此输入图像描述

Just delete the keys, simple. 只需删除键,简单。 Hope it helps. 希望能帮助到你。

General->Keys->Type filter keys->skip  ->skip All Brakepoint->Bindings-> Delete

I had this problem in Eclipse Java EE for Web Developers Luna 4.4.1. 我在Eclipse Java EE for Web Developers Luna 4.4.1中遇到了这个问题。 Both of "Braces" options were selected. 两个“大括号”选项都被选中。 But it started to work properly only after selecting "Enter key adjust the indentation on the new line ". 只有在选择“Enter键调整新行上的缩进”后才能正常工作 Hope it will help someone. 希望它会帮助某人。

Ok, today I also got this problem on Eclipse Mars Java EE. 好的,今天我也在Eclipse Mars Java EE上遇到了这个问题。 It didn't work well when i tried to select, deselect braces options or any other solution from above, turns out while editing a code segment in few hundred lines above I closed a brace after the IDE closed it automatically. 当我尝试选择,取消选择大括号选项或上面的任何其他解决方案时效果不佳,在编辑上面几百行的代码段时结果我在IDE自动关闭后关闭了一个大括号。 It's late for this question but leaving here for future reference to anyone who has the same problem 这个问题已经晚了,但是留在这里以供将来参考有同样问题的人

Check your code for erroneous extra braces 检查您的代码是否有错误的额外括号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM