You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#language: de
Funktionalität: Calculator
@mytag
Szenario: Add two numbers
Angenommen the first number is 15
Und the second number is 70
Wenn the two numbers are added
Dann the result should be 120
Bindings:
[Given(@"the first number is (\d+)")]
public void GivenTheFirstNumberIs(int number)
{
}
[Given("the second number is (.*)")]
public void GivenTheSecondNumberIs(int number)
{
}
[When("the two numbers are added")]
public void WhenTheTwoNumbersAreAdded()
{
}
[Then("the result should be (.*)")]
public void ThenTheResultShouldBe(int result)
{
}
All the steps are marked as Unresolved but from SpecFlow point of view everything is working and the Scenario is green:
The text was updated successfully, but these errors were encountered:
currently we use the project language (specified in the specflow.json) to translate the keywords in the GetStepKind but we would need the "effective" language of the feature file
the GherkinLexer knows what is the actual language because it is handling the #language: magic comment but this information cannot be exposed easily from the lexer
the GherkinParser should be the place to get feature file language and and store this information somewhere in the AST (or it can already lookup the StepKind and store it on the GherkinStep element)
currently we use the project language (specified in the specflow.json) to translate the keywords in the GetStepKind but we would need the "effective" language of the feature file
We can check the comment at the top of the file while building SpecflowStepsUsagesCache. Then there is a refactor that need to be done anyway to stop depending on GetStepKind when building this cache since it's not optimized at all (few lines of of code run multiple time for nothing)
Then we can use this new cache in GetStepKind() to retrieve the lang.
Also it may be worth checking if we can cache the StepKind inside the GherkinStep (nullable field fill while building SpecflowStepsUsagesCache). I don't know if this can lead to some future bug, maybe ask this on the jetbrains channel
Since it's already highlighting the file as expected I don't know if there is need to change GherkinLexer / GherkinParser
After checking it seems that a new GherkinFile is created each time (I tough is was cached but I was confused with IPsiSourceFile, so we could set the language at the creation as you suggest in the GherkinParser in ParseFile()
Example feature file
Bindings:
All the steps are marked as Unresolved but from SpecFlow point of view everything is working and the Scenario is green:
The text was updated successfully, but these errors were encountered: