开发者

VS2010: Syntax Color Highlighting and Intellisense in a JS file

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')

VS2010: Syntax Color Highlighting and Intellisense in a JS file

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

VS2010: Syntax Color Highlighting and Intellisense in a JS file

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 b开发者_如何学JAVAestest Search app ever written, it found it it .003 nano seconds in the following locations:

VS2010: Syntax Color Highlighting and Intellisense in a JS file

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" />


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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜