clang 格式换行符在错误的位置

2024-05-14

给出以下代码行:

get_abc_manager().get_platform_status(abc_platform_status, sw_update_status, fill_update_status, actions_allowed_status);

我希望 clang 格式打破参数上的界限,例如 - 这是它在大多数地方所做的事情(对于基本函数调用)

get_abc_manager().get_platform_status(
    abc_platform_status, 
    sw_update_status, 
    fill_update_status, 
    actions_allowed_status);

但是,我想,因为它有“。”访问返回的 abc_managers 函数get_platform_status()它似乎用它作为中断线,所以我得到:

get_abc_manager().
    get_platform_status(abc_platform_status, sw_update_status, fill_update_status, actions_allowed_status);

行长度限制为 120 - 因此如果参数变得更长,那么它可能会超出参数。事实上,我尝试过:

get_abc_manager().get_platform_status(
    abc_platform_status,
    sw_update_stadddddddddddddddddddddddddtus,
    fill_update_status,
    actions_allowed_status);

所以这只是这种“中间”情况,我不喜欢它在破坏参数列表之前通过在点后断开来缩短行。

有没有办法先打破参数的界限?

update:clang格式版本10.0.0-4ubuntu1~18.04.2

---
Language:        Cpp
# BasedOnStyle:  WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands:   false
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
# Don't allow function on one line, e.g. 'int f() {return 1;}' - unless its inline
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
  AfterCaseLabel:  true
  AfterClass:      true
  AfterControlStatement: true
  AfterEnum:       true
  AfterFunction:   true
  AfterNamespace:  true
  AfterObjCDeclaration: true
  AfterStruct:     true
  AfterUnion:      true
  AfterExternBlock: true
  BeforeCatch:     true
  BeforeElse:      true
  IndentBraces:    true
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true
# have line breaks after operators: 'if (a ||' instead of on the next line ' || b'
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
# effectively the line length limit before clang-format starts to use multiple lines
ColumnLimit:     120
CommentPragmas:  '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
# format braces lists (uniform init) like a function param list
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat:   false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
  - foreach
  - Q_FOREACH
  - BOOST_FOREACH
IncludeBlocks:   Preserve
IncludeCategories:
  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
Priority:        2
SortPriority:    0
  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
Priority:        3
SortPriority:    0
  - Regex:           '.*'
Priority:        1
SortPriority:    0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth:     4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd:   ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
# 'int *p' instead of 'int* p;'
PointerAlignment: Right
ReflowComments:  true
SortIncludes:    true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles:  false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard:        Latest
StatementMacros:
  - Q_UNUSED
  - QT_REQUIRE_VERSION
TabWidth:        8
UseCRLF:         false
UseTab:          Never
...

None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

clang 格式换行符在错误的位置 的相关文章

随机推荐

  • 为 Presto 和 AWS S3 设置独立 Hive Metastore 服务

    我工作的环境中使用 S3 服务作为数据湖 但没有 AWS Athena 我正在尝试设置 Presto 以便能够查询 S3 中的数据 并且我知道我需要通过 Hive Metastore 服务将数据结构定义为 Hive 表 我正在 Docker
  • Slick和bonecp:org.postgresql.util.PSQLException:FATAL:抱歉,太多客户端已经错误

    当我在本地开发应用程序时 我使用以下命令启动我的 play2 应用程序sbt run 我喜欢如何更改代码 然后重新加载浏览器以查看我的更改 在大约 10 次代码更改之后 我收到 postgresql 太多连接错误 见下文 我的数据库连接使用
  • 使用 Proguard 通过 Dropbox.com 库混淆 Android 应用程序

    我刚刚创建了一个需要 Dropbox com API 库的 Android 应用程序 我现在尝试在 发布 模式下构建应用程序 并希望在代码上运行混淆器以对其进行混淆 但是 每当我尝试运行 Proguard 时 都会收到以下错误 Progua
  • Spark DataFrame 序列化为无效 json

    TL DR 当我倾倒 Spark 时DataFrame作为 json 我总是得到类似的结果 key1 v11 key2 v21 key1 v12 key2 v22 key1 v13 key2 v23 这是无效的 json 我可以手动编辑转储
  • Dynamics CRM 2013:审核日志有“空白”记录

    On a custom entity I enabled a single field for auditing which seems to be working fine But there are many many more aud
  • 如何在SSRS VS2008中为多个数据集应用父组

    我已经与这个问题斗争了好几天 但没有成功 我需要实现一种非常棘手的报告格式 但最主要的是所有数据集都需要按 1 个父级进行分组 我将尝试解释 假设我们有数据集1 数据集2 两者都有 AccountNumber 作为公共字段 父级 我需要在报
  • 如何忽略 Brackets 的 CSSLint 扩展输出的特定警告

    我正在使用 CSSLint 扩展Brackets http brackets io 有没有办法禁用特定警告 例如box model and bulletproof font face 我找到的最适合讨论的匹配是here https stac
  • ASCII“../”是 PHP 中指示目录遍历的唯一字节序列吗?

    我有一个 PHP 应用程序 它使用 GET参数来选择文件系统上的 JS CSS 文件 如果我拒绝输入字符串包含的所有请求 或者可见 7 位 ASCII 范围之外的字节 当路径传递到 PHP 的底层 基于 C 文件函数时 这是否足以防止父目录
  • jQuery UI 可排序和对话

    是否可以在两个列表之间拖动 jQuery UI 可排序列表项 其中一个在 jQuery UI 对话框中 另一个不在 jQuery UI 对话框中 我正在尝试创建一个对话框 用户可以将表单字段从对话框中拖到页面上的表单中 但我无法将项目拖出对
  • IE8 中空 div 层的 z-index 问题

    我在 IE8 中遇到 z index 问题 其他尚未测试 以下 JS 创建一些 html css document write img src border 0 document write div style background col
  • MongoDB - 打开和关闭连接 - 建议良好实践

    我通过 Node js 的驱动程序使用 MongoDB 我通常打开一个连接 通过connect 方法 任何时候我需要执行操作并关闭它 通过close 方法 一旦我完成 在我的程序中 我自然需要对 MongoDB 执行许多操作 因此我会多次打
  • 如何避免 TypeScript 中出现虚假的“未使用参数”警告

    我遇到过很多次这种情况 最后决定弄清楚正确的方法是什么 如果我有一个声明方法的抽象父类 然后一些具体子类在其实现中实现真正的逻辑 并且显然使用方法参数 但某些子类不需要在该方法中执行任何操作 因此不要使用方法参数 那些不必执行任何操作的方法
  • Ruby 中多维数组的帮助

    我有以下代码将字符串拆分为 3 个字节的组 str hello ix 0 iy 0 bytes tby str each byte do c if iy 3 iy 0 bytes ix tby each index do i bytes i
  • ApplicationController 的未定义方法“helper_method”,Rails 5

    我正在尝试使用doorkeeper 将oAuth2 0 集成到我的仅rails api 应用程序中 但我不断收到此错误 ApplicationController 的未定义方法 helper method 但无法找到解决该问题的明确解决方案
  • MVC和依赖注入,被迫使用单例Controller?

    我正在致力于构建一个根据 MVC 原则运行并利用依赖注入的 PHP 框架 我想我已经把前端控制器部分放下了 有一个工作路由器实例化控制器实例并根据请求的 URI 调用适当的操作 接下来是依赖注入 我想实现一个使用反射解决依赖关系的容器 这样
  • 增加 MS Teams 通道自适应卡的宽度

    我有一张带有 4 个按钮的自适应卡 但问题是我的第四个按钮转到了下一行 我想将所有按钮放在一行中 那么有什么方法可以增加自适应卡的宽度以将按钮对齐成一行 我正在使用机器人框架 v3 C 将以下属性添加到自适应卡以设置使用整个窗口的宽度 sc
  • 如何在iphone APP中下载facebook和Picasso的图片

    任何人告诉我有关 iphone 中从 facebook 和 picassa 下载图像的功能 我正在其中制作应用程序 我想制作通过我的应用程序从 picassa 和 facebook 下载选定图像的功能 那么我必须做什么 谢谢 查看NSURL
  • 数据库中的持久日期不等于检索日期

    我有一个具有 Date 属性的简单实体类 此属性对应于 MySQL 日期时间列 Entity public class Entity Column name start date Temporal TemporalType TIMESTAM
  • 预测测试图像时出现错误 - 无法重塑大小数组

    我正在尝试使用 TensorFlow 和 Keras 在 Python 中进行图像识别 并且我已经关注了下面的博客 https stackabuse com image recognition in python with tensorfl
  • clang 格式换行符在错误的位置

    给出以下代码行 get abc manager get platform status abc platform status sw update status fill update status actions allowed stat