Eclipse Spring Tools 缺少内容辅助/自动完成
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48093885/
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 Spring Tools missing content assist/ autocomplete
提问by morecore
new year - new problems ;)
新的一年 - 新问题;)
I'm working on a Linux machine and I've just installed a new Eclipse.
我在一台 Linux 机器上工作,我刚刚安装了一个新的 Eclipse。
Version: Oxygen.2 Release (4.7.2)
Build id: 20171218-0600
JRE: java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
Then I've added the latest Version of Spring Tools
3.9.2.RELEASE
via the marketplace.
然后我Spring Tools
3.9.2.RELEASE
通过市场添加了最新版本。
The only other additional plugin that is currently installed is Subversive
4.0.5
当前安装的唯一其他附加插件是 Subversive
4.0.5
The Project that I'm working on and that previously worked as expected has the Spring Boot Project Nature
enabled.
我正在处理且以前按预期工作的项目已Spring Boot Project Nature
启用。
But with the new installation I'm missing the autocomplete feature - No completion or proposals of properties anymore.
但是在新安装中,我缺少自动完成功能 - 不再有属性的完成或建议。
In the Project Explorer the application.yml
display only the standard file icon and no longer the (if my memory serves me right) Spring leaf icon.
In an other Project using a 'application.properties' file the behavior is the same.
在项目资源管理器中,application.yml
只显示标准文件图标,不再显示(如果我没记错的话)Spring 叶子图标。在使用“application.properties”文件的其他项目中,行为是相同的。
Is there a setting that now needs to be set? Or something else that I can check?
是否有现在需要设置的设置?或者我可以检查的其他东西?
Not directly related to my previous question:
与我之前的问题没有直接关系:
In my old installation that worked, I've always wondered why exactly these two filenames application.properties
and application-dev.properties
(or their .yml analogous) were recognized as properties files while other were not e.g. application-test.properties
or application-prod.properties
.
在我的旧安装中,我一直想知道为什么这两个文件名application.properties
和application-dev.properties
(或它们的 .yml 类似文件)被识别为属性文件而其他的不是 egapplication-test.properties
或application-prod.properties
.
See image taken from STS-3.9.2:
It is not only an issue with the icon, but also it opens the wrong editor and therefore I don't have autocomplete support - unless I say Open with -> Spring Yaml Properties Editor
.
这不仅是图标的问题,而且它打开了错误的编辑器,因此我没有自动完成支持 - 除非我说Open with -> Spring Yaml Properties Editor
.
采纳答案by Martin Lippert
I analyzed the problem of the missing property editor and found the reason (and a solution for it), which is documented here:
我分析了缺少属性编辑器的问题,找到了原因(以及解决方法),记录在这里:
Missing Spring Properties Yaml Editor and and Spring Properties Editor with Spring Tools 3.9.2
回答by Martin Lippert
The answer to the "sub-question" about the application-test.properties
file: the content-type that got defined for the Spring Boot property files got defined for specific file names only, since it wasn't possible to put a wildcard-based name like application*.properties
in there. But once you opened that file with Open With -> ...
, Eclipse will remember your choice for the next double-click.
这个问题的答案了“子问题”有关application-test.properties
文件:即得到了Spring的引导属性文件中定义的内容类型得到了只有特定的文件名定义,因为这是不可能把一个基于通配符名称,比如application*.properties
在那里. 但是,一旦您使用 打开该文件Open With -> ...
,Eclipse 就会记住您在下次双击时所做的选择。
Future versions of Eclipse (I think it is Photon) will have a more flexible way to define those file name matchings so that we can solve this in future versions.
Eclipse 的未来版本(我认为是 Photon)将有更灵活的方式来定义这些文件名匹配,以便我们可以在未来版本中解决这个问题。
回答by Gagan Gowda
Follow these steps:
按着这些次序:
1) Right click on application.properties
2) Open with -> others.. -> search for spring Properties Editor -> tick the use it for all application.properties nd the click om ok.
1) 右键单击 application.properties
2) 打开方式 -> 其他.. -> 搜索 spring 属性编辑器 -> 勾选将其用于所有 application.properties 并单击确定。
回答by Michael Qin
Select the file you would like to open, i.e. application-xyz.yml
选择您要打开的文件,即 application-xyz.yml
Open with "Generic Editor - Spring YAML Properties"
使用“通用编辑器 - Spring YAML 属性”打开
Check the box: Open *.yaml files. Click OK.
选中复选框:打开 *.yaml 文件。单击确定。
That's it. All *.yml files icons now become Spring-ish look and feel. And from now on, you open any YAML file automatically with "Generic Editor - Spring YAML Properties"
就是这样。所有 *.yml 文件图标现在都变成了 Spring 风格的外观。从现在开始,您可以使用“通用编辑器 - Spring YAML 属性”自动打开任何 YAML 文件
回答by Kaushik Vaghani
Code completions work for me when I edit application.yml
.
Is your file names application.yml and located under src/main/resources
in your boot maben project?
当我编辑application.yml
.
您的文件名为 application.yml 并位于src/main/resources
您的 boot maben 项目下吗?
Did you open the application.yml file with Generic Editor:
您是否使用通用编辑器打开了 application.yml 文件: