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

Choose whether to rename the class when renaming a file by default #43849

Open vsfeedback opened 4 years ago

vsfeedback commented 4 years ago

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


Now after renaming a file (e.g. Class1.cs) you get a dialog asking if you want to also rename the class (Class1):

---------------------------
Microsoft Visual Studio
---------------------------
You are renaming a file. Would you also like to perform a rename in this project of all references to the code element 'Class1'?
---------------------------
Yes   No   
---------------------------

I suggest a checkbox in that dialog along the lines of "Always perform this choice". If you check it and click Yes, the next time you rename a file it will automatically rename the class too. If you click No it won't ask again.


Original Comments

Visual Studio Feedback System on 4/21/2020, 00:57 AM:

Thank you for taking the time to provide your suggestion. We will do some preliminary checks to make sure we can proceed further. We'll provide an update once the issue has been triaged by the product team.

vesuvian commented 3 years ago

I landed here after selecting the "don't show again" checkbox and pressing "no". I expected this would turn off symbolic renaming, but instead it now does some really nasty symbol renaming whenever I rename a file.

When building an inheritance tree I'll regularly copy existing files, rename the new files, and then manually rename the types defined in the files. Every time I do this I get nagged. Since checking "do not show again" I am unable to use this workflow because renaming a file will rename the contents of the original as well.

The fix Go to Tools -> Options -> Project and Solutions -> General Check "Prompt for symbolic renaming when renaming files" if you want the popup back Uncheck "Enable symbolic renaming when renaming files" if you want to disable this behaviour altogether