无法在 Eclipse 中禁用方法括号自动完成
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2843759/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't disable method parenthesis auto-complete in Eclipse
提问by Chris Vig
I'm trying to disable the automatic closing of brackets in Eclipse, and while I've mostly succeeded, I can't stop the editor from inserting a closing parenthesis for a method call. The result is that when I type:
我正在尝试在 Eclipse 中禁用括号的自动关闭,虽然我基本上成功了,但我无法阻止编辑器为方法调用插入右括号。结果是,当我输入:
myBool.equals(true);
it inserts a closing parenthesis as soon as I type the opening parenthesis, and what I actually get is:
只要我输入左括号,它就会插入一个右括号,而我实际得到的是:
myBool.equals(true);)
I've disabled all of the auto-complete options in the Preferences -> Java -> Editor -> Typing menu, as well as Preferences -> Java -> Editor -> Content Assist -> Fill method arguments and show guessed arguments. I also disabled the smart insert mode option under the Edit menu. Is there another option somewhere else I need to use to stop Eclipse from doing this?
我已经禁用了首选项 -> Java -> 编辑器 -> 输入菜单中的所有自动完成选项,以及首选项 -> Java -> 编辑器 -> 内容辅助 -> 填充方法参数并显示猜测的参数。我还禁用了编辑菜单下的智能插入模式选项。我还需要在其他地方使用其他选项来阻止 Eclipse 执行此操作吗?
This is with Eclipse 3.5.2 (Build ID M20100211-1343) in case it matters.
这是 Eclipse 3.5.2 (Build ID M20100211-1343) 以防万一。
Edited to add: I should also mention that this only happens if I wait for the "intellisense" pop-up with suggested method names to appear after I type the period. If I just continuously type the code without waiting for the suggestion box to appear, the closing parenthesis doesn't get inserted.
编辑添加:我还应该提到,只有在我输入句点后等待带有建议方法名称的“智能感知”弹出窗口时才会发生这种情况。如果我只是连续输入代码而不等待建议框出现,则不会插入右括号。
采纳答案by Chris Lercher
I don't know how to disable the method parenthesis auto-complete - so I'm not sure, if you'll be satisfied with my answer. But to avoid ending up with
我不知道如何禁用方法括号自动完成 - 所以我不确定,如果你对我的回答感到满意。但为了避免结束
myBool.equals(true);)
you can actually enable(Parenthesis, [square] and <angle> brackets
in the Preferences -> Java -> Editor -> Typing menu. This inserts the parenthesis automatically (which you probably don't want), but you can just continue typing normally, as you would in an editor without "intelligence": Your closing parenthesis will simply overwrite the automatically inserted parenthesis, so you won't end up with );)
.
您实际上可以(Parenthesis, [square] and <angle> brackets
在 Preferences -> Java -> Editor -> Typing 菜单中启用。这会自动插入括号(您可能不想要),但您可以继续正常输入,就像在没有“智能”的编辑器中一样:您的右括号将简单地覆盖自动插入的括号,因此您不会以);)
.
回答by David Winiecki
If I understand the problem correctly, here is the solution! I had the same problem.
如果我正确理解问题,这里是解决方案!我有同样的问题。
Main Menu | Window | Preferences | <The language you are using> | Editor | Typing
主菜单 | 窗口 | 偏好 | <您使用的语言> | 编辑| 打字
In the section "Automatically close," uncheck the options you don't want.
在“自动关闭”部分,取消选中您不想要的选项。
I don't know if this functionality is new. I just started using Eclipse again and haven't ever used it much.
不知道这个功能是不是新的。我刚刚再次开始使用 Eclipse,但从未使用过它。
I found the answer on this stackoverflow page.
我在这个stackoverflow 页面上找到了答案。
回答by ben
As you noticed, it only happens if you wait for the proposals ("intellisense") box to pop up.
正如您所注意到的,只有在您等待建议(“智能感知”)框弹出时才会发生这种情况。
The "solution" is to disable proposals under one or both of the following, although doing so is probably more of a hassle because of what you'll be giving up.
“解决方案”是在以下一项或两项下禁用提案,尽管这样做可能更麻烦,因为您将放弃。
Preferences -> Java -> Editor -> Content Assist -> "Insert single proposals automatically"
首选项 -> Java -> 编辑器 -> 内容辅助 -> “自动插入单个提案”
Preferences -> Java -> Editor -> Content Assist -> Advanced
首选项 -> Java -> 编辑器 -> 内容辅助 -> 高级