加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何为Swift iOS编程配置Uncrustify for Allman风格?

发布时间:2020-12-14 04:54:42 所属栏目:百科 来源:网络整理
导读:我正在尝试使用Allman Style获得可与 Swift配合使用的UncrustifyX配置.我在Xcode中使用BBUncrustifyPlugin.这是我到目前为止所拥有的: # indent using tabsinput_tab_size = 8output_tab_size = 4indent_columns = output_tab_sizeindent_with_tabs = 1# in
我正在尝试使用Allman Style获得可与 Swift配合使用的UncrustifyX配置.我在Xcode中使用BBUncrustifyPlugin.这是我到目前为止所拥有的:

# 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:

解决方法

首先我要说:我无法帮助你解决unrustify的问题.

但也许我可以为您提供另一种解决方案:您应该看看开源命令行工具swiftformat.除此之外,它也支持allman- aka东海岸风格.

https://github.com/nicklockwood/SwiftFormat

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读