我正在搜索一个插件,可以在XCode中自动设置objective-c代码的格式,如果有一组可选的样式设置格式也会非常有用,
I'm aiming to follow Google's code convention: http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml as a start, any help is appreciated.
我正在搜索一个插件,可以在XCode中自动设置objective-c代码的格式,如果有一组可选的样式设置格式也会非常有用,
I'm aiming to follow Google's code convention: http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml as a start, any help is appreciated.
updated April 2013
正如罗杰·诺兰(Roger Nolan)和rcw3(rcw3)所建议的,你可以用Uncrustify更进一步.最新发布版本可下载here.
与Xcode的集成取决于安装的Xcode版本.
该插件提供了从Xcode的"编辑"菜单("取消选定文件的 rust 蚀"、"取消激活文件的 rust 蚀"和"取消选定行的 rust 蚀")访问"取消 rust 蚀"的权限.只需构建项目,就可以编译并安装插件.
截至2013年4月2日,该插件包含Uncrustify 0.60和Uncrustify配置文件.要使用自定义解锁配置文件,请确保阅读标题为"如何自定义解锁配置"的部分README.md个.
Note: To use Uncrustify from the command line, for example as part of a git hook, I recommend building and installing 100 independently. For consistency sake, I also recommend replacing the version of Uncrustify that comes with the plugin with a link to the version Uncrustify that was independently built and installed. The following is how to do that:
cd ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin/Contents/Resources
mv uncrustify uncrustify.orig
ln -s /usr/local/bin/uncrustify uncrustify
乔纳·威廉姆斯Code Formatting in Xcode 4
乔纳·威廉姆斯Code Formatting in Xcode
我用于Objective-C的Uncrustify 0.60配置文件位于here.
要为新版本的Uncrustify更新Uncrustify配置文件,请启动终端并键入:
mv uncrustify.cfg uncrustify.cfg.old
uncrustify -c uncrustify.cfg.old --update-config > uncrustify.cfg
要查看对"解锁"配置所做的更改,请在终端类型中:
diff uncrustify.cfg.old uncrustify.cfg
要查看文件化版本的解锁配置文件,请启动终端并键入:
uncrustify -c uncrustify.cfg --show-config