SpecFlow.VS icon indicating copy to clipboard operation
SpecFlow.VS copied to clipboard

Broken suggestion for generic step argument

Open qrjo opened this issue 2 years ago • 0 comments

Used Visual Studio

Visual Studio 2022

Are the latest Visual Studio updates installed?

Yes

SpecFlow Section in app.config or content of specflow.json

No response

Issue Description

When a step argument is of a (closed) generic type, the intellisense suggestion is useless/confusing. Very inconvenient, especially when the binding is in a nuget package meaning F12 can't be used to find out the actual type.

image image

I did a bit of digging in the code and it seems the error is in StepDefinitionSampler.cs, on line 57:

return typeName.Split('.').Last();

This code is just too simple to properly convert a type's FullName to a readable name.

Steps to Reproduce

Using the following binding:

[Binding]
public class TestBindings
{
    [Given("test (.*)")]
    public void Test(IEnumerable<int> value)
    {
    }
}

Type "Given test" in a feature file and check the intellisense suggestion. I used IEnumerable<int> as an example here, but we're using different custom generic types.

Link to Repository Project

No response

qrjo avatar Mar 20 '23 10:03 qrjo