[英]Eclipse: Content Assist not showing suggestions
I'm using Win 10 (64bit) and I've tried this with Eclipse Photon and version 2018-09 (64 bit version both times) but I'm getting the same result with both: 我正在使用Win 10(64位),并且已经在Eclipse Photon和2018-09版(两次都是64位版本)中进行了尝试,但是两种方式我都得到了相同的结果:
I created a new project ( File > New > Project...: JavaScript > JavaScript Project ) and a JavaScript script ( File > New > JavaScript Source File ). 我创建了一个新项目( 文件>新建>项目...:JavaScript> JavaScript项目 )和一个JavaScript脚本( 文件>新建> JavaScript源文件 )。 If I type
如果我输入
function test() {
var inputField = doc
}
then press Ctrl + Space , it should give me a list of suggestions but instead the list only says "No Default Proposals" . 然后按Ctrl + 空格键,它应该给我一个建议列表,但该列表仅显示“无默认建议” 。 If I press Ctrl + Space again after writing
document.
如果在编写
document.
后再次按Ctrl + 空格键document.
the list only says "MISSING" . 该列表仅显示“ MISSING” 。
Writing code inside the <script></script>
part of an HTML file results in the same empty window. 在HTML文件的
<script></script>
部分中编写代码将导致相同的空白窗口。 Suggestions for HTML and CSS often work but sometimes the window doesn't even open in the first place and if I write eg <sty
, there's no suggestion for <style>
. 对HTML和CSS的建议通常可以奏效,但有时窗口甚至根本不会打开,如果我写例如
<sty
,就没有对<style>
建议。
I can train Eclipse in a way if I write eg: 如果我编写例如,我可以用某种方式训练Eclipse:
var inputField = document.getElementById("inputField");
inputField.style = "red";
Pressing Ctrl + Space after writing inputField
again suggests "style" . 再次写入
inputField
之后,按Ctrl + 空格将建议使用“ style” 。 This only works within the same file, if I get the same input field in a different script, there's no suggestion for "style" . 这仅在同一文件中有效,如果在不同脚本中获得相同的输入字段,则不建议使用“ style” 。
I haven't changed anything about the settings ( Window > Prerferences ): 我没有更改任何设置(“ 窗口”>“偏好设置”):
I'm using Mars.2 for a Java project and everything works fine there, so not sure if it's the version (I don't want to use a version that old for the new JS project) or if Eclipse simply can't handle JS properly. 我正在将Mars.2用于Java项目,并且在那里一切正常,所以不确定是不是版本(我不想为新的JS项目使用旧的版本)还是Eclipse无法处理JS正确。
Any ideas/suggestions what I could try to fix this (without installing extra plugins)? 我有什么想法/建议可以解决此问题(无需安装额外的插件)?
Edit: I just tried 2 more versions: It works with Mars.2 (PHP) but not with Neon. 编辑:我刚刚尝试了2个版本:它可以与Mars.2(PHP)一起使用,但不能与Neon一起使用。 I'd still prefer fixing Photon or 2018-09 though instead of using a version that was released almost 3 years ago.
我仍然更喜欢修复Photon或2018-09,而不是使用将近3年前发布的版本。
Only in the context of a web browser there is a document
on which you can call getElementById
. 仅在Web 浏览器的上下文中,才可以调用
getElementById
的document
。 Current Eclipse offers out-of-the-box only general JavaScript support . 当前的Eclipse仅提供现成的常规JavaScript支持 。
For example, the Tern Eclipse IDE offers what you want: 例如, Tern Eclipse IDE提供了您想要的:
The Tern Eclipse IDE supports a couple of JavaScript frameworks, eg if you select the jQuery module, you can type $.
Tern Eclipse IDE支持两个JavaScript框架,例如,如果选择jQuery模块,则可以键入
$.
and hit Ctrl + Space to get jQuery specific functions proposed. 并按Ctrl + Space以获得建议的jQuery特定功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.