Eclipse:启用自动完成/内容辅助
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6912169/
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: Enable autocomplete / content assist
提问by john
How can I enable autocomplete in Eclipse? I can't find it!
如何在 Eclipse 中启用自动完成功能?我找不到!
回答by THelper
By default in Eclipse you only have to press Ctrl-spacefor autocomplete. Then select the desired method and wait 500ms for the javadoc info to pop up. If this doesn't work go to the Eclipse Windows menu-> Preferences-> Java-> Editor-> Content assistand check your settings here
默认情况下,在 Eclipse 中,您只需按Ctrl-space自动完成。然后选择所需的方法并等待 500 毫秒以弹出 javadoc 信息。如果这不起作用,请转到 Eclipse Windows menu-> Preferences-> Java-> Editor->Content assist并在此处检查您的设置
回答by intcreator
If you would like to use autocomplete all the time without having to worry about hitting Ctrl+ Spacebaror your own keyboard shortcut, you can make the following adjustment in the Eclipse preferences to trigger autocomplete simply by typing several different characters:
如果您想一直使用自动完成功能而不必担心按Ctrl+Spacebar或您自己的键盘快捷键,您可以在 Eclipse 首选项中进行以下调整,只需键入几个不同的字符即可触发自动完成功能:
- Eclipse> Preferences> Java> Editor> Content Assist
- Auto Activation > Auto activation triggers for Java
- Enter all the characters you want to trigger autocomplete, such as the following:
- Eclipse> Preferences> Java> Editor>Content Assist
- 自动激活 > Java 的自动激活触发器
- 输入要触发自动完成的所有字符,例如:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._
Now any time that you type any of these characters, Eclipse will trigger autocomplete suggestions based on the context.
现在,只要您键入这些字符中的任何一个,Eclipse 都会根据上下文触发自动完成建议。
回答by deepak prajapati
- window->preferences->java->Editor->Contest Assist
- Enter in Auto activation triggers for java:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._ - Apply and Close
- window-> preferences-> java-> Editor->Contest Assist
- 输入 Java 的自动激活触发器:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._ - 申请和关闭
other method:
type initial letter then ctrl+spacebar for auto-complete options.
其他方法:
键入首字母,然后按 ctrl+spacebar 以获取自动完成选项。
回答by Karthikeyan Karthikeyan
For auto-completion triggers in Eclipse like IntelliJ, follow these steps,
对于像 IntelliJ 这样的 Eclipse 中的自动完成触发器,请按照以下步骤操作,
- Go to the Eclipse Windows menu-> Preferences-> Java-> Editor-> Content assistand check your settings here
- Enter in Autocomplete activation string for java:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._@
- Apply and Close the Dialog box.
- 转到 Eclipse Windows menu-> Preferences-> Java-> Editor->Content assist并在此处检查您的设置
- 输入 Java 的自动完成激活字符串:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._@
- 应用并关闭对话框。
Thanks.
谢谢。
回答by FUD
I am not sure if this has to be explicitly enabled anywhere..but for this to work in the first place you need to include the javadoc jar files with the related jars in your project. Then when you do a Cntrl+Space it shows autocomplete and javadocs.
我不确定这是否必须在任何地方显式启用..但是要使其首先起作用,您需要在项目中包含带有相关 jar 的 javadoc jar 文件。然后,当您执行 Cntrl+Space 时,它会显示自动完成和 javadocs。
回答by Prakash Bhandari
If you are only unfamiliar with the auto-complete while typing syntax or inbuilt methods in the eclipse you can simply type the desired syntax or method name and press Ctrl+Spacethat will display the list of desired options and you can select one of them.
如果您在 eclipse 中键入语法或内置方法时不熟悉自动完成功能,您只需键入所需的语法或方法名称,然后按Ctrl+键Space,将显示所需选项的列表,您可以选择其中之一。
If the auto-complete option is not enabled then you have to check your settings from Windows menu -> Preferences-> Java-> Editor-> Content assist
如果未启用自动完成选项,则必须从 Windows 菜单 -> Preferences-> Java-> Editor->检查您的设置Content assist
回答by Rogeekstar
For me, it helped after I changed the theme to 'mac' since I am running on a MacOSX.
对我来说,因为我在 MacOSX 上运行,所以在我将主题更改为“mac”后它有所帮助。
Eclipse:>Preferences> General> Appearance> Choose 'Mac' from the menu.
Eclipse:> Preferences> General> Appearance> 从菜单中选择“Mac”。