让Javascript的智能提示和C#一样强悍

Posted on April 15, 2008 by Fdream

VS 2008的新增的一个巨大特性就是增加了Javascript的调试功能(见:VS2008中JavaScript的智能提示和调试很强大)。没有细说有多强大,其实这种提示和调试可以强大到和VS中的C#一样,javascript的 Intellisense甚至可以跨文件,自动识别类型。不过你的注释得写成这样:

function Element(element, properties){
///

/// Element类,创建一个HTML Element实例
///

/// Element的标签名或者一个当前的DOM元素/// 可选:Element的属性集合,如{‘href’: ‘http://pplive.com‘, ‘class’: ‘myClass’}///
}

这样,当你new一个Element的时候,会出现关于Element这个构造函数作用的提示,键入第一个括号以后,会出现参数提示,键入最后一个括号,再键入一个点,就会出现这个类的所有属性和方法提示。可以跨文件提示,实在是很好用~

分享 |
Categories:
Ajax Web
Tags:
,
Comments:
4 Comments
Views:
4,842 Views

Related Posts

4 Responses to <让Javascript的智能提示和C#一样强悍>

  1. baiej214 says:

    上次向你请教以后重装了系统,好不容易又再次找到你的博。
    看了你的文章,明白了function的智能提示的写法,但是这样的怎么写呢?
    例子:
    var Test={ //这个地方的不知道该怎么写
    method:function(){ //这个的已经明白了点
    ……
    },
    pro:’属性’ //但是像这样的该怎么写呢?
    }
    请教~

  2. Fdream says:

    貌似只有方法才有XML注释~

  3. baiej214 says:

    [surprised]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>