dotnet/roslyn

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

Open

#73.291 geöffnet am 1. Mai 2024

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (1 zugewiesene Person)C# (4.257 Forks)batch import
Area-IDEBugIntelliSense-Completionhelp wanted

Repository-Metriken

Stars
 (20.414 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)

Beschreibung

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

Contributor Guide