alexkrechik / VSCucumberAutoComplete

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

Steps are not found if they contain literal regex-type characters #223

Closed mtkennerly closed 5 months ago

mtkennerly commented 5 years ago

Describe the bug Using Behave for Python, the default step definition matcher is non-regex, so you can define a step like @given("a ? is displayed") or @when("I pay $5"). The plugin (2.12.1) is unable to find these definitions. The plugin can find @given("a \? is displayed"), but Behave won't recognize that.

A boolean config option like cucumberautocomplete.stepDefinitionsUseRegex (true for current behavior) would be enough for most use cases, including mine. However, it's not foolproof. In Behave, it's possible to selectively use the default matcher, a regex matcher, or even define your own on a per-step basis (see here). I'm not sure how you could handle that without in-file configuration, like:

from behave import *

use_step_matcher("parse")  # default

@given("a ? is displayed")  # cucumberautocomplete: stepDefintionsUseRegex = false
def step_impl(context):
    pass

use_step_matcher("re")

@when(r"I enter (?P<value>\d+)")  # cucumberautocomplete: stepDefintionsUseRegex = true
def step_impl(context, value):
    pass

To Reproduce See the files below.

Expected behavior Steps with literal regex-type characters can be detected.

Screenshots image

Cucumberautocomplete part of VSCode settings:

{
    "cucumberautocomplete.steps": ["steps/*.py"],
    "cucumberautocomplete.strictGherkinCompletion": false
}

Step definition:

from behave import *

@given("a ? is displayed")
def step_impl(context):
    pass

Gherkin step line

Feature: Foo
  Scenario: A
    Given a ? is displayed  # <-- cannot find definition
Phenomite commented 4 years ago

The function finder is also case sensitive, but rip grave dig 2018.

alexkrechik commented 2 years ago

Should be fixed with "cucumberautocomplete.pureTextSteps": true option using after 2.16.0 release.

alexkrechik commented 5 months ago

This issue is to be fixed or implemented in the 3.0.0 version of the extension. If this issue is unresolved or there are additional notes, please create a new ticket with the necessary details.