dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.04k stars 4.03k forks source link

Request: CodeLens to break down setter/getter references of properties #22542

Open HaloFour opened 7 years ago

HaloFour commented 7 years ago

Currently the CodeLens adornment for a property will show all references of that property regardless of whether the getter or setter accessor methods are invoked. I'd like to see that broken down so that I can find references specifically for the setters so that I can identify what parts of a solution are mutating that property.

This could rendered through adornment of the setter/getter themselves, although that would add quite a bit of additional vertical clutter to a property and probably wouldn't show well with auto-implemented properties.

An alternative might be to have the adornment of the property show additional links inline to select the accessor references: 10 references, 8 get, 2 set | Smarmy McDeveloper | 1 author, 1 change

For readonly or writeonly properties the current adornment is perfectly sufficient.

ghost commented 7 years ago

I don't use CodeLens but consider this a parallel request for being able to do a "Find References" on just the setter of a property.

HaloFour commented 7 years ago

@AtsushiKan

Agreed, I am literally typing that one up right now. 😀

HaloFour commented 7 years ago

22543

If it's better to group them into one that would be fine. Either way I'd like to see better support for isolating the activity on the specific accessor methods of a property rather than treating the entire property as a single entity. It makes it a bit of a pain to identify such cases as when a very frequently read property might be written.