我想要:
BOol someLongVariablename = someLongValue | someOtherLongValue | moreLongValuesBOol someOtherLongVariablename = someEvenLongerValue;[someLongVariablename performSomeAction:someLongArgument]
我目前得到:
BOol someLongVariablename = someLongValue| someOtherLongValue| moreLongValuesBOol someOtherLongVariablename =someEvenLongerValue;[someLongVariablename performSomeAction:someLongArgument]
要明确:
>我使用显式换行而不是自动换行.
>我希望在编辑时和按下返回后立即进行正确的缩进,而不是在运行外部程序(如uncrustify)之后.
Xcode集成
为了让Xcode自动缩进代码,我创建了一个带有“Run Script”阶段的“Aggregate”目标:
find . -name '*.[mh]' -print0 \ | xargs -0 git diff-index head -- | grep -v "D\t" | cut -c100- \ | xargs uncrustify -l OC --replace --no-backup -c uncrustify.cfg
这对在git中标记为已更改的所有文件运行不明确.我已将我的应用目标添加为格式目标的依赖项,因此只有在编译成功时才会格式化. (重要的是,因为unrustify会因语法错误而混淆.)最后,我已经将格式目标添加到我的方案中,因此每个构建都会启动一种格式. Xcode通常会自行重新加载格式化文件.
我的uncrustify.cfg的相关设置是indent_continue = 4.
问题
当Xcode重新加载格式化文件时,撤消信息会丢失.我可以从git pre-commit钩子运行脚本,但我更喜欢更快的结果.
另一个缺点是Objectiverus C在uncrustify中的支持并不完美,但似乎没有其他选择. (有一天可能是clang-format?)
总结以上是内存溢出为你收集整理的缩进Xcode中的连续行全部内容,希望文章能够帮你解决缩进Xcode中的连续行所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)