在 Visual Studio 中注释 JavaScript 方法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12489353/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 16:18:29  来源:igfitidea点击:

Comment javascript methods in Visual Studio

javascriptvisual-studio-2010comments

提问by Marc

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

有没有办法使用自动生成的参数在 Visual Studio 2010 中的 javascript 中插入 XML 注释的片段?

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.

因此,如果我使用 C# 代码,它将类似于代码段生成。

EDIT

编辑

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

为了澄清,我只是想知道是否有一个快捷方式或现有的插件来实现功能上面提到的

回答by Evandro Silva

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:

您可以制作代码片段,但这对我来说似乎太麻烦了。我使用JScript vsdoc Stub Generator,它生成这样的 XML 注释:

enter image description here

在此处输入图片说明

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.

此扩展的目标是提供一种简单的方法将 vsdocs 添加到 JavaScript,其作用类似于 Visual Studio 提供的其他 XML 注释。当在新行上添加三重斜线(“///”)时,会创建一个注释存根。

回答by Paul

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

我认为您正在寻找 JS 智能感知评论和参考,描述如下:

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

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.

更新:抱歉,没有正确阅读您的问题。为自己制作代码片段很简单,它甚至不是真正的插件,只是您添加到文件系统中的 xml 文件。您可以使用代码段编辑器:http: //snippeteditor.codeplex.com/使其更容易。