Thursday, March 3, 2011

Intellisense for AJAX and Javascript libraries in Visual Studio

I know about using a -vsdoc.js file for intellisense, and the one for JQuery is easy to find. What other javascript / AJAX / DHTML libraries have them and where can I find those files? Also, is there a document which outlines the specifications for -vsdoc.js files?

From stackoverflow
  • Excellent blog posting from Betrand LeRoy on intellisense format for javascript:

    http://weblogs.asp.net/bleroy/archive/2007/04/23/the-format-for-javascript-doc-comments.aspx

    In a nutshell:

    Summary - used to describe a function/method or event. Syntax:

    <summary locid="descriptionID">Description</summary>
    

    Parameter - describe a parameter to a function/method. Syntax:

    <param name="parameterName"
        mayBeNull="true|false" optional="true|false"
        type="ParameterType" parameterArray="true|false"
        integer="true|false" domElement="true|false"
        elementType="ArrayElementType" elementInteger="true|false"
        elementDomElement="true|false"
        elementMayBeNull="true|false">Description</param>
    

    The param tag is used to describe the parameters of a method or constructor. The param tags should be in the same order as the method or constructor's parameters and have the same names.

    Function return type - syntax:

    <returns
        type="ValueType" integer="true|false" domElement="true|false"
        mayBeNull="true|false" elementType="ArrayElementType"
        elementInteger="true|false" elementDomElement="true|false"
        elementMayBeNull="true|false">Description</returns>
    

    Value type - describes a property (shouldnt use 'summary' for a prop) - syntax:

    <value
        type="ValueType" integer="true|false" domElement="true|false"
        mayBeNull="true|false" elementType="ArrayElementType"
        elementInteger="true|false" elementDomElement="true|false"
        elementMayBeNull="true|false"
        locid="descriptionID">Description</value>
    

    Field - used to describe a field in a javascript class - syntax:

    <field name="fieldName" type="FieldType"
        integer="true|false" domElement="true|false" mayBeNull="true|false"
        elementType="ArrayElementType" elementInteger="true|false"
        elementDomElement="true|false" elementMayBeNull="true|false"
        locid="descriptionID">Description</field>
    

    How to include intellisense for an external javascript file, the following syntax as the first line(s) in a javascript file:

    <reference path="path/to/the/script/reference.js"
        assembly="Assembly.Name" name="ScriptResourceName.js"/>
    
  • You can find Intellisense for MooTools here: http://code.google.com/p/mootoolsintellisense/downloads/list

  • Some guy built a very nice vsdoc for Google Maps V3. I use it, it works well. ;-)

  • I wrote on article to sum up (from investigation) what parts of vsdoc are used to help Intellisense in VS 2010 : http://www.scottlogic.co.uk/2010/08/vs-2010-vs-doc-and-javascript-intellisense/

0 comments:

Post a Comment