roslynator icon indicating copy to clipboard operation
roslynator copied to clipboard

Add --ignore-constructors switch to find-symbol command

Open mykhailopylyp opened this issue 9 months ago • 1 comments

Adding a --ignore-constructors option to the find-symbol command would be very useful. I'm currently removing unused code, but because dependency injection hides explicit constructor references, nearly all of my constructors are being removed.

Do you know any way around it without modifying code or adding skip attributes to each constructor?

In the meantime, I managed to clone the codebase and apply the needed change.

mykhailopylyp avatar Feb 05 '25 18:02 mykhailopylyp

Hi,

There's a parameter --symbol-kind (https://josefpihrt.github.io/docs/roslynator/cli/commands/find-symbol/#--symbol-kind) which acceppts space-separated list of symbols to include. constructor could be added as one of the value and then there could be a new parameter --ignored-symbol-kind with similar functionality as --symbol-kind but it would exclude specified symbol kinds.

Usage:

roslynator find-symbol --ignore-symbol-kind constructor

josefpihrt avatar Feb 08 '25 08:02 josefpihrt