Documenting an array of type T in vsdoc format for javascript, Did I Find a Bug?

[亡魂溺海] 提交于 2019-12-11 02:21:55

问题


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.



来源:https://stackoverflow.com/questions/6292937/documenting-an-array-of-type-t-in-vsdoc-format-for-javascript-did-i-find-a-bug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!