Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » newb Q's, ctrl+space(new to js not new to code)
newb Q's, ctrl+space [message #699428] Thu, 21 July 2011 14:29 Go to next message
cytg.net is currently offline cytg.netFriend
Messages: 2
Registered: July 2011
Junior Member
Hi, I am in the midst of setting up a working env. for javascript development. I've hacked around with js before but always in different editors / envoriments with little to no support for the actual language.
The eclipse bundle with WTP looks quite promosing, but I allready have questions wich i am not able to find elsewhere..

Suppose you have the function

function load(){
var canvas=document.getElementById('Canvas');
var ctx=canvas.getContext('2d');
....
}

I am able to get codeassist on "document." but not on canvas. Well yes, i will get some, but fx. getContext does not show. Is that the way it's supposed to be ? Netbeans 7 doesnt do the trick either.

? Smile

Re: newb Q's, ctrl+space [message #699466 is a reply to message #699428] Thu, 21 July 2011 15:22 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 355
Registered: July 2009
Senior Member
In general, doing completion with Javascript is more difficult than a statically-typed language like Java. It's one thing to build an abstract syntax tree for Java, but to do the same thing with Javascript, the editor has to be able to "execute" the code in the method to get some idea of the type of the variable. And even that can only work if the object was created in the method. If the object was passed in, there's no way to know what type it might be.

In short, Javascript has some advantages as a dynamically-typed language, but because of that, Eclipse or any other "advanced" text editor is going to be limited in how it can help you write Javascript code.
Re: newb Q's, ctrl+space [message #699471 is a reply to message #699466] Thu, 21 July 2011 15:37 Go to previous messageGo to next message
cytg.net is currently offline cytg.netFriend
Messages: 2
Registered: July 2011
Junior Member
TY

that was what I was looking for ie. confirmation that there is nothing 'better' outthere Smile

Re: newb Q's, ctrl+space [message #699764 is a reply to message #699428] Fri, 22 July 2011 09:24 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 2333
Registered: July 2009
Senior Member
You've actually got two problems, one you can solve, one we hope to solve for Indigo SR1. The first is that the tool doesn't know that 'canvas' is an HTMLCanvasElement. You can solve that by just adding the correct JSDoc above the assignment. The problem after that is that the HTML5 version of the browser library (you can change the version by opening its properties under the JavaScript Resources node of the Project or Script Explorer) is not yet finished--there's no definition for HTMLCanvasElement or other HTML5 elements in there. When both of those are solved, it'll work the way you want.

---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:Does Eclipse IDE support WebSphere Application Server v8 beta?
Next Topic:org.eclipse.wst.wsdl versus javax.wsdl
Goto Forum:
  


Current Time: Mon Nov 24 03:09:20 GMT 2014

Powered by FUDForum. Page generated in 0.03569 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software