簡體   English   中英

獲取 clang 格式以將多行函數調用的右括號放在單獨的行上?

[英]Get clang format to put closing parenthesis of multiline function calls on separate lines?

我一直在使用 clang 格式來幫助保持我的代碼干凈。 對於多行函數調用,有沒有辦法讓鏗鏘聲將右括號放在它自己的行上?

例子:

它現在在做什么:

increment_and_call_on_match(
    clique_colors,
    0,
    max_clique_color,
    [&](int clique_color) { 
        comms.emplace_back(context.split_by_color(clique_color)); 
    },
    [&](int) { context.split_by_color(); });

我想要的是:

increment_and_call_on_match(
    clique_colors,
    0,
    max_clique_color,
    [&](int clique_color) { 
        comms.emplace_back(context.split_by_color(clique_color)); 
    },
    [&](int) { context.split_by_color(); }
); //Closing paren on new line

一個新選項AlignAfterOpenBracket: BlockIndent於 2022 年 1 月 17 日在已批准的代碼審查https://reviews.llvm.org/D109557中添加,該選項位於LLVM 14.0.0-rc1或更高版本中。

(我也想要這個,因為我們有數千行使用這種風格的代碼,支持這種風格的 clang 格式會讓我在 Visual Studio 中采用 clang 格式 - https://developercommunity.visualstudio.com/content/problem/ 232465/clang-format-messes-with-close-parentheses-in-fu.html )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM