[英]Auto code completion on Eclipse
I want Eclipse to automatically suggest to me all possible options, while I'm writing some variable/class name or keyword, like in Flash Develop or Visual Studio.我希望 Eclipse 在我编写一些变量/类名或关键字时自动向我建议所有可能的选项,例如在 Flash Develop 或 Visual Studio 中。
Is it possible?可能吗?
If not, with which Java IDE can I get this?如果没有,我可以用哪个 Java IDE 得到这个?
I'm specifically asking about a way to automatically get the same thing I get using CTRL + Space , while I'm typing.我特别询问一种在我打字时自动获得与使用CTRL + Space相同的东西的方法。
You can also set auto completion to open automatically while typing.您还可以将自动完成设置为在键入时自动打开。
Go to Preferences
> Java
> Editor
> Content Assist
and write .abcdefghijklmnopqrstuvwxyz
in the Auto activation triggers for Java
field. Go 到Preferences
> Java
> Editor
> Content Assist
并在Auto activation triggers for Java
写入.abcdefghijklmnopqrstuvwxyz
。
Use the Ctrl+Space
shortcut for getting all possible autocomplete options available in a particular context in the editor.使用Ctrl+Space
快捷键可在编辑器的特定上下文中获取所有可能的自动完成选项。
Auto Complete will also allow you to insert custom code templates into the editor, with placeholders for various inputs.自动完成还允许您将自定义代码模板插入编辑器,并带有用于各种输入的占位符。 For instance, attempting to auto complete the word "test" in a Java editor, in the context of a class body, will allow you to create a unit test that uses JUnit;例如,尝试在 Java 编辑器中自动完成单词“test”,在 class 正文的上下文中,将允许您创建使用 Z8965A291ED0E84870298E1C35D61A10 的单元测试you'll have to code the body of the method though.不过,您必须编写方法的主体。 Some code templates like the former, come out of the box.一些像前者这样的代码模板,开箱即用。
Configuration options of interest感兴趣的配置选项
.
可在同一窗格中访问,这恰好是.
character by default.默认为字符。 When you have just keyed in typeA.
当您刚刚键入typeA.
and you expect to see relevant members that can be accessed, the auto completion list will automatically popup with the appropriate members, on this trigger.并且您希望看到可以访问的相关成员,自动完成列表将在此触发器上自动弹出适当的成员。Go to Windows--> Preference--->Java--->content assist--->Enable auto activation---(insert._@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ in auto activation triggers for java) Go 到 Windows--> 首选项--->Java---> 内容辅助---> 启用自动激活---(在 java 的自动激活触发器中插入._@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)
Window -> Preferences -> Java -> Editor -> content assist > enter Window -> 首选项 -> Java -> 编辑器 -> 内容辅助 > 输入
".abcdefghijklmnopqrstuvwxyz" “.abcdefghijklmnopqrstuvwxyz”
in the Auto activation triggers.在自动激活触发器中。
It will allow you to complete your code.它将允许您完成您的代码。
CTRL + Space CTRL +空格
Its simple these are the steps: 1. first go to the following settings Window -> Preferences -> Java -> Editor -> content assist -> advanced 2. there will be two boxes having checkboxes.其简单的步骤如下: 1. 首先 go 到以下设置 Window -> 首选项 -> Java -> 编辑器 -> 将有两个带有复选框的框 -> 高级2。 3. check everthing in there and click apply. 3.检查那里的一切,然后单击应用。 4. now ofcourse when you'll be coding there will be auto code completion feature automatically. 4. 当然,当你要编码时,会自动完成代码自动完成功能。
Since you asked about other Java IDE, I suggest IntelliJ by JetBrains.既然您询问了其他 Java IDE,我建议使用 JetBrains 的 IntelliJ。 Just look at it: not only does it support auto completion as you type, but also it support import package once you select the auto completion.看看它:它不仅支持在您键入时自动完成,而且它还支持在您 select 自动完成后导入 package。
Before someone said "Eclipse is free", note that IntelliJ has free community edition as well: www.jetbrains.com/idea/download/在有人说“Eclipse 是免费的”之前,请注意 IntelliJ 也有免费的社区版: www.jetbrains.com/idea/download/
Yes.是的。 If the suggestion doesn't compare automatically, then press crtl + space button.如果建议没有自动比较,请按 crtl + 空格键。
Now in eclipse Neon this feature is present.现在在 eclipse Neon 中存在此功能。 No need of any special settings or configuation.On Ctrl + Space the code suggestion is available无需任何特殊设置或配置。在Ctrl + Space上,代码建议可用
I had a similar issue when I switched from IntellijIDEA to Eclipse.当我从 IntellijIDEA 切换到 Eclipse 时,我遇到了类似的问题。 It can be done in the following steps.可以通过以下步骤完成。 Go to Window > Preferences > Java > Editor > Content Assist and type._abcdefghijklmnopqrstuvwxyzS in the Auto activation triggers for Java field Go to Window > Preferences > Java > Editor > Content Assist and type._abcdefghijklmnopqrstuvwxyzS in the Auto activation triggers for Java field
Pressing Ctrl + Space opens up the auto-completion dialog in Eclipse.按Ctrl + Space在 Eclipse 中打开自动完成对话框。 In the Java Perspective it opens automatically after you typed a .
在 Java 透视图中,它会在您键入.
(normally with a short delay). (通常会有短暂的延迟)。
See if your settings are correct also:看看你的设置是否正确:
Window -> Preferences -> Java -> Editor -> content assist. Window -> 首选项 -> Java -> 编辑器 -> 内容辅助。 See if the "completion inserts" is checked off along with anything else there you want to help auto complete.查看“完成插入”是否与您想要帮助自动完成的其他任何内容一起被选中。
Steps:脚步:
All the commands and variables which begin with that letter are now going to appear以该字母开头的所有命令和变量现在都将出现
Go to Window
> Preferences
> Java
> Editor
> Content Assist
and write .abcdefghijklmnopqrstuvwxyz
in the Auto activation triggers for Java
field. Go 到Window
> Preferences
> Java
> Editor
> Content Assist
并在Auto activation triggers for Java
写入.abcdefghijklmnopqrstuvwxyz
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.