cucumber / cucumber/language-server
Find references from a step definition to the Gherkin steps using it
- Dominant language
- TypeScript
- Stars
- 56
- Forks
- 35
- Avg merge
- 6h 26m
- Merged PRs (30d)
- 1
Description
Go-to-definition works from a Gherkin step to its step definition, but not the other way round: from a step definition there is no way to list the `.feature` steps that use it. The server does not advertise `referencesProvider`, and `reindex()` keeps only the step texts, not their locations.
Everything needed is already in the index. `expressionLinks` map each expression to its location in the glue file, and the Gherkin sources are loaded during reindexing. A `textDocument/references` handler is: find the expression links whose `targetRange` contains the request position, then match every Gherkin step against them.
The same lookup would give cucumber/vscode#160 (highlight unused step definitions) its answer: a step definition with an empty reference list is unused. Not part of this, but it stops being hard once references exist.
I have this implemented with tests and can open a PR.
Contributor guide
Research direction
Start at reindex() and inspect how expressionLinks retain targetRange locations while Gherkin sources are loaded. Follow the textDocument/references entry point: resolve the expression at the request position, match the Gherkin steps against it, and use the existing tests mentioned in the issue to verify returned locations and empty results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100