使用vsdoc格式为JavaScript记录T型数组,我是否发现错误? [英] Documenting an array of type T in vsdoc format for javascript, Did I Find a Bug?
问题描述
以下这些vsdoc文档指南,我一直无法使intellisense在给定类型的数组上正常工作.这是一些演示问题的代码
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].
}
在arrayOfMyType[0]
之后,我应该获得MyType的智能感知能力,但我没有.我还尝试了一个for-in循环,以查看是否可以调出正确的intellisense,但事实并非如此.我应该注意,arrayOfMyType
对于Array
确实具有适当的智能感知,如果我将其从Array
更改为MyType
,则可以获得正确的智能感知,但不能作为
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.
目前我只能访问sp1之前的vs2010,所以我不确定他们是否已修补了它的错误.
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.
任何人都可以告诉我
- 我写的vsdoc xml注释不正确
- 我对在那一行获取MyType的智能感知是否正确
- 上述代码段的智能感知在vs2010 sp1中有效
推荐答案
http://msdn.microsoft.com/zh-CN/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
}
这篇关于使用vsdoc格式为JavaScript记录T型数组,我是否发现错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!