views:

166

answers:

3

I have an external *.js file that contains Javascript. How do I get teh same intellisense and color highlighting as I do in an ASPX page?

Here's my options for the js extension (set to 'Script Editor') Options

And here's what it looks like in an ASPX page (How I would like it to look.) aspx page

BTW, I did a full reset my Settings, setting them to VB and no luck.

Update to original post:

Cuban suggested I add a reference to the file "jquery-1.3.2.min.js." When I searched my PC for that file using the fastest bestest Search app ever written, it found it it .003 nano seconds in the following locations:

jquery-1.3.2.min.js

Basically, the file magically appeared in a couple of my throw away VS2010 test web apps and in a VS2008 Common folder. I don't know why it was added or how I got it and why it doesn't appear under the 2010 web app that I am currently working on.

I am interested in learning JQuery, and I imagine having intellisense work would be a great help, not to mention I really would like to get the Intellisense and syntax highlighting working in external js file.

How would I modify the following statement from Cuban? Do I need to set a reference something first? And what's with the triple slash? I haven't seen this convention before.

Please help the clueless.

Thanks.

/// <reference path="../../Content/javascript/jquery/jquery-1.3.2.min.js" />
A: 

Try setting it to HTML editor. Highlighted most things for me in VS 2008.

foxwoods
I did before I posted. It didn't really help highlight the Javascript any better or give me better intellisense.
Velika
A: 

You need to add a reference tag. For our .js files, for jQuery we use:

/// <reference path="../../Content/javascript/jquery/jquery-1.3.2.min.js" />

And that gives us Intellisense in our JS files for jQuery. Just reference whichever script you want Intellisense for and it should work.

CubanX
See my updated comment. Note that this is VS2010. I suspect that what may be necessary in 2008 may not be so in 2010.
Velika
George,I'm using this right now in VS2010 :) And it is what made intellisense work...
CubanX
+2  A: 

Close the darn js file and re-open it!!!!!!!!!!!!!!!!!!!!!!!!!

Velika