是否可以将clang格式配置为使用箭头和大括号将Java lambda参数保持在一行上?
我的是否可以将clang格式配置为使用箭头和大括号将Java lambda参数保持在一行上?,java,clang-format,Java,Clang Format,我的clangformat样式文件如下所示: BasedOnStyle: Google --- Language: Java ColumnLimit: 100 BreakStringLiterals: true BreakAfterJavaFieldAnnotations: false BraceWrapping: AfterCaseLabel: true AfterClass: true AfterControlStatement: true AfterEnum:
clangformat
样式文件如下所示:
BasedOnStyle: Google
---
Language: Java
ColumnLimit: 100
BreakStringLiterals: true
BreakAfterJavaFieldAnnotations: 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: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
考虑以下输入java代码:
public class Lambda {
void handle() {
// TODO Try a compiling example next to see if it's different with clang-format.
try {
updateTranscriptResponse = Utils.doWithRetry(
/* task */
() -> {
System.out.println("This is a bit long-winded sentence so it keeps going on and on.");
System.out.println("This is a bit long-winded sentence so it keeps going on and on.");
},
/* task 2 */
() -> {
System.out.println("This is a bit long-winded sentence so it keeps going on and on and on and on and on.");
System.out.println("This is a bit long-winded sentence so it keeps going on and on.");
},
/* task 3 */
() -> {
System.out.println("This is a bit long-winded sentence so it keeps going on and on and on and on and on.");
System.out.println("This is a bit long-winded sentence so it keeps going on and on.");
}
);
} catch (Exception e) {
}
}
}
我试图使用clangformat
缩进lambda的主体,但将()->{
保留在一行上。不幸的是,它给出了以下输出:
public class Lambda {
void handle() {
// TODO Try a compiling example next to see if it's different with clang-format.
try {
updateTranscriptResponse = Utils.doWithRetry(
/* task */
()
-> {
System.out.println("This is a bit long-winded sentence so it keeps going on and on.");
System.out.println("This is a bit long-winded sentence so it keeps going on and on.");
},
/* task 2 */
()
-> {
System.out.println(
"This is a bit long-winded sentence so it keeps going on and on and on and on and on.");
System.out.println("This is a bit long-winded sentence so it keeps going on and on.");
},
/* task 3 */
() -> {
System.out.println(
"This is a bit long-winded sentence so it keeps going on and on and on and on and on.");
System.out.println("This is a bit long-winded sentence so it keeps going on and on.");
});
} catch (Exception e) {
}
}
}
我如何配置clangformat
以避免在任务1和任务2引入额外的换行符
我正在运行叮当格式9