Eclipse:Content Assist不显示建议 [英] Eclipse: Content Assist not showing suggestions

查看:83
本文介绍了Eclipse:Content Assist不显示建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Win 10(64位),并且已经在Eclipse Photon和版本2018-09(两次都是64位版本)中进行了尝试,但是两种方式我都得到了相同的结果:

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:

我创建了一个新项目(文件>新建>项目...:JavaScript> JavaScript项目)和一个JavaScript脚本(文件>新建> JavaScript源文件).如果输入

I created a new project (File > New > Project...: JavaScript > JavaScript Project) and a JavaScript script (File > New > JavaScript Source File). If I type

function test() {
    var inputField = doc
}

然后按 Ctrl + Space ,它应该给我一个建议列表,但列表只显示无默认建议" .如果在写完文档后再次按 Ctrl + Space .列表仅显示"MISSING" .

then press Ctrl+Space, it should give me a list of suggestions but instead the list only says "No Default Proposals". If I press Ctrl+Space again after writing document. the list only says "MISSING".

在HTML文件的< script></script> 部分内编写代码将导致相同的空白窗口.对于HTML和CSS的建议通常可以奏效,但有时窗口甚至根本无法打开,如果我写的是< sty ,没有关于< style> 的建议.

Writing code inside the <script></script> part of an HTML file results in the same empty window. Suggestions for HTML and CSS often work but sometimes the window doesn't even open in the first place and if I write e.g. <sty, there's no suggestion for <style>.

如果我编写例如,我可以用某种方式训练Eclipse:

I can train Eclipse in a way if I write e.g.:

var inputField = document.getElementById("inputField");
inputField.style = "red";

再次编写 inputField 后,按 Ctrl + Space 会提示样式" .这仅在同一个文件中有效,如果我在不同的脚本中获得了相同的输入字段,则不建议使用"style" .

Pressing Ctrl+Space after writing inputField again suggests "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".

我没有更改任何设置( Window> Prerferences ):

I haven't changed anything about the settings (Window > Prerferences):

  • JavaScript>编辑器>内容辅助:未选中启用自动激活"(我不希望这样做),并且启用它不会更改任何内容
  • JavaScript-编辑器-内容辅助-高级:单击(我尝试检查除"Word Proposals"之外的所有内容,但没有任何变化)
  • Web> HTML文件>编辑器>内容辅助:所有内容均已检查
  • Web> CSS文件>编辑器>内容辅助:所有内容均已检查
  • JavaScript > Editor > Content Assist: "Enable auto activation" isn't checked (I don't want it to do that) and enabling it doesn't change anything
  • JavaScript - Editor - Content Assist - Advanced: click (I tried checking everything except "Word Proposals" but no change)
  • Web > HTML Files > Editor > Content Assist: Everything is checked
  • Web > CSS Files > Editor > Content Assist: Everything is checked

我正在将Mars.2用于Java项目,并且在那里一切正常,所以不确定是否是该版本(我不想为新的JS项目使用旧的版本),或者Eclipse是否可以无法正确处理JS.

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.

任何想法/建议我可以尝试解决此问题(无需安装额外的插件)吗?

Any ideas/suggestions what I could try to fix this (without installing extra plugins)?

我刚刚尝试了两个以上的版本:它可与Mars.2(PHP)一起使用,但不适用于Neon.我仍然更喜欢修复Photon或2018-09,而不是使用将近3年前发布的版本.

I just tried 2 more versions: It works with Mars.2 (PHP) but not with Neon. I'd still prefer fixing Photon or 2018-09 though instead of using a version that was released almost 3 years ago.

推荐答案

仅在网络浏览器的上下文中,存在一个文档 ,您可以在其上调用 getElementById .当前的 Eclipse 仅提供现成的常规JavaScript支持.

Only in the context of a web browser there is a document on which you can call getElementById. Current Eclipse offers out-of-the-box only general JavaScript support.

例如, Tern Eclipse IDE 提供您想要的东西:

For example, the Tern Eclipse IDE offers what you want:

  1. 右键单击项目,然后选择 配置>转换为Tern项目...
  2. 选择 浏览器 模块

Tern Eclipse IDE支持两个JavaScript框架,例如.G.如果选择 jQuery 模块,则可以键入 $.并按 Ctrl + Space 以获得jQuery特定功能建议.

The Tern Eclipse IDE supports a couple of JavaScript frameworks, e. g. if you select the jQuery module, you can type $. and hit Ctrl+Space to get jQuery specific functions proposed.

这篇关于Eclipse:Content Assist不显示建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆