我刚刚第二次升级到 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.
发布评论
评论(7)
看起来这个问题是由于 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.
不幸的是,您可能不得不放弃 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 thanString.split
returns anArray
).这是非常痛苦的。 对我来说解决问题的一种方法是从构建中排除所有 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 : )
显然,要完全禁用验证,您还应该禁用 JavaScript -> 下的“键入时报告问题”。 编辑。
Apparently to fully disable the validation you should also disable "Report problems as you type" under JavaScript -> Editor.
经过几个小时的环顾四周,我找到了如何明确删除 JS 验证。
这意味着编辑您的 .project 文件,因此请先备份以防万一。
不再有红色或黄色的乱码......但不再有 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.
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.
我发现旧的验证错误将保留在问题视图中并在文件中突出显示,直到您告诉它再次验证之后,因此在保存 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.
user85835 的答案对我有一点帮助,但我还需要遵循这两个额外的步骤。
首先,为了真正删除警告和错误并避免立即重新创建它们,请执行以下操作:
然后关闭 Eclipse 并删除org.eclipse.wst.jsdt.core.jsNature 。 正如用户85835所描述的。
但在重新启动 Eclipse 之前还要执行第二步。
然后保存您的 .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:
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.
Then save your .project file and start Eclipse again
Restore clean and rebuild settings as you wish to have them.
This worked for me.