首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何配置Uncrustify for Allman style for Swift iOS编程?

如何配置Uncrustify for Allman style for Swift iOS编程?
EN

Stack Overflow用户
提问于 2015-12-22 01:01:05
回答 1查看 1.1K关注 0票数 6

我正在尝试获得一个UncrustifyX的配置,它将使用Allman风格与Swift一起工作。我在Xcode中使用BBUncrustifyPlugin。这是我到目前为止所知道的:

代码语言:javascript
复制
# 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

它的大部分花括号都是正确的,但会去掉感叹号和问号,并存在其他一些问题。我不确定我还能做些什么来让它正常工作。

我做了一个要点here

EN

回答 1

Stack Overflow用户

发布于 2017-06-15 19:05:01

首先,我得说:我不能帮你配置uncrustify。

但是也许我可以为您提供另一种解决方案:您应该看看开源命令行工具swiftformat。其中,it supports the allman- aka east-coast- style也是如此。

https://github.com/nicklockwood/SwiftFormat

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34400809

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档