Documenting an array of type T in vsdoc format for

2019-07-18 00:37发布

问题:

Following these guidelines for vsdoc documentation, I've been unable to get intellisense to work properly for an array of a given type. Here is some code that demos the problem

function MyType() {
    /// <summary>Class description here</summary>
    /// <field name="PropertyA" type="Boolean">Description of Property A</field>
    /// <field name="PropertyB" type="String">Description of Property B</field>
 }
MyType.prototype.PropertyA = false;
MyType.prototype.PropertyB = "";

function testFunc(arrayOfMyType) {
    /// <summary>Description of testFunc</summary>
    /// <param name="arrayOfMyType" type="Array" elementType="MyType">asdfasdf</param>

    // right here, I should get the intellisense for an item of type MyType but I don't
    arrayOfMyType[0].

}

Right after arrayOfMyType[0] I should get intellisense for MyType but I don't. I've also tried a for-in loop to see if that would bring up the right intellisense but it doesn't. I should note that arrayOfMyType does have proper intellisense for an Array, and if I change it from Array to MyType then I get the correct intellisense for that, but not as an Array of type MyType as commented in the example.

At the moment I only have access to pre-sp1 vs2010 so I'm not sure if its a bug they've patched or not.

Could anyone tell me if

  • I'm writing my vsdoc xml comments incorrectly
  • I'm correct or not about expecting to get the intellisense for MyType at that line
  • The intellisense for the above snippet works in vs2010 sp1

回答1:

http://msdn.microsoft.com/en-us/library/vstudio/hh542725.aspx

function Point(x, y) {
    /// <summary>My class.</summary>

    /// <field name="x" type="Number">X coordinate</field>
    this.x = x;

    /// <field name="y" type="Number">Y coordinate</field>
    this.y = y;
}

function testFunc(arrayOfMyType) {
    /// <summary>Do a thing</summary>
    /// <param name="arrayOfMyType" type="Array" elementType="Point">Array of Points</param>

    // Do something
}


回答2:

VS ItelliSense does not support each and every feature of JS XML doc comments. I guess this is one of the unsupported ones.