Comment javascript methods in Visual Studio

给你一囗甜甜゛ 提交于 2019-12-19 05:16:45

问题


Is there a way to insert a snippet for XML comments in javascript in Visual Studio 2010 with automatically generated parameters?

If I type /// here...

function foo(a, b){

...it should change to this (depending on the parameters):

function foo(a, b){
    /// <summary>$cursorhere</summary>
    /// <param name="a" type="string">Param a</param>
    /// <param name="b" type="string">Param b</param>
    /// <returns type="function">Return function</returns>

So it would be similar to the snippet generation if I'm in C# code.

EDIT

To clarify, I just want to know if there is a shortcut or existing plugin to achieve the functionality mentioned above approximately.


回答1:


You can make a code snippet, but that seems too much trouble to me. I use JScript vsdoc Stub Generator, it generates XML comments like these ones:

This extension's goal is to provide a simple way to add vsdocs to JavaScript that acts similar to other XML comments provided by Visual Studio. A comment stub is created when a triple-slash ("///") is added on a new line.




回答2:


I think you're looking for JS intellisense comments and references, described here:

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

Basically it's very similar to what you expected.

UPDATE: sorry, didn't read your question properly. Snippets are trivial to make for yourself, it's not even a plugin really, just an xml file you add to your file system. You can use the snippet editor: http://snippeteditor.codeplex.com/ to make it even easier.



来源:https://stackoverflow.com/questions/12489353/comment-javascript-methods-in-visual-studio

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