JavaScript and symbol scoping/export question

Hi,

I'm trying to get IntelliJ to work nicely with our homegrown JavaScript framework. In the framework JavaScript source is defined in HTML files in addition to JavaScript files. So it's valid for JavaScript in one HTML file or JavaScript file to reference symbols in another HTML file.

It looks like IntelliJ is designed not to export JavaScript symbols from HTML files. Here's the test case. The symbols that IntelliJ resolves are in colored italic. The unresolved symbols are in gray.

HTML1.html:

<html>
<head>
  <script type="text/javascript">
    function inHTML1() {
      return 1;
    }

    inJavaScript();
    inHTML1();
    inHTML2();

  </script>
</head>
</html>



HTML2.html:

<html>
<head>
  <script type="text/javascript">
    function inHTML2() {
      return 1;
    }
  </script>
</head>
</html>



JS.js:

function inJavaScript() {
  return 1;
}

inJavaScript();
inHTML1();
inHTML2();


I think that if there is some way to get the unresolved symbols in HTML1.html and JS.js to resolve IntelliJ will be much more useful for our JavaScript framework. So, does anyone know if it's possible to do that?

Thanks in advance,
2 comments
Comment actions Permalink

Ok, so my code samples didn't preserve the font styling. It was supposed to be:

<html>
<head>
  <script type="text/javascript">
    function inHTML1() {
      return 1;
    }

    inJavaScript();
    inHTML1();
    inHTML2();

  </script>
</head>
</html>



***

function inJavaScript() {
  return 1;
}

inJavaScript();
inHTML1();
inHTML2();

0
Comment actions Permalink

Indeed JavaScript symbols are not exported from HTML files by design

On 2/9/2012 10:21 PM, Jesse Costello-Good wrote:

Hi,

>

I'm trying to get IntelliJ to work nicely with our homegrown JavaScript framework. In the framework JavaScript source is defined in HTML files in addition to JavaScript files. So it's valid for JavaScript in one HTML file or JavaScript file to reference symbols in another HTML file.

>

It looks like IntelliJ is designed not to export JavaScript symbols from HTML files. Here's the test case. The symbols that IntelliJ resolves are in colored italic. The unresolved symbols are in gray.

>

HTML1.html:

> 
>    
>      function inHTML1() {
>        return 1;
>      }
>
> +inJavaScript+();
> +inHTML1+();
> inHTML2();
>
>    
> 
> 
0

Please sign in to leave a comment.