alexkrechik / VSCucumberAutoComplete

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

Python | Behave | Cucumberautocomplete.customParameters | Regex "(?P<random_value>.+)" isn't working #411

Open mjaramillob0613 opened 2 years ago

mjaramillob0613 commented 2 years ago

Describe the bug Given I use a regex When using Cucumberautocomplete.customParameters Then the regex isn't recognized And when navigating over a Step with parameters, the Step definition is not found.

To Reproduce I have this step defined: @step('I add parking to cart in "(?P\<store>.+)"')

When using: "cucumberautocomplete.customParameters": [ { "parameter":"(?P\<store>.+)", "value":"([^\"]*)" } ] The single step that uses that specific parameter allows me to navigate to the step.

But, when using: "cucumberautocomplete.customParameters": [ { "parameter":"(\?P\<store>.+)(\?P\<store>.+)", "value":"([^\"])" } ] "cucumberautocomplete.customParameters": [ { "parameter":\/\(\?P\<\w+>\.\+\)\/, "value":"([^\"])" } ] The step does not appear. I need this for a huge project and I need to use the Regex option.

Expected behavior The regex should work

Cucumberautocomplete part of VSCode settings: "cucumberautocomplete.strictGherkinCompletion": false, "cucumberautocomplete.stepsInvariants": false, "cucumberautocomplete.gherkinDefinitionPart": "(Given|When|Then|Step)"

mjaramillob0613 commented 2 years ago

@alexkrechik Can you please help me 😢

Juanap12 commented 2 years ago

I'm having the same issue!

alexkrechik commented 2 years ago

@mjaramillob0613 could you please provide a feature line example? Not sure that I properly understand the issue. looks like that "parameter":"(?P<store>.+)", should be used for the @step('I add parking to cart in "(?P<store>.+)"') step.

mjaramillob0613 commented 2 years ago

@alexkrechik Feature line example: When I add parking to cart in "dinning_store"

Step definition: @when('I add parking to cart in "(?P.+)"') @step('I add tickets to cart in "(?P.+)"')

As you can see "dinning_store" (The parameter) we are receiving it as "(?P.+)" in the step definition. The redirection is not working for me because as far as I saw the extension works with parameters defined as "([^\"]*)". So, I tried using cucumberautocomplete.customParameters, but is not working for me when I try to use it with a Regex. It does work when I use a specific parameter, for example:

"cucumberautocomplete.customParameters": [ { "parameter":"(?P.+)", "value":"([^\"]*)" } ]

But I need to use the regex because all my framework parameters are established like that, so that's why I was trying with the following regex:

"cucumberautocomplete.customParameters": [ { "parameter":/(\?P<\w+>.+)/, "value":"([^\"])" } ]

But the redirection does not work for me.

mjaramillob0613 commented 2 years ago

Please ? @alexkrechik