alexkrechik / VSCucumberAutoComplete

Cucumber (Gherkin) Full Support Extension for VSCode
https://marketplace.visualstudio.com/items?itemName=alexkrechik.cucumberautocomplete
MIT License
331 stars 79 forks source link

GraphQL Schema Definition Language (SDL) not formatted correctly. #410

Open AhmedBHameed opened 2 years ago

AhmedBHameed commented 2 years ago

Describe the bug Writing Graphql SDL (Schema Definition Language) is not formatted properly.

To Reproduce Writing simple string as SDL like the following and then format the document:

    When user call `listProducts` query with no collate
      """
      {
        listProducts {
          data {
            id
            name
            createdAt
          }
          extra{
            pagination{
              page
              size
            }
            total
          }
        }
      }
      """

Result of formatting is this:

    When user call `listProducts` query with no collate
      """
      {
        listProducts {
        data {
        id
        name
        createdAt
        }
        extra{
        pagination{
        page
        size
        }
        total
        }
        }
      }
      """

Expected behavior To be formatted properly like above.

Screenshots listProducts-formating

Cucumberautocomplete part of VSCode settings:

{
  "cucumberautocomplete.steps": ["src/features/**/*.ts"],
  "cucumberautocomplete.strictGherkinCompletion": true,
  "[feature]": {
    "editor.defaultFormatter": "alexkrechik.cucumberautocomplete"
  }
}

Step definition: If applicable, add example of step definition:

Feature: [IT] List products
  As a consumer of the Xentral GraphQL API
  I should be able to list products

  Scenario: List products successfully
    Given Apollo server is running with mocked response and access token
      | id | name             | createdAt                |
      | 1  | Digital products | 2021-08-09T09:45:16.696Z |
      | 2  | Shipping         | 2021-08-09T09:45:16.696Z |

    When user call `listProducts` query with no collate
      """
      {
        listProducts {
        data {
        id
        name
        createdAt
        }
        extra{
        pagination{
        page
        size
        }
        total
        }
        }
      }
      """

    Then no exception should be thrown
    Then no errors presented in response
    Then expects `listProducts` response to be match
      """
      {
        "data": {
          "listProducts": {
            "data": [
              {
                "id": "1",
                "name": "Digital products",
                "createdAt": "2021-08-09T09:45:16.696Z"
              },
              {
                "id": "2",
                "name": "Shipping",
                "createdAt": "2021-08-09T09:45:16.696Z"
              }
            ],
            "extra": {
              "pagination": null,
              "total": 2
            }
          }
        }
      }
      """