格式化 Objective C 源文件

发布于 2024-12-25 22:52:42 字数 393 浏览 2 评论 0原文

可能的重复:
Objective-C 样式格式化程序

我对 Objective C 代码的格式非常挑剔。最近,我不得不处理相当多不是我编写的 Objective C 代码,我想根据我自己习惯的代码格式标准(例如 ANSI 括号样式、方法名称和第一个之间的间距)对其进行格式化。 。

当然,我知道我可以在 Perl 中组合一些东西来为我实现自动化,但我希望有一个工具可以为我完成这项工作。那么,有没有一些免费的工具可用 用于格式化 Objective C 文件?

Possible Duplicate:
Objective-C style formatter

I'm very picky about the formatting of my Objective C code. Lately I've been obliged to work with quite a bit of Objective C code that wasn't written by me, and I would like to format it according my own customary code formatting standards (e.g. ANSI bracket style, spacing between method name and first argument, etc, etc.

Of course, I know I can throw together something in Perl to automate this for me, but I was hoping there was a tool out there which could do the job for me. So, is there some free tool available for formatting Objective C files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

他不在意 2025-01-01 22:52:42

要快速但不完整地格式化(主要是缩进),请选择代码和 Control-I。这与通过粘贴代码获得的格式大致相同。

For quick but not complete formatting (mainly indenting) select the code and control-I. THis is about the same formatting as obtained by pasting code.

飘逸的'云 2025-01-01 22:52:42

好的,找到了 Uncrustify,它可以解决这个问题:

http://uncrustify.sourceforge.net/

和一个示例配置Objective C 文件位于:

http://blog.carbon Five.com/2009/08/07/code-formatting-in-xcode/

甚至还有一个 XCode 插件可用:

https://github.com/benoitsan/BBUncrustifyPlugin-Xcode

OK, found Uncrustify, which does the trick:

http://uncrustify.sourceforge.net/

And a sample config file for Objective C here:

http://blog.carbonfive.com/2009/08/07/code-formatting-in-xcode/

There's even an XCode plugin available:

https://github.com/benoitsan/BBUncrustifyPlugin-Xcode

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文