如何为Swift iOS编程配置Allman风格的Uncrustify?
我正在尝试为UncrustifyX获得一个配置,该配置将使用Allman样式与Swift一起工作。我在Xcode中使用BBUncrustifyPlugin。以下是我目前掌握的情况:如何为Swift iOS编程配置Allman风格的Uncrustify?,ios,swift,uncrustify,Ios,Swift,Uncrustify,我正在尝试为UncrustifyX获得一个配置,该配置将使用Allman样式与Swift一起工作。我在Xcode中使用BBUncrustifyPlugin。以下是我目前掌握的情况: # indent using tabs input_tab_size = 8 output_tab_size = 4 indent_columns = output
# indent using tabs
input_tab_size = 8
output_tab_size = 4
indent_columns = output_tab_size
indent_with_tabs = 1
# indent case
indent_switch_case = indent_columns
indent_case_brace = 0
# indent class body
indent_class = True
# newlines
nl_after_semicolon = true
# spaces
# add in general
sp_before_sparen = add
# but remove for
sp_version_paren = remove
sp_catch_paren = remove
sp_scope_paren = remove
sp_func_call_user_paren = remove
# Allman style for curly braces
nl_assign_brace = add
nl_enum_brace = add
nl_union_brace = add
nl_struct_brace = add
nl_class_brace = add
nl_do_brace = add
nl_if_brace = add
nl_for_brace = add
nl_else_brace = add
nl_while_brace = add
nl_switch_brace = add
nl_fcall_brace = add
nl_fdef_brace = add
nl_brace_else = add
nl_brace_while = remove
nl_case_colon_brace = add
nl_after_brace_open = true
# one liners
nl_func_leave_one_liners = true
nl_enum_leave_one_liners = true
nl_create_if_one_liner = true
nl_create_for_one_liner = true
nl_create_while_one_liner = true
它大部分大括号都正确,但会将感叹号和问号分开,并存在一些其他问题。我不确定我还能做些什么使它正常工作
我提出了一个要点:首先,我必须说:我无法帮助您配置uncrustify 但也许我可以为您提供另一种解决方案:您应该看看开源命令行工具
swiftformat
。除此之外,它还支持allman-aka east coast风格
您好,您是否发现了更好的配置或改进了此配置?我正在为我们的团队寻找优秀的swift代码格式化程序,并发现了您的问题还没有,如果您发现了什么,我很感兴趣,请让我知道。我仍然在使用上面的方法。也许是一种选择,因为我没有得到uncrustify来与Swift保持一致。