Skip to content
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

Closed
vsfeedback opened this issue Aug 9, 2024 · 4 comments · Fixed by #76270
Closed

Refactor "Move type to file" should re-evaluate file header template #74703

vsfeedback opened this issue Aug 9, 2024 · 4 comments · Fixed by #76270
Assignees
Labels

Comments

@vsfeedback
Copy link

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 contains class A and class B. I want to move type class B to its own file.

Using the Quick actions and refactorings > Move type to 'B.cs' option, class B is cut from A.cs and located in a new file B.cs that isn’t opened afterwards (which is good). Alongside cutting class B, Visual Studio also copies all comments at the top of A.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 named A.cs. To fix that, I’ll need to manually open B.cs anyway and hit “Save” once, to re-apply the file_header_template settings, which will fix the file name in B.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)

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 9, 2024
@Cosifne Cosifne self-assigned this Aug 12, 2024
@Cosifne Cosifne removed the untriaged Issues and PRs which have not yet been triaged by a lead label Aug 12, 2024
@CyrusNajmabadi
Copy link
Member

Closing out as by design. The file header is intentionally copied over.

@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2024
@LWChris
Copy link

LWChris commented Dec 4, 2024

Hi Cyrus,

when a template uses {filename}, copying the header over unchanged is guaranteed to be wrong. That's why I filed this bug report, to notify you of a case where your current behavior causes a problem (which requires three additional manual steps to mitigate).

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.

  1. You do <X>.
  2. A bug report is filed "Doing <X> is causing a problem."
  3. The report is closed only saying "We intentionally do <X>."

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)?

@CyrusNajmabadi CyrusNajmabadi reopened this Dec 4, 2024
@CyrusNajmabadi
Copy link
Member

Sorry, should be dupe of #58660

@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2024
@LWChris
Copy link

LWChris commented Dec 4, 2024

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants