dotnet/roslyn

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

Open

#73,291 创建于 2024年5月1日

在 GitHub 查看
 (1 评论) (0 反应) (1 负责人)C# (4,257 fork)batch import
Area-IDEBugIntelliSense-Completionhelp wanted

仓库指标

Star
 (20,414 star)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

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

贡献者指南