dotnet / dotnet/roslyn

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

Open
#73,291 1 comment 0 reactions 1 assignee Claimed by @genlu View on GitHub
Area-IDE Bug help wanted IntelliSense-Completion
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**: 17.10.0 P6

**Steps to Reproduce**:

![image](https://github.com/dotnet/roslyn/assets/9047283/f3c233d0-487a-46fc-8e90-ef64bc0eb278)

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.