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

Unable to parse definitions with the named capturing groups #462

Open marinaglancy opened 1 year ago

marinaglancy commented 1 year ago

Describe the bug I tried to use this extension on Moodle features. Moodle uses named capturing groups in the majority of step definitions.

To Reproduce Steps to reproduce the behavior:

  1. Clone Moodle and open in vscode https://github.com/moodle/moodle
  2. Configure "cucumberautocomplete.steps": ["**/behat_*.php"]
  3. Open any .feature file
  4. You will see a lot of steps highlighted as errors "Was unable to find step ..."

Screenshots cucumber2

Cucumberautocomplete part of VSCode settings:

{
  "cucumberautocomplete.steps": [
      "**/behat_*.php"
  ],
}

Step definition: Here is an example of the step definition that can not be processed https://github.com/moodle/moodle/blob/master/auth/tests/behat/behat_auth.php#L44

@Given /^I log in as "(?P<username_string>(?:[^"]|\\")*)"$/

If I remove the named capturing group, the extension can parse it:

@Given /^I log in as "(?:[^"]|\\")*"$/

This is not the only problem with parsing steps in Moodle, I noticed that some other steps are also reported as missing. Also often "Go to definition" brings to a random place in behat definitions files. But I think this error is the most prominent one