SpecFlowOSS / SpecFlow.VS

The next version of the Visual Studio extension for SpecFlow
MIT License
36 stars 10 forks source link

Broken suggestion for generic step argument #129

Open qrjo opened 1 year ago

qrjo commented 1 year ago

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