Eclipse PDT 能否在需要的地方自动将 PHPDoc 块添加到代码中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/480963/
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-09-19 13:29:30  来源:igfitidea点击:

Can Eclipse PDT automatically add PHPDoc Blocks to code where needed?

phpeclipseeclipse-plugineclipse-pdt

提问by Kenzal Hunter

I know most of the java development tools for Eclipse will have a short-cut script for adding in JavaDoc blocks for needed elements (including the page-level).

我知道大多数用于 Eclipse 的 Java 开发工具都有一个快捷脚本,用于为所需元素(包括页面级别)添加 JavaDoc 块。

Further, I know that PDT will allow you to "Generate Element Comment" for many things through the Source menu.

此外,我知道 PDT 将允许您通过“源”菜单为许多内容“生成元素注释”。

Is there an Eclipse plug-in out there (or perhaps it exists standard in PDT and I've just missed it) that will allow you to add PHPDoc Blocks for all/some of the supported elements in a given file?

是否有一个 Eclipse 插件(或者它可能在 PDT 中存在标准而我刚刚错过了它)允许您为给定文件中的所有/某些支持的元素添加 PHPDoc 块?

回答by myselfhimself

place your text cursor right above your function, class or whatever, type /** and press enter and you'll have a beginning of PHPDoc written. Eg.

将文本光标放在函数、类或其他任何内容的正上方,键入 /** 并按 Enter,您将编写 PHPDoc 的开头。例如。

/**
 * 
 * Enter description here ...
 * @param unknown_type $book
 * @param unknown_type $product
 */

You can then write @inside the comments, and use @followed by ctrl+spaceto get auto-completion hints for PHPDoc tags.

然后,您可以@在注释中写入,并使用@后跟ctrl+space来获取 PHPDoc 标记的自动完成提示。

回答by Jake McGraw

In PDT 1.3:

在 PDT 1.3 中:

Window > Preferences > PHP > Editor > Typing > Automatically close > Phpdoc and comment regions (Check) > Add Phpdoc tags (check)

窗口 > 首选项 > PHP > 编辑器 > 打字 > 自动关闭 > Phpdoc 和注释区域(检查)> 添加 Phpdoc 标签(检查)

Also, modify your templates to include more Phpdoc: Preferences > PHP > Templates

此外,修改您的模板以包含更多 Phpdoc:首选项 > PHP > 模板