我有一个代码块被自动格式化为:
.withStuff(ImmutableList.of(Stuff.builder().withName("Animaniacs").build(),
Stuff.builder().withName("Pinky and the Brain").build()))
.build());理想情况下,我想要自动格式化为:
.withStuff(ImmutableList.of(
Stuff.builder().withName("Animaniacs").build(),
Stuff.builder().withName("Pinky and the Brain").build()
))
.build());我怀疑我能否得到我真正想要的东西,似乎.editorcofig中的几个设置没有得到尊重:
ij_java_call_parameters_new_line_after_left_paren = true
ij_java_call_parameters_right_paren_on_new_line = true
ij_java_call_parameters_wrap = split_into_lines
ij_java_keep_line_breaks = true有人能建议怎么解决这个问题吗?
发布于 2022-08-09 08:02:10
如果在ImmutableList.of之前放置一个换行符,默认格式将提供如下内容:
.withStuff(
ImmutableList.of(
Stuff.builder().withName("Animaniacs").build(),
Stuff.builder().withName("Pinky and the Brain").build()
)
).build());这并不完全是你想要的,但它比你的第一个例子好得多,它像你想要的那样对齐彼此下面的列表项目。
https://stackoverflow.com/questions/68690508
复制相似问题