【问题标题】:How to configure Intellij idea code formatting to according my example如何根据我的示例配置 Intellij IDEA 代码格式
【发布时间】:2021-09-08 14:35:17
【问题描述】:

我的测试中有丰富的代码

public void createEntity(String jsonString) {   
    response = getBaseRequestWithCurrentCookie()
            .given().
                    body(jsonString).
                    contentType(ContentType.JSON)
            .when().
                    post()
            .then().
                    log().ifError().
                    extract().response();
}

但是如何配置 intellij Idea 代码样式(用于 Java)使其不对齐?

public void createEntity(String jsonString) {
    response = getBaseRequestWithCurrentCookie()
            .given().
            body(jsonString).
            contentType(ContentType.JSON)
            .when().
            post()
            .then().
            log().ifError().
            extract().response();
}

【问题讨论】:

  • 你想要第一种还是第二种格式?

标签: java intellij-idea coding-style rest-assured jgiven


【解决方案1】:
  1. 将构建器方法名称添加到设置(macOS 上的首选项)|编辑 |代码风格 |爪哇 |包装和大括号 |链式方法调用 | 构建器方法
  2. 启用设置(macOS 上的首选项)|编辑 |代码风格 |爪哇 |包装和大括号 |链式方法调用 | 保持构建器方法缩进选项:

【讨论】:

    猜你喜欢
    • 2012-12-10
    • 1970-01-01
    • 2018-03-16
    • 2013-11-10
    • 2014-04-20
    • 2023-03-09
    • 2018-02-19
    • 2016-07-25
    • 2013-07-26
    相关资源
    最近更新 更多