dotnet / dotnet/roslyn

'Insert arguments on Tab' should not consider captured primary constructor parameters

Open
#74,272 0 comments 0 reactions 0 assignees View on GitHub
Area-IDE Feature - Primary Constructors IntelliSense-Argument Completion
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**:
VS 17.10.3

**Steps to Reproduce**:
```cs
class MyClass(int i)
{
private readonly int _i = i;

void M()
{
N$$
}

void N(int a)
{
}
}
```
Make sure you have the feature enabled.
Press `Tab` at `$$` to insert arguments for method.

**Expected Behavior**:
`i` is ignored since it is a captured parameter, so I get `N(_i)`

**Actual Behavior**:
Inserted argument is `i`, so after applying the feature I immediately get a compiler warning about double storage

Contributor guide

Open the contributing guide

Research direction

The issue names no implementation file or test. Start by locating the C# “Insert arguments on Tab” feature and reproduce the primary-constructor example; done means Tab chooses `_i` rather than captured parameter `i` without the double-storage warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.