dotnet/roslyn

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

Open

#73.291 aperta il 1 mag 2024

Vedi su GitHub
 (1 commento) (0 reazioni) (1 assegnatario)C# (4257 fork)batch import
Area-IDEBugIntelliSense-Completionhelp wanted

Metriche repository

Star
 (20.414 star)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

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.

  • Other parameters don't produce this behavior (at least in this specific case), for example the parameter named request doesn't get numbered suggestions, only cancellationToken.
  • Suggestion token is not numbered either.
  • If I remove the name of the parameter cancellationToken, a reference remains in the body of the method. Even if I remove that reference, the issue remains present.
  • Recompilation doesn't resolve it.

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)?

Guida contributor