Java Eclipse 自动完成功能不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21746294/
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
Eclipse autocomplete not working
提问by smttsp
The autocomplete of eclipse is not working now and I searched for hours but I couldn't find an answer to solve it. I haven't used it for long time then the first thing after opening it was to install SWT and windows builder even though I had swing installed. What I mean is, it is may possibly be because of some conflict caused by swt and swing(I read something about a conflict but I don't if this is possible).
eclipse 的自动完成现在不起作用,我搜索了几个小时,但找不到解决它的答案。我已经很久没有使用它了,打开它后的第一件事就是安装 SWT 和 windows builder,即使我已经安装了 Swing。我的意思是,这可能是因为 swt 和 swing 引起的一些冲突(我读了一些关于冲突的内容,但如果可能的话,我不读)。
Strange thing is it doesn't show anything when I press ctrl+space but when I go Edit-> Content Assist -> Default(it says Ctrl+Space nearby it), it shows things needed to be shown/works as desired.
奇怪的是,当我按 ctrl+space 时它没有显示任何内容,但是当我转到 Edit-> Content Assist -> Default(它在它附近说 Ctrl+Space)时,它显示了需要显示/按需要工作的内容。
public class Dsada {
String sssss;
public Dsada(){
sss //pressing ctrl+space is not working,Edit->ContentAssist->Default works fine
}
}
The solution is not to tick/untick some stuff under Windows->Preferences->...->Content Assist-> Advanced. I checked if "ctrl+space" is hiHymaned by some other thing which is not and checked keyboard language which is English(Those are suggested in mkyong).
解决方案不是在Windows->Preferences->...->Content Assist-> Advanced下勾选/取消勾选某些内容。我检查了“ctrl+space”是否被其他一些不是的东西劫持了,并检查了英语的键盘语言(这些是在mkyong中建议的)。
I read something about a bugbut I couldn't understand. I tried to delete eclipse and re-install again but I guess some settings just stayed in the machine so that it didn't work.
我读了一些关于错误的信息,但我无法理解。我试图删除 eclipse 并重新安装,但我猜有些设置只是留在机器中,所以它不起作用。
Thanks in advance,
提前致谢,
采纳答案by Howard
The hot key combination ctrl+space
might be conflict with other settings in system if you are using windows.
ctrl+space
如果您使用的是 windows ,热键组合可能会与系统中的其他设置冲突。
Try modify this combination like alt+/
, i always use this one since the first time i knew eclipse. It works well.
尝试修改此组合,例如alt+/
,自从我第一次知道 eclipse 以来,我一直使用这个组合。它运作良好。
Hope it works for you.
希望对你有效。
回答by user1782634
Also a possible problem that solved for me: http://blog.rtwilson.com/how-to-solve-the-ctrl-space-auto-complete-not-working-problem-in-eclipse/
还有一个可能为我解决的问题:http: //blog.rtwilson.com/how-to-solve-the-ctrl-space-auto-complete-not-working-problem-in-eclipse/
回答by Guillermo
I had the same Problem on Ubuntu 14.04. The problem for me was that ibus
used Ctrl+Space
as a shortcut. I solved it by starting the program ibus-setup
and chaning the shortcut to something else than Ctrl+Space
.
我在 Ubuntu 14.04 上遇到了同样的问题。我的问题是ibus
用作Ctrl+Space
快捷方式。我通过启动程序ibus-setup
并将快捷方式更改为Ctrl+Space
.
回答by Harleen
I faced hot key problem with use Ctrl+Space. I tried to fix the issue first by Windows->Preferences->...->Content Assist-> Advanced and selected Select the proposal kinds contained in the 'default' content assist list:
我在使用 Ctrl+Space 时遇到了热键问题。我首先尝试通过 Windows->Preferences->...->Content Assist->Advanced 解决该问题,然后选择 Select the proposal kind contains in the 'default' content Assist list:
- Other Java Proposals,
- List item
- SWT Template Proposals
- Template Proposals
- Type Proposals
- 其他 Java 提案,
- 项目清单
- SWT 模板提案
- 模板提案
- 类型提案
but didn't help.
但没有帮助。
Therefore, I tried another solution. There would be multiple languages on your computer which could be eating up your Ctrl command. To solve this Go to Control Panel -> Region and Language -> Keyboards and Languages (tab) and then Change Keyboards.
因此,我尝试了另一种解决方案。您的计算机上会有多种语言可能会占用您的 Ctrl 命令。要解决此问题,请转到Control Panel -> Region and Language -> Keyboards and Languages (tab) 然后 Change Keyboards。
You'll see a list of languages installed – remove any that you don't want (click the language and then click the Remove button) until you only have the ones you want left. That fixed it for me, but you can also check the Advanced Key Settings tab to make sure that none of the keyboard short-cuts that are set include Ctrl-Space.
您将看到已安装的语言列表 - 删除任何您不需要的语言(单击语言,然后单击“删除”按钮),直到只剩下您想要的语言。这为我修复了它,但您也可以检查“高级键设置”选项卡以确保设置的所有键盘快捷键都不包含 Ctrl-Space。
Once you've done that, Ctrl-Space should work nicely!!!!
完成后,Ctrl-Space 应该可以很好地工作!!!!
回答by Abu Nayem
Recently, I also faced this issue. When I install neon version eclipse. By (1) deleting respective class, (2) restoring defaults appearance and (3) restarting eclipse, solved the problem for me. Hope it will help someone.
最近,我也遇到了这个问题。当我安装霓虹版 eclipse 时。通过(1)删除相应的类,(2)恢复默认外观和(3)重新启动eclipse,为我解决了问题。希望它会帮助某人。
回答by Andrej Buday
I was facing the same issue. If you use OS X Eclipse Ctrl+Space shortcut can be interfering with OS X system's "Selecting previous input source" using Ctrl+Space shortcut as default.
我面临着同样的问题。如果您使用 OS X Eclipse,Ctrl+Space 快捷键可能会干扰 OS X 系统的“选择上一个输入源”,默认使用 Ctrl+Space 快捷键。
It is necessary to edit System Preferencies/Keyboard/Shortcuts/Input Sourceand uncheck the "Selecting previous input source" or change the shortcut on something else. Eclipse should work after that even without restart.
有必要编辑系统首选项/键盘/快捷方式/输入源并取消选中“选择上一个输入源”或更改其他内容的快捷方式。即使没有重新启动,Eclipse 也应该在此之后工作。
回答by Pete Kelley
This is recurring for me. I'm using Eclipse 2019-03 in Windows 10. The steps below work for my case, and does not require a restart.
这对我来说反复出现。我在 Windows 10 中使用 Eclipse 2019-03。以下步骤适用于我的情况,不需要重新启动。
Window->Preferences->Java->Editor->Content Assist->Advanced
Window->Preferences->Java->Editor->Content Assist->Advanced
The following options are de-selected, and when I set them the autocomplete worked as before. No restart needed.
取消选择以下选项,当我设置它们时,自动完成功能像以前一样工作。无需重启。
- Java Non-Type Proposals
- Java Proposals
- Java Type Proposals
- Java Proposals (Task-focused)
- Java 非类型提议
- Java 提案
- Java 类型建议
- Java 提案(以任务为中心)
I don't know what's triggering this but it only happens after I've created a new project. Usually doesn't. It simply doesn't happen often enough for me to notice a pattern to follow up on more. Clearly this problem occurs with a variety of causes, so review the other answers to see if they match your case.
我不知道是什么触发了这个,但它只发生在我创建了一个新项目之后。通常不会。它发生的频率不足以让我注意到一种模式来跟进更多。很明显,出现此问题的原因有多种,因此请查看其他答案以查看它们是否与您的情况相符。
回答by caot
Window->Preferences->Java->Editor->Content Assist->Advanced
Window->Preferences->Java->Editor->Content Assist->Advanced
The following options have to be selected, then the autocomplete worked . No restart is required.
必须选择以下选项,然后自动完成工作。不需要重新启动。
Java Proposals (must be selected, not sure the follows)
Java Non-Type Proposals
Java Type Proposals
Java Proposals (Task-focused)