Yet*_*osh 12 formatting comments xcode4
我认为多行评论理想情况应该是这样的:
/* this is a mult-line comment, which wraps lines at some reasonable length,
* usually approximately 80 characters. this way, comments are easy to read
* and, with any half way capable text editor, easy to edit without having
* to manually reshuffle lines, line breaks, and the comment leader. */
// this is a mult-line comment, which wraps lines at some reasonable length,
// usually approximately 80 characters. this way, comments are easy to read
// and, with any half way capable text editor, easy to edit without having
// to manually reshuffle lines, line breaks, and the comment leader.
/* this is a mult-line comment, which wraps lines at some reasonable length,
usually approximately 80 characters. this way, comments are easy to read
and, with any half way capable text editor, easy to edit without having
to manually reshuffle lines, line breaks, and the comment leader. */
Run Code Online (Sandbox Code Playgroud)
但是,XCode不支持以此样式管理注释.您必须在正确的时间手动命中返回以适当的宽度包装注释,然后编辑它们将成为一个完整的PITA.
或者,你永远不会点击返回,让编辑器将它包装在编辑器屏幕的边缘.但如果你像我一样,你的编辑器比理想的自动换行长度宽得多.
此外,XCode通过提供在编辑器中以80个字符呈现包装指南的功能来嘲讽我,但这纯粹是一种视觉功能,没有任何机制来支持它.这就像把花园铲子交给曾经使用过反铲的人一样.
我是否需要在这里进行现实检查 - 我是否采用了错误的方式 - 或者XCode是否极其缺乏基本的段落式注释格式?
经验丰富,负责任,专业的Objective-C开发人员在代码中做出实质性评论时会做些什么?帮我看看这里的灯光.
注意:对于XCode 3,我编写了一个手动滚动的脚本,它重新格式化了文本并将其绑定到热键.我还没想到如何在XCode 4中做到这一点.但是如何编写XCode 4的脚本与这个问题有点正交:它有点不好用于扩展具有这些基础知识的IDE,我的问题是关于XCode开发人员的风格和文化期望.
谢谢你的建议.
alg*_*gal 14
我同意它应该内置于Xcode.但无论如何,这里是如何通过创建一个调用脚本并为其指定键盘快捷方式的服务项来快速将其添加到Xcode4:
fmt
实用程序重新格式化文本,允许行以句点开头,折叠行内的空格,允许缩进的段落,将行包装为80个字符的列.查看手册页以fmt
获取其他选项.显然,你可以通过emacs或markdown等来管理文本.现在,当您在Xcode中选择了文本时,您可以通过菜单栏选择服务将其重新格式化为80个字符:Xcode/Services/Reformat-to-80.
现在让我们为它指定一个键盘快捷键:
现在,在Xcode中,您可以使用该键盘快捷键将所选文本替换为shell脚本的输出,该脚本会将文本重新格式化为
归档时间: |
|
查看次数: |
3868 次 |
最近记录: |