dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.1k stars 4.04k forks source link

Even though there is no conflict, name suggestion completions are numbered in some cases. #73291

Open Peter-Juhasz opened 6 months ago

Peter-Juhasz commented 6 months ago

Version Used: 17.10.0 P6

Steps to Reproduce:

image

Unfortunately, I can't reproduce it in a pure console app, but the issue is present persistently in a mid-size project.

(The type in context is not partial, so there is no other identical method which may contain a parameter with the same name. It is not derived or implements an interface either.)

Diagnostic Id: N/A

Expected Behavior: Suggestions which have no naming conflict are not numbered.

Actual Behavior: Even though there would be no naming conflict, some name suggestions are numbered: cancellationToken1.

These observations may make it more likely a bug in the suggestion logic, rather than the completion request served by a previous version of the semantic model (where that parameter existed - especially in the case if I simply overtype the old name and get suggestions offered)?

Peter-Juhasz commented 6 months ago

A few other cases:

image

image

It is not easy to find the logic behind this bug, there are so many different cases with different results. :D