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

Autocompletion should suggest patterns associated with the specified context/state only #130

Open
The-BDD-Coach opened this issue Dec 1, 2022 · 6 comments
Labels
⚡ enhancement Request for new functionality

Comments

@The-BDD-Coach
Copy link

🤔 What's the problem you're trying to solve?

When I type 'Given...', the autocompletion suggestions include 'When' and 'Then' statements; those aren't valid if the first word in the line is 'Given'. Similarly when I begin a 'When' or 'Then' statement, the autocompletion suggestions aren't filtered to include only 'When' or 'Then' steps; they include everything that appears to be a textual match.

Offering too many suggestions, including suggestions that aren't valid in the current context, clutters the UI and makes it more difficult for the user to find the suggestions that are actually useful. Novice users could also be misled into writing invalid Gherkin.

✨ What's your proposed solution?

Modify the autocompletion logic so that it:

  1. Maintains state - does this 'And' statement follow a 'Given', a 'When', or a 'Then'? (The first word in the line being 'Given', 'When', or 'Then' is the simplest case of this.)
  2. Sorts the autocompletion suggestions into three lists - Given, Whens, and Thens.
  3. Searches only the state-appropriate list for autocompletion suggestions.

@kieran-ryan kieran-ryan added the ⚡ enhancement Request for new functionality label Dec 3, 2023
@kieran-ryan kieran-ryan changed the title Feature Request: Autocompletion suggestions should be valid for the current context/state Autocompletion should only suggest patterns associated with the specified context/state Dec 29, 2023
@kieran-ryan kieran-ryan changed the title Autocompletion should only suggest patterns associated with the specified context/state Autocompletion should suggest patterns associated with the specified context/state only Dec 29, 2023
@jm-paulin
Copy link

jm-paulin commented Apr 8, 2024

It looks like the @Then @And annotation is not recognised as a valid step definition by the plugin, despite it being valid at execution time.

@The-BDD-Coach
Copy link
Author

@jm-paulin, step definitions not being recognized is a different issue; there is a lengthy discussion of it in #120. Kieran Ryan has listed some of the possible causes in a lengthy post there; some of those you can fix by changing your step definitions, but some you can't.

@kieran-ryan
Copy link
Sponsor Member

Thanks for raising @jm-paulin and cheers @The-BDD-Coach for pointing to some of the challenges - thankfully a small portion of these issues will be resolved in a coming release.

@jm-paulin, as this would be separate from @The-BDD-Coach's feature request, would you be able to raise a bug report on this project with as much detail as possible and a minimum reproducible example (e.g. step definition, feature file, path where files are stored, relevant VSCode settings, language, framework, etc.). Based on that we can determine where this issue belongs and whether a fix is required. However, language support issues typically relate to the Cucumber Language Service.

@jm-paulin
Copy link

I could create an issue @kieran-ryan but I think that would be a duplicate of #147, closed 4 months ago.

I personally think #147 is a valid issue. @And annotated steps definition should be handled/seen by the vscode plugin, Currently they are not and that is a bit of a rewrite when moving from IntelliJ to VSCode.

@The-BDD-Coach
Copy link
Author

The-BDD-Coach commented Apr 9, 2024

@jm-paulin @and steps are at least sometimes recognized; I am looking at one right now that is recognized. If you have an example of an @and step not being recognized when the underlying @given or @then is recognized, that is worth looking into. If it isn't being recognized and the reason isn't any of the ones that Kieran listed in #120 then it is certainly worth writing up as a separate issue.

If you write it up as a separate issue please show the complete source code of the step definition; as Kieran has mentioned, all of these issues are related to the language service, so the exact text of your step definition is critical.

@jm-paulin
Copy link

If you write it up as a separate issue please show the complete source code of the step definition; as Kieran has mentioned, all of these issues are related to the language service, so the exact text of your step definition is critical.

Created #225.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ enhancement Request for new functionality
Projects
None yet
Development

No branches or pull requests

3 participants