roslyn: Request: Find All References broken down by use
This is a feature supported in Red Gate Reflector that I think would be very useful within Visual Studio.
I’d like to see Find References be able to differentiate between the use of the reference and allow either breaking down the references by their use or isolating a specific use type:
-
Properties by accessor method (get vs. set)
-
Fields, locals and parameters by whether they are used or assigned
-
Types by where they are instantiated (via instance constructor invocation), exposed (via non-private field, property or method parameter) or used
I am currently working on a project where many fields are exposed as protected
or as internal
and are frequently referenced directly by other types. I am trying to discern where those fields are being mutated and in quite a few cases Find All References is identifying over a 100 direct references of each of those fields, but scanning through the results I might identify only a couple assignments. Doing this manually is both tedious and very likely error prone.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 8
- Comments: 29 (25 by maintainers)
I believe the primary request here has been addressed by https://github.com/dotnet/roslyn/pull/30155.
New FAR column allows classification, sorting, filtering, etc. by reference kind (this will show up in Dev16 Preview2)
@HaloFour Does this meet your request?
@jnm2 is right. this should be one of:
it def should not be NameOnly 😃
@mavasani
That looks really nice and solves most of my use cases!
We have the information in our FindRefs API. It’s here: https://github.com/dotnet/roslyn/blob/d4dab355b96955aca5b4b0ebf6282575fad78ba8/src/Workspaces/Core/Portable/FindSymbols/ReferenceLocation.cs#L42
@jnm2 Want to just hook it up to the UI?
Fyi– I made it this far on 15.6 without ReSharper, but there’s no way I can finish the task I have at hand without going back to ReSharper. I have to look through 223 hits, the overwhelming majority of which are usages of the getter, while the tool window title is
'set_ThisProperty' references
.Edit: as it turns out, 222 of the hits were usages of the getter 😁
We have the data for this internally. It could be expose as a new column in the VS FAR window. You could hten use that column to ‘group by’, as you can with the other columns.