cucumber / cucumber/vscode

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

Open
#130 7 comments 0 reactions 0 assignees View on GitHub
:zap: enhancement
Dominant language
TypeScript
Stars
88
Forks
33
PR merge metrics
No merged PRs in 30d

Description

### 🤔 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.