以 vsdoc 格式记录 javascript 的 T 类型数组,我发现错误了吗?

发布于 2024-11-14 13:04:44 字数 1330 浏览 3 评论 0原文

遵循 这些 vsdoc 指南文档,我一直无法让智能感知对给定类型的数组正常工作。下面是一些演示问题的代码,

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 循环来查看是否会产生正确的智能感知,但事实并非如此。我应该注意到 arrayOfMyType 确实对 Array 具有正确的智能感知,如果我将其从 Array 更改为 MyType然后我得到了正确的智能感知,但不是作为示例中注释的 MyType 类型的 Array

目前我只能访问 sp1 之前的 vs2010,所以我不确定他们是否修复了这个错误。

谁能告诉我,如果

  • 我写的 vsdoc xml 注释不正确,
  • 我是否期望在该行获得 MyType 的智能感知 上述代码
  • 片段的智能感知适用于 vs2010 sp1

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

他夏了夏天 2024-11-21 13:04:44

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
}

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
}
习ぎ惯性依靠 2024-11-21 13:04:44

VS ItelliSense 不支持 JS XML 文档注释的所有功能。我想这是不受支持的之一。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文