【问题标题】:uncrustify: How do I set the maximum line lengthuncrustify:如何设置最大行长
【发布时间】:2019-02-26 07:03:50
【问题描述】:

运行 uncrustify 后,我希望行的长度不超过 80 个字符。如何在 uncrustify 配置文件中设置行的最大长度?

【问题讨论】:

    标签: code-formatting uncrustify


    【解决方案1】:

    将这样的部分添加到您的配置文件中。它不保证所有行都低于指定宽度。

    #
    # Line Splitting options
    #
    
    code_width            80            
    # Unsigned Number
    # Try to limit code width to N number of columns
    
    ls_for_split_full     True  
    # { False, True }
    # Whether to fully split long 'for' statements at semi-colons.
    
    ls_func_split_full    True
    # { False, True }
    # Whether to fully split long function protos/calls at commas.
    
    ls_code_width         True
    # { False, True }
    # Whether to split lines as close to code_width as possible and ignore some groupings.
    

    【讨论】:

    • "不保证所有行都低于指定宽度。"什么情况下不能达到这个限制?如果不能,它的行为是什么?另外,我假设拆分for 和函数只有在超过code_width 设置的限制时才会发生,对吧?如果不是,设置,他们什么都不做?另外,可以配置拆分它们的方式吗?我知道这取决于所坚持的风格。
    • 该警告来自 uncrustify 文档。当时(一年前),我找不到更多信息。我没有花太多时间阅读 unrustify 源代码。
    猜你喜欢
    • 2012-02-02
    • 2013-06-23
    • 1970-01-01
    • 2012-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多