【发布时间】:2011-09-08 19:00:10
【问题描述】:
我认为多行 cmets 理想情况下应该是这样的:
/* 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. */
但是,XCode 不支持以这种方式管理 cmets。您必须在正确的时间手动按回车键以适当的宽度包裹 cmets,然后编辑它们成为完整的 PITA。
或者,您永远不会按回车键并让编辑器将其包装在编辑器屏幕的边缘。但如果你像我一样,你的编辑器比理想的自动换行行长度要宽得多。
此外,XCode 通过提供一个在编辑器中以 80 个字符呈现包装指南的功能来嘲讽我,但这纯粹是一个视觉功能,没有任何机制来支持它。这感觉就像把一把花园铲子交给习惯使用反铲的人。
我是否需要在这里进行实际检查 - 我的想法是否错误 - 还是 XCode 极度缺乏基本的段落式注释格式?
经验丰富、负责任、专业的 Objective-C 开发人员在他们的代码中制作大量 cmets 时会做什么?帮我看看这里的光。
注意:对于 XCode 3,我编写了一个手卷脚本,它重新格式化文本并将其绑定到一个热键。我还没有弄清楚如何在 XCode 4 中做到这一点。但是如何编写 XCode 4 脚本与这个问题有点正交:必须用这些基础知识来扩充 IDE 听起来很糟糕,我的问题是关于 XCode 开发人员的风格和文化期望。
感谢您的建议。
【问题讨论】:
标签: xcode4 formatting comments