views:

381

answers:

1

According to this blog post, Netbeans's supposed to support Javascript type inference. And Javascript support should be built-in to the Netbeans editor. However when I add an HTML file to a simple Java project, and include the Raphael javascript library using <script src="..."/> it seems that Netbeans does not recognize the library. Even very simple completions, like detecting the new Raphael function in the window object are not working.

For example:

<html>
    <head>
        <title>Raphael Play</title>
        <script type="text/javascript" src="raphael.js"></script>
        <script type="text/javascript">
window.onload = function() {
    var paper = new Raphael(document.getElementById('canvas_container'),
        500, 500);
    // no ctrl+space for autocomp Ra -> Raphael
    var candy = paper.set();
    // and of course paper is recognized as Object, no autocompletions for it.
     </script>
    </head>
    <body>
        <div id="canvas_container"></div>
    </body>
</html>
A: 

Not sure about Netbeans support, but as far as I know autocompletion (if that's what you need) in JS is only possible by continuously running your code. In Firebug for example you do it by pressing tab in console.

skrat
Read the first link to Sun's blog post. Your statement is incorrect, as in many cases you can use type inference to get the autocompletion data. I think IntelliJ's IDEA does that for Javascript.
Elazar Leibovich