in

ASPXWizard.net

.net and Ajax Community

Mina Labib

Enable JQuery Intellisense in Visual Studio 2008

I was expecting that Visual studio will do the magic for me and enable Intellisense for JQuery javascript library automatically once I add the library and referenced it in my page – naive, right?- anyways it did not happen of course, so with a quick look to the internet and beloved Scott Guthrie blog I found that I need couple of steps to enable it; It is easy and quick steps so I liked to share it with other naive developers :).

  1. Install Visual Studio 2008 SP1.
    This service pack adds richer javascript intellisense support for Visual Studio 2008, you will find it here.
  2. Install Visual Studio 2008 Patch KB958502 to support “-vsdoc.js” Intellisense files
    This patch apply for VS2008 SP1 and VWD Express SP1, enables Visual Studio to detect “-vsdoc.js” files when javascript library is referenced and use it to enable Javascript Intellisense. This patch can be found here.
  3. Download the JQeury Visual Studio doc file.
    You can find this file with ASP.NET MVC package as it is included by default or you can find it in JQuery official web site as Visual Studio documentation.VS08 JQuery
  4. Save “vsdoc.js” file in the same directory
    Save the Visual Studio documentation file in the same directory of the JQuery library, and then you can reference the library in your page as below:
    <script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
    start now to use the Javascript Intellisense feature.
    Important Trick:
    Sometimes we use partial views or user controls in our project and we do not to refer to Javascript library within it, we usually refer to it in Master page or the parent page; Visual Studio has no way to know this script is available in for the user control or the partial view, thus Javascript Intellisense will NOT be enabled in these files, to enable Javascript Intellisense in the partial/user control there is a useful trick by reference the library surrounded with If(false) statement which will never be rendered in the run time, but still provide Javascript intellisense in the design time.
    <% if (false)
       { %>
       <script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
    <% } %>


References:



Comments

 

Ali Tarhini said:

the problem and its solution is described here < href="www.developersource.net/DevPage.aspx IntelliSense for JQuery in Visual Studio</a>

December 29, 2009 11:25 PM

Leave a Comment

(required)  
(optional)
(required)  
Add
ASPXWizard.net some rights reserved 2005-2007
Powered by Community Server (Non-Commercial Edition), by Telligent Systems