Skip to main content



      Home
Home » Language IDEs » ServerTools (WTP) » newb Q's, ctrl+space(new to js not new to code)
newb Q's, ctrl+space [message #699428] Thu, 21 July 2011 10:29 Go to next message
Eclipse UserFriend
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 11:22 Go to previous messageGo to next message
Eclipse UserFriend
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 11:37 Go to previous messageGo to next message
Eclipse UserFriend
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 05:24 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Does Eclipse IDE support WebSphere Application Server v8 beta?
Next Topic:org.eclipse.wst.wsdl versus javax.wsdl
Goto Forum:
  


Current Time: Tue Jul 08 01:48:58 EDT 2025

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

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

Back to the top