-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor "Move type to file" should re-evaluate file header template #74703
Comments
Closing out as by design. The file header is intentionally copied over. |
Hi Cyrus, when a template uses So intentional or not, it is causing a bug, so right now closing this without explanation WHY it is intentional to keep the wrong template is completely illogical and impossible to understand.
Please explain the reasoning behind this intention, i.e. what is the benefit of not re-evaluating (or offering a new opt-in setting to enable that)? |
Sorry, should be dupe of #58660 |
Thank you. |
This issue has been moved from a ticket on Developer Community.
[severity:It bothers me. A fix would be nice]
My editorconfig defines a file_header_template that includes the {filename} placeholder.
Consider a file
A.cs
that containsclass A
andclass B
. I want to move typeclass B
to its own file.Using the Quick actions and refactorings >
Move type to 'B.cs'
option,class B
is cut fromA.cs
and located in a new fileB.cs
that isn’t opened afterwards (which is good). Alongside cuttingclass B
, Visual Studio also copies all comments at the top ofA.cs
, which happens to be the file header.Since it copies those lines directly, the file header of
B.cs
will now claim to be for a file namedA.cs
. To fix that, I’ll need to manually openB.cs
anyway and hit “Save” once, to re-apply the file_header_template settings, which will fix the file name inB.cs
.Original Comments
Feedback Bot on 8/8/2024, 10:25 PM:
(private comment, text removed)
Wenwen Fan [MSFT] on 8/9/2024, 02:10 AM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: