简体   繁体   English

在Visual Studio Code中是否有像DocBlockr这样的代码注释功能?

[英]Are there code commenting features like DocBlockr in Visual Studio Code?

I use Sublime Text 3, Atom.io, and Bracket.io as previous editors. 我使用Sublime Text 3,Atom.io和Bracket.io作为以前的编辑器。

I am also really enjoying the new Visual Studio Code Editor for Mac. 我也非常喜欢Mac的新Visual Studio代码编辑器。

Are there any code commenting features similar to DocBlockr for Sublime? 是否有任何代码注释功能类似于Subbime的DocBlockr? This is quite crucial for me as I comment a hell of a lot of code. 这对我来说非常重要,因为我评论了很多代码。

The Visual Studio Code Marketplace now has a doc block extension for JavaScript & others may be added soon. Visual Studio Code Marketplace现在具有JavaScript的文档块扩展,其他可能很快就会添加。 https://marketplace.visualstudio.com/items?itemName=stevencl.addDocComments https://marketplace.visualstudio.com/items?itemName=stevencl.addDocComments


Formerly, it had partial support for this. 以前,它对此有部分支持。 As mentioned by others, you could get it by typing /** and then ENTER but only if you are in a JavaScript file. 正如其他人所提到的,你可以通过输入/**然后输入来获得它,但前提是你在JavaScript文件中。 I don't believe it works in any other language. 我不认为它适用于任何其他语言。

A few similar features had been requested: 已经要求提供一些类似的功能:

https://web.archive.org/web/20170910095011/https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/9417975-intellisense-comments-need-improved-typedoc-and-j https://web.archive.org/web/20170910095011/https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/9417975-intellisense-comments-need-improved-typedoc-and- Ĵ

https://web.archive.org/web/20170910095011/https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/7899765-automatic-formatting-of-and-documentation https://web.archive.org/web/20170910095011/https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/7899765-automatic-formatting-of-and-documentation

https://web.archive.org/web/20170910095011/https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/8248872-true-jsdoc-support-for-ts-and-js https://web.archive.org/web/20170910095011/https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/8248872-true-jsdoc-support-for-ts-and- JS

As of today, and release v1.1 there are not , however it is a highly voted feature. 截至今天,并发布v1.1没有 ,但它是一个高度投票的功能。 I would vote for this feature if you would find it useful, @mattferderer has posted the feature-links you should add your votes to. 如果您觉得有用,我会投票支持此功能,@ mattferderer已发布您应该添加投票的功能链接。 Until then, there are 2 plugins that work very well well used together: 在那之前,有两个插件可以很好地一起使用:

Document This ( ext install docthis ) will generate JsDoc style comments for many JsDoc style annotations. Documentext install docthis )将为许多JsDoc样式注释生成JsDoc样式注释。 Use command Ctrl + Alt + D on or inside of where you want to generate documentation. 在要生成文档的位置或内部使用命令Ctrl + Alt + D

This works well with the plugin "Complete JsDoc Tags" 这适用于插件“完整的JsDoc标签”

Complete JsDoc Tags ( ext install JSDocTagComplete ) Provides code completion for most JsDoc style annotations using Ctrl + space . 完整的JsDoc标记ext install JSDocTagComplete )使用Ctrl + space为大多数JsDoc样式注释提供代码完成。

Using these 2 plugins together works really efficiently. 将这两个插件一起使用非常有效。 DocThis gives the initial generated comment with Ctrl + Alt + D , and can then use ctrl + space to add specific JsDoc annotations DocThis doesn't see/generate. DocThis使用Ctrl + Alt + D给出初始生成的注释,然后可以使用ctrl + space添加DocThis看不到/生成的特定JsDoc注释。

I didn't find the plugin " Add JsDoc Comments " @mattferderer mentions to be very useful. 我没有找到插件“ 添加JsDoc评论 ”@mattferderer提到非常有用。 It only provides you with a @param and @return tag and nothing else... 它只为你提供@param@return标签,没有别的...

It completes the block if you type /**[enter] and then any typing within the block is formatted (eg hit enter on a line beginning with a * and another is inserted below with a *). 如果您键入/**[enter] ,则完成该块,然后格式化块中的任何键入(例如,在以*开头的行中输入,而在*下面插入另一行)。

But one really nice feature of DocBlockr is that it scans the code below and adds @param statements in the block. 但DocBlockr的一个非常好的功能是它扫描下面的代码并在块中添加@param语句。 VS Code does not appear to do this. VS Code似乎没有这样做。

如果您键入/**然后输入并在visual studio代码中获得js doc格式

如果你想要函数或空洞的参数注释,只需键入///作为奖励他们也会在鼠标悬停突出显示

There is https://marketplace.visualstudio.com/items?itemName=neilbrayfield.php-docblocker . https://marketplace.visualstudio.com/items?itemName=neilbrayfield.php-docblocker

It's not as powerful as in PHPStorm. 它没有PHPStorm那么强大。 But it can detect function parameters and adds template lines for it. 但它可以检测功能参数并为其添加模板行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM