jQuery 更改 Eclipse 设置以忽略特定文件上的错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4282448/
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
Change Eclipse settings to ignore errors on a specific file
提问by oym
In my dynamic web project in eclipse, I have jQuery in my js source folder. For some reason, Eclipse is not handling it correctly and interpreting many lines as errors in the standard jQuery file (even though I have the javascript development tools installed).
在我的 Eclipse 动态 Web 项目中,我的 js 源文件夹中有 jQuery。出于某种原因,Eclipse 没有正确处理它并将许多行解释为标准 jQuery 文件中的错误(即使我安装了 javascript 开发工具)。
Can I turn off the error checking on the jQuery file (and that file only)? I still want it to detect errors as usual, but ignore anything in jQuery.js.
我可以关闭对 jQuery 文件(以及该文件)的错误检查吗?我仍然希望它像往常一样检测错误,但忽略 jQuery.js 中的任何内容。
采纳答案by Gábor Lipták
It looks like eclipse has changed a bit,
but the following method which worked for me seems very close to the old one.
看起来 eclipse 发生了一些变化,
但以下对我有用的方法似乎与旧方法非常接近。
The solution consists of 2 steps:
解决方案包括 2 个步骤:
First you have to update Eclipse's preferences (
Window > Preferences
):Make sure that you check both
Manual
&Build
next to theValidator
you need
(in my case - a javascript one).Last you should change your project'sValidators:
Click on
Client-side JavaScript Settings
(or any other validator you need):The explanation is clear but basically what you should do is as follows:
Click on
Add Exclude Group...
, select it and then click onAdd rule...
.
Then pickFolder or file name
(note that there are other options), and specify your file/folder.
首先,您必须更新 Eclipse 的首选项 (
Window > Preferences
):确保在您需要的旁边同时检查
Manual
& (在我的情况下 - 一个 javascript )。Build
Validator
最后,您应该更改项目的验证器:
单击
Client-side JavaScript Settings
(或您需要的任何其他验证器):解释很清楚,但基本上你应该做的如下:
单击
Add Exclude Group...
,选择它,然后单击Add rule...
。
然后选择Folder or file name
(注意还有其他选项),并指定您的文件/文件夹。
You should be able to verify that its working by deleting the existing errors/warnings,
and then left-click your project and select the Validate
option.
您应该能够通过删除现有的错误/警告来验证其是否正常工作,
然后左键单击您的项目并选择该Validate
选项。
This setting can be committed into source control as well.
此设置也可以提交到源代码管理中。
回答by danpop
I had javascript errors seen on jquery mobile file on an Android Phonegap project. I simply removed the file from the project and add it afterwards. It works now.
我在 Android Phonegap 项目的 jquery 移动文件上看到了 javascript 错误。我只是从项目中删除了该文件,然后再添加。它现在有效。
回答by Adam
With eclipse Luna I was getting this as well. I did a right click on jquery.jqGrid.min.js and selected 'Validate'. It then validated fine and the errors went away.
使用 eclipse Luna 我也得到了这个。我右键单击 jquery.jqGrid.min.js 并选择了“验证”。然后它验证得很好,错误就消失了。
回答by Vishnu Dahatonde
Not sure if it'll work for all. But what i did was select the unnecessary errors in 'problems' tab of eclipse, Rclick and Delete. Eclipse stopped showing the error..
不确定它是否适用于所有人。但是我所做的是在 eclipse、Rclick 和Delete 的“问题”选项卡中选择不必要的错误。Eclipse 停止显示错误..
回答by Mandark
Perform these steps to solve this(This will disable eclipse validation for Javascript): 1. Go to Eclipse > preference > Javascript> validators > Errors/Warnings 2. Uncheck "Enable JavaScript semantic validation".
执行以下步骤来解决这个问题(这将禁用 Javascript 的 Eclipse 验证): 1. 转到 Eclipse > 首选项 > Javascript> 验证器 > 错误/警告 2. 取消选中“启用 JavaScript 语义验证”。
If you have messed around with the javascript settings in your projects, then restore everything to default first for all the projects that u have changed. After that, follow the steps.
如果您弄乱了项目中的 javascript 设置,那么首先将您更改的所有项目的所有内容恢复为默认值。之后,按照步骤操作。
回答by user2047883
One way is that : 1.remove javascript -> validator -> errors/warning. 2.remove project -> .project file -> javascript command 3.It is important,too! delete js file and import again.
一种方法是: 1.remove javascript -> 验证器 -> 错误/警告。2.remove project -> .project file -> javascript command 3.这也很重要!删除js文件并重新导入。