I'm trying to get Eclipse to code assist the google libraries but it seems that the parser for code assist is not up to it.
Found that the DOM is code assisted using the following syntax (definition of Document):
function HTMLElement(){};
HTMLElement.prototype = new Element();
Document.prototype.getElementById=function(elementId){return new HTMLElement();};
So using the deps.js and some javascript I tried to generate that code and it looks something like this:
$goog=function(){};
$goog$Delay=function(){};
$goog.prototype.Delay=new $goog$Delay()
$goog$Disposable=function(){};
$goog.prototype.Disposable=new $goog$Disposable()
Window.prototype.goog=new $goog();
It will code assist but the full deps.js will generate 5850 lines and when adding that code to my project and typing goog.
it'll not only crash but bring my computer to a complete halt until I kick Ecliple's process.
It looks like a lot but realy isn't that much to process, in a video I see about typescript I see it code assist the entire dom (including element style which is missing in Eclipse). Even the online IDE gives me code assist for the entire dom. My guess is that the parser for code assist is in dire need of improvement if a javascript IDE can do better than a compiled Java program.
Is there a way I can add these definitions for code assist without the IDE chocking?
If I were to type document.getElementById
then put my cursor somewhere in the getElementById function and press F3 it'll open up baseBrowserLibrary.js but this file is created in a temp directory so it suggest it's actually compiled somewhere. I wonder how hard it would be to add a compiled library that defines the closure library.
I would improve the script so far and have it read the files that define the goog.provide(d) objects so I can add the comments as well. But If compiling it is too much trouble than it's better to forget about it since providing a javascript file with the definition is too much for Eclipse/JSDT to handle.
[update]
I see in the eclipe/pligins/org.eclipse.wst.jsdt.core_1.1.202.v201208171701.jar the directory libraries and that contains baseBrowserLibrary.js this looks like the same file as the file opened by eclipse when you go to the definition of document.getElementById
for example. Don't know why adding my own js file makes the code assist painfully slow. Tried to wrap the js file in user library
but that didn't improve the speed at all.