cucumber / cucumber/language-service

Unrecognised tokens in step definition in php (Behat) files

Open
#223 7 comments 1 reaction 0 assignees View on GitHub
:bug: bug
Dominant language
TypeScript
Stars
29
Forks
44
PR merge metrics
No merged PRs in 30d

Description

### 👓 What did you see?

LSP don't recognize context having token defined. This is a scenario I have:

```gherkin
Scenario: User is an committee member
Given user is an committee
And I authenticate
Then I get redirected to "/committee" ■ Undefined step: I get redirected to "/committee"
```

And here the related contexts:

```php
/**
* @Given user is an committee
*/
public function userIsAnCommittee()
{
throw new PendingException();
}
/**
* @Given I authenticate
*/
public function iAuthenticate()
{
throw new PendingException();
}
/**
* @Then I get redirected to :arg1
*/
public function iGetRedirectedTo($arg1)
{
throw new PendingException();
}
```

### ✅ What did you expect to see?

The first two contexts are recognised by the lsp and I can jump to their definition, but not the third one. I tried without the surrounding double quotes but it has the same effect.

### 📦 Which tool/library version are you using?

Cucumber Language Server 1.6.0

### 🔬 How could we reproduce it?

_No response_

### 📚 Any additional context?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the example with Cucumber Language Server 1.6.0, using the shown Gherkin scenario and PHP step definitions. Trace how the parameterized @Then definition is matched and navigated; done means the step is no longer reported as undefined and jump-to-definition works like it does for the first two steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, typescript
Domain
devtools, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.