可以在Objective-C方法调用中使结壳对齐吗? [英] Can Uncrustify align colons in Objective-C method calls?
问题描述
我正在使用取消信任 0.52.当我对Objective-C文件运行它时,它想转换这样的方法调用:
I am using uncrustify 0.52. When I run it against Objective-C files, it wants to convert method invocations like this:
[NSApp beginSheet:startTimerDialog
modalForWindow:nil
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
对此:
[NSApp beginSheet:startTimerDialog
modalForWindow:nil
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
我更喜欢第一个版本,冒号对齐. uncrustify配置文件中是否有一个选项可以支持我想要的内容,或者uncrustify只是不支持对齐的冒号?
I prefer the first version, with the colons aligned. Is there an option in the uncrustify config file that can support what I want, or does uncrustify just not support aligned colons?
如果unrustify无法对齐结肠,是否有办法防止它使我自己对齐的结肠偏离对齐?
If uncrustify can't align the colons, is there a way to prevent it from de-aligning the colons that I've aligned myself?
更新:
mmc 指出,此功能自版本1581起在Uncrustify svn存储库中可用.在unrustify 0.54中.在配置文件中设置align_oc_msg_colon = true
启用它.
mmc notes that this feature was available in the Uncrustify svn repository as of build 1581. It is in uncrustify 0.54. Set align_oc_msg_colon = true
in your config file to enable it.
进一步更新
对于以后会找到此答案的人:
.cfg文件中的首选项名称已更改.现在,可以使用align_oc_msg_colon_span= 1
来获得上述行为.现在还有一个align_oc_decl_colon = true
,它将为多行声明做名称操作.
For people who find this answer in the future:
The name of the preference in the .cfg file has been changed. It is now align_oc_msg_colon_span= 1
to get the behavior described above. There is also now a align_oc_decl_colon = true
that will do the name thing for multi-line declarations.
推荐答案
昨晚我玩了一段时间,(尽管我认为这不应该得到赏金),您对这两个问题的答案都是不,当前版本(.53)的Uncrustify不会这样做."
I played around with this for some time last night, and (although I don't think that this deserves the bounty) the answer to both your questions is "no, current versions (.53) of Uncrustify do not do this."
我什至研究了写补丁来做到这一点(因为我也很想要),并且在查看了Uncrustify的源代码之后,得出的结论是,比我有更多的时间来确定在何处插入补丁.完成多行消息参数冒号对齐"而不是多行消息左对齐"似乎在最近的补丁中对Objective-C的解析进行了一些改进.
I even investigated writing a patch to do exactly this (because I really want it, too) and after looking at the Uncrustify source, and concluded it would take far more time than I had available to figure out where to insert the patch to accomplish "multi-line message parameter colon alignment" rather than "multi-line message left alignment" It does seem that there has been some improvements to Objective-C parsing in recent patches.
我真希望有人能回答这个问题.我也真的很想知道.
I was so hoping someone would answer this question. I really wanted to know, too.
注意:对于以后会找到此答案的人: .cfg文件中的首选项名称已更改.现在,它是align_oc_msg_colon_span = 1才能获得上述行为.现在还有一个align_oc_decl_colon,它将为多行声明起名字的作用.
NOTE: For people who find this answer in the future: The name of the preference in the .cfg file has been changed. It is now align_oc_msg_colon_span = 1 to get the behavior described above. There is also now a align_oc_decl_colon that will do the name thing for multi-line declarations.
这篇关于可以在Objective-C方法调用中使结壳对齐吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!