Roslyn: Move introduce local to the top of the list

Created on 22 Nov 2019  路  5Comments  路  Source: dotnet/roslyn

indroduce_local

I'm thinking discard should be rare.

Area-IDE Concept-Continuous Improvement IDE-CodeStyle Need Design Review

All 5 comments

I'm not sure i agree with htis. One is a squiggle and is "in your face", the other is a refactoring. I'ts not clear to me why I, as a user, would think that i would be doing a random refactoring versus fixing the thing that is directly showing up for me in the UI with squiggles.

In this case the random refactoring happens to fix the warning. It could be offered as an alternate fix. Reason I prefer it first is that as a long time r# user I'm used to typing the expression and have r# generate the declaration.

I agree, both of these provide a valid solution to the squiggle. Why is a discard more desirable than a named variable?

Maybe the value is that you won't introduce any other problems, like an unused reference.

Design Meeting Notes

We will investigate the telemetry of which option is chosen more _when both options are present in the lightbulb_, and make a decision based on that data.

Some food for thought: CodeRush has an option to their refactorings/code providers by frequency of use*; so over time the more frequently used ones are on top (even if they started towards the bottom).
So instead of just deciding on the ordering for an upcoming release of VS, just learn straight from the users behavior.

The only caveat would be that two equally likely options like the ones mentioned here (use discard vs. introduce local) might cause them to end up in a different order every other time if the user ends up picking the not-first one because it makes more sense in a given situation (but at least from my experience with CodeRush, this only affects a very small number of refactorings and may not matter at all for most users).

*) that is, aside from commands provided by VS itself (which appear in the order determined by VS). They always appear on top of ones provided by CodeRush (which appear in the order of most frequent use)

Was this page helpful?
0 / 5 - 0 ratings