Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to disable formatting of valid DOCSTRING placement #457

Open
KelseyDH opened this issue Dec 28, 2022 · 1 comment
Open

No way to disable formatting of valid DOCSTRING placement #457

KelseyDH opened this issue Dec 28, 2022 · 1 comment
Milestone

Comments

@KelseyDH
Copy link

KelseyDH commented Dec 28, 2022

Describe the bug
This plugin does not respect docstring placement.

To Reproduce
Steps to reproduce the behavior:

  1. Install the plugin with cucumberautocomplete.skipDocStringsFormat set to true.
  2. Create this Gherkin file w/ with plugin installed:
Feature:  Phrases
  Scenario: 500 years later, people started using chickens for sacred events, sometimes eating them.
    Given the text "500 years later, people started using chickens for sacred events, sometimes eating them."
    Then the api returns:
"""
    500 years later,
people
started
    using
        chickens
        for sacred events,
        sometimes eating
            them.
"""
  1. click save or otherwise trigger the plugin, and the text will format the DOCSTRING rightwards, breaking the test:
Feature:  Phrases
  Scenario: 500 years later, people started using chickens for sacred events, sometimes eating them.
    Given the text "500 years later, people started using chickens for sacred events, sometimes eating them."
    Then the api returns:
      """
    500 years later,
people
started
    using
        chickens
        for sacred events,
        sometimes eating
            them.
      """

Expected behavior
The Gherkin syntax spec clearly states that:

Indentation of the opening """ is unimportant, although common practice is two spaces in from the enclosing step. The indentation inside the triple quotes, however, is significant. Each line of the Doc String will be dedented according to the opening """. Indentation beyond the column of the opening """ will therefore be preserved.

In my case I cannot write functional tests with the VSCode plugin enabled, as it overrides my placement of DOCSTRINGSs fully dedented. The behaviour I want is for Gherkin highlighting to exist without it touching DOCSTRING placement at all. As our team copies and pastes from these indented texts often, we have a valid reason to want the DOCSTRING fully dedented and placed leftwards for each test. Per the syntax spec, this is valid Gherkin.

Cucumberautocomplete part of VSCode settings:

{
  "cucumberautocomplete.steps": [
      "features/step_definitions/*.js",
      "node_modules/@revjet/csp-qa/src/steps/*.js"
  ],
  "cucumberautocomplete.skipDocStringsFormat": true,
  "cucumberautocomplete.syncfeatures": "features/*.feature",
  "cucumberautocomplete.strictGherkinCompletion": true,
  "cucumberautocomplete.smartSnippets": true,
  "cucumberautocomplete.stepsInvariants": true,
  "cucumberautocomplete.onTypeFormat": false,
  "cucumberautocomplete.formatConfOverride": {
      "And": 0,
  }
}
@ymouhat
Copy link

ymouhat commented Apr 23, 2024

Hi @alexkrechik
I think have a similar issue
using the following step definition

the message containing text is 
           """
           message 1
           next message 2
              next message with indentation
           """

when I press save the doctstring removes the space at the begining

the message containing text is 
           """
           message 1
           next message 2
           next message with indentation
           """

is there a way to avoid this behavior, as it makes the step definition to fail.
THank you in advance

@alexkrechik alexkrechik added this to the 3.1.0 milestone May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants