Eclipse 3.4 Ganymede Javascript Validation Issue
Asked Answered
D

7

12

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.

Deemphasize answered 4/11, 2008 at 6:11 Comment(0)
L
8

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.

Ladd answered 10/8, 2009 at 18:6 Comment(0)
L
6

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).

Lewan answered 4/11, 2008 at 12:40 Comment(3)
Window -> Preferences -> Validation -> JavaScript Syntax ValidationLewan
Has anyone else been unsuccessful in turning off JavaScript validation in Ganymede? Have tried the above. Have also tried Window -> Preferences -> Validator -> Errors / Warnings, and ignored everything. But I'm still seeing errors. Any help would be appreciated.Judicator
You may also have to go to Project->Properties->JavaScript->JavaScript Libraries, Source tab and remove all entries for your project.Photofinishing
M
3

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 : )

Manysided answered 2/2, 2010 at 20:53 Comment(1)
This did it for me. Thank you 1000x. Ganymede is the primary issue here I believe.Hydr
N
2

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

Neigh answered 24/4, 2009 at 15:48 Comment(1)
This did it for me on Eclipse 3.6.2. After I turned of JS validation, the red lines were still there. I disabled "Report problems as you type", saw that they were gone, then re-enabled "Report problems..." and the lines stayed away. Thx.Frizette
S
1

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.

Saintpierre answered 1/4, 2009 at 19:1 Comment(0)
L
1

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.

Lockyer answered 2/12, 2010 at 20:36 Comment(0)
J
1

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.

Jackqueline answered 7/2, 2012 at 22:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.