Eclipse 3.4 Ganymede Javascript 验证问题

发布于 2024-07-08 12:11:41 字数 818 浏览 11 评论 0 原文

我刚刚第二次升级到 Eclipse 3.4,我认为现在已经好了。 第一次(刚发布时)bug太多,让我无法忍受(主要是PDT 2.0插件); 但现在看来一切都解决了。

我的问题是 Javascript 验证器。 如果我在项目的一个 JS 文件中定义一个类,然后尝试在另一个 JS 文件中使用它,它会告诉我该类型未定义。 这真的很烦人,因为我的一些脚本中到处都是红色的波浪线。

另一个问题是这段代码:

var m_dialogFrame = document.getElementById(m_dialogId);

制作一个黄色曲线,显示“类型不匹配:无法从 Element 转换为 ___m_dialogBody5” 我可以通过添加

    /**
     * @type Element
     */

Before 来修复它,但这也会很混乱。

另外,两者:

new XMLHttpRequest();

new ActiveXObject("Microsoft.XMLHTTP");

获得红色波浪线,表示“x 无法解析为类型”

最后一个问题是:

if (m_options.width != "auto")

获得红色波浪线,因为:“运算符 != 未定义参数类型数字、字符串”

我该如何解决这些问题,或者只是废弃整个 Javascript 验证工具? 顺便说一句:如果我能让它工作的话,看起来棒极了。

I just upgraded to Eclipse 3.4 for the second time and I think its for good now. The first time (right when it was released) was too buggy for me to stomach (mainly the PDT 2.0 plug-in); but now it seems to be all worked out.

My problem is the Javascript validator. If I define a class in one JS file in my project, then try to use it in another, it tells me that the type is undefined. This is really annoying as some of my scripts are littered with red squigglys.

Another problem is that this code:

var m_dialogFrame = document.getElementById(m_dialogId);

Makes a yellow squiggle saying "Type mismatch: cannot convert from Element to ___m_dialogBody5" I can fix it by adding

    /**
     * @type Element
     */

Before it, but that, also, will be messy.

Also, both:

new XMLHttpRequest();

And

new ActiveXObject("Microsoft.XMLHTTP");

Get red squiggles saying "x cannot be resolved to a type"

The last problem is with:

if (m_options.width != "auto")

Gets a red squiggly because: "The operator != is undefined for the argument type(s) Number, String"

How can I fix these issues, or just scrap the entire Javascript validation tool? BTW: it looks frikin awesome if I can get it to work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

鸩远一方 2024-07-15 12:11:42

看起来这个问题是由于 Eclipse 的默认浏览器没有所需的库造成的。

尝试以下步骤添加所需的库:
项目-> 属性-> JavaScript -> JavaScript 库 -> 库(选项卡)-> 添加运行时库-> 选择“Internet Explorer Library”

这应该可以解决问题。 它对我有用。

Looks like this problem is due to the default browser for Eclipse not having the required libraries.

Try below steps to add the required library:
Project -> Properties -> JavaScript -> JavaScript Libraries -> Libraries(tab) -> Add Runtime Library -> select 'Internet Explorer Library'

This should resolve the issue. It did for me.

紧拥背影 2024-07-15 12:11:42

不幸的是,您可能不得不放弃 JavaScript 验证。

根据我的经验,与 Eclipse 3.4 捆绑在一起的 JavaScript 工具很难......好吧,完全理解 JavaScript,结果会生成虚假的警告和错误。

例如,使用Object作为穷人的命名空间的常见做法会导致它完全丢失。 这是尝试理解 href="http://code.google.com/p/js-forms/source/browse/trunk/time.js" rel="nofollow noreferrer">此 JavaScript 文件 - 请注意无用的大纲视图和虚假(且不正确)的警告和错误(包括似乎不理解 String.split 返回一个 Array)。

Unfortunately, you might just have to scrap the JavaScript validation.

In my experience, the JavaScript tools which come bundled with Eclipse 3.4 have a hard time... well, understanding JavaScript at all, generating bogus warnings and errors as a result.

For example, the common practice of using an Object as a poor man's namespace causes it to get completely lost. Here's a screenshot of the kind of mess it makes when trying to understand this JavaScript file - note the useless outline view and the spurious (and incorrect) warnings and errors (including not seeming to understand than String.split returns an Array).

时常饿 2024-07-15 12:11:42

这是非常痛苦的。 对我来说解决问题的一种方法是从构建中排除所有 js 文件。 属性 -> javascript -> 库 -> 源选项卡并排除所有给您带来问题的文件......这很遗憾,因为我想要一些自动完成...... :( 但需要完成项目才能工作。 ...
如果有人有解决方案,我们将不胜感激:)

This is very painful. One way to solve the problem for me was to exclude all the js files from the build. Properties->javascript->Libraries->Source tab and exclude all the files that give you problems....its a pitty because I wanted some autocomplete.... : ( but need to finish the project for work....
If somebody has a solution it would be highly appreciated : )

等往事风中吹 2024-07-15 12:11:42

显然,要完全禁用验证,您还应该禁用 JavaScript -> 下的“键入时报告问题”。 编辑。

Apparently to fully disable the validation you should also disable "Report problems as you type" under JavaScript -> Editor.

各空 2024-07-15 12:11:42

经过几个小时的环顾四周,我找到了如何明确删除 JS 验证。

这意味着编辑您的 .project 文件,因此请先备份以防万一。

  • 关闭 Eclipse
  • 打开 .project 文件
  • 查找以下行: org.eclipse.wst.jsdt.core.jsNature
  • 删除它
  • ,保存文件并启动 Eclipse

不再有红色或黄色的乱码......但不再有 js 验证。

如果有人知道如何在不编辑 .project 文件的情况下正确执行此操作,请分享。

After hours of looking around I have found how to definetly remove JS validation.

This means editing your .project file, so back it up before just in case.

  • Close Eclipse
  • Open your .project file
  • look for the following line : <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
  • delete it
  • save your file and start Eclipse

There no more red or yellow squibble all over the place... but no more js validation.

If anyone knows how to do it properly without editing .project file please share.

孤云独去闲 2024-07-15 12:11:42

我发现旧的验证错误将保留在问题视图中并在文件中突出显示,直到您告诉它再次验证之后,因此在保存 JSP 验证首选项后,右键单击一个项目以验证其中的所有内容; 这将使错误消失。

I found that old validation errors will stick around in the problems view and highlighted in the files until after you tell it to validate again, so after saving your JSP validation preferences, right click on a project to validate everything in it; that will make the errors go away.

萌吟 2024-07-15 12:11:42

user85835 的答案对我有一点帮助,但我还需要遵循这两个额外的步骤。

首先,为了真正删除警告和错误并避免立即重新创建它们,请执行以下操作:

  1. 在“清理...”窗口中完成清理后禁用自动立即重建。
  2. 清理项目

然后关闭 Eclipse 并删除 org.eclipse.wst.jsdt.core.jsNature 。 正如用户85835所描述的。

但在重新启动 Eclipse 之前还要执行第二步。

  1. 在您的 .project 文件中查找 包含 org.eclipse.wst.jsdt.core.javascriptValidator 的 XML 块。
  2. 如果你发现这个也删除这个块。

然后保存您的 .project 文件并再次启动 Eclipse

根据您的需要恢复干净并重建设置。

这对我有用。

The answer of user85835 helped me a bit but I also needed to follow these two extra steps.

First in order to actually remove the warnings and errors and avoid having them recreated immediately do like this:

  1. Disable automatic immediate rebuild after clean which is done in the Clean... window.
  2. Clean project

Then close Eclipse and remove the <nature>org.eclipse.wst.jsdt.core.jsNature</nature> as user85835 describes.

But before restarting Eclipse also do this second step.

  1. In your .project file look for a <buildCommand> XML block containing a <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>.
  2. If you find this delete this block too.

Then save your .project file and start Eclipse again

Restore clean and rebuild settings as you wish to have them.

This worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文