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.1k stars 4.04k forks source link

Order of quick actions changed #55401

Open vsfeedback opened 3 years ago

vsfeedback commented 3 years ago

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work] [regression] [worked-in:10.6.2] I just updated to VS 16.10.4 and now when I hit Ctrl + . for quick actions on a constructor the first item in the list is "Add null check" when it used to be the "Create and assign ..." options. This is really causing me issues because I'm used to years of the old order of things. Is this something that is configurable? I never use the "Add null check" option and use "Create and assign field ..." all the time and having to undo the null check and then arrow down to what used to be the first option is killing my productivity.


Original Comments

Feedback Bot on 8/2/2021, 08:30 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

CyrusNajmabadi commented 3 years ago

We should order these based on what telemetry shows is used more

CyrusNajmabadi commented 3 years ago

@jmarolf did you have this info?

jeffpapp commented 3 years ago

I reported this on the developer community site originally.

It seems like the quick actions is smart enough to know if you are using fields vs properties because once you pick create and assign field ... (which is by default second) once then every time after that it's the first option. Is there a way to detect if null checks are in use and then order based on that?

CyrusNajmabadi commented 3 years ago

Definitely something we can look into! Thanks!

jinujoseph commented 3 years ago

cc @mikadumont

jeffpapp commented 3 years ago

I see you added this to a 17.1 milestone. Is this change that happened in VS 16.10.4 something that can be rolled back while you look at the telemetry and figure out the best way to handle this in the next version of VS?

CyrusNajmabadi commented 3 years ago

It would be unlikely for this to be rolled back to the 16.x line. That would be reserved for majorly impactful critical issues hitting a lot of users.

jeffpapp commented 3 years ago

Was there a reason this was changed in 16.10.x? It seems backwards to make a change to how Visual Studio has worked for a long time in a patch update and then saying you can't address any issues from that change for 1 major version plus a minor version.

It would be unlikely for this to be rolled back to the 16.x line. That would be reserved for majorly impactful critical issues hitting a lot of users.

jmarolf commented 3 years ago

Was there a reason this was changed in 16.10.x?

Create and assign ... was added in a patch update in the past as was Add null check. The data we had suggested that most people were doing null checks versus creating types. I'll dig into the data and see if we can justify Create and assign ... being first by default. Sorry for the surprise here. Slightly off topic, but would you like it if this refactoring just had a dedicated button or keyboard shortcut to invoke it?

jeffpapp commented 3 years ago

Create and assign ... was added in a patch update in the past as was Add null check. The data we had suggested that most people were doing null checks versus creating types. I'll dig into the data and see if we can justify Create and assign ... being first by default. Sorry for the surprise here. Slightly off topic, but would you like it if this refactoring just had a dedicated button or keyboard shortcut to invoke it?

Yeah if there was a quick shortcut to create and assign a field/property that would be awesome. This change just really impacts me because I've built up a bunch of muscle memory on adding dependencies to a constructor and then hitting Ctrl + . to generate the read only field. In our case since we're a small team building internal apps so we just don't use null checks for constructor injected dependencies, but I could see where Add null check would make sense all the time for teams building libraries used by the public.

develorem commented 2 years ago

Is there a feature request to allow custom ordering, or perhaps use data about the current user's usage to determine the order? I hate when I go to 'Move Class to File xxx.cs" and instead it tries to generate a constructor for me. I'm never not going to user 'ctor' snippet to create my constructors.

johntony366 commented 2 years ago

I would also like to chime in and request for custom ordering for the "Quick Actions and Refactoring" menu. I face the same issue as @develorem; I want to be able to hit Ctrl + . and have "Move class to file className.cs" as the first option. It seems odd that no option to re-order this menu exists, since Visual Studio 2022 has options to re-order practically every other menu in the IDE.