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

"Unmerged changes" should use merge markers to mark refactoring conflicts across multiple targets #74366

Open
davkean opened this issue Jul 12, 2024 · 1 comment
Assignees
Labels
Area-IDE Feature Request IDE-CodeStyle Built-in analyzers, fixes, and refactorings
Milestone

Comments

@davkean
Copy link
Member

davkean commented Jul 12, 2024

Summary

When encounter conflicts across a multi-target conflict, Roslyn should use Git merge markers to mark the conflicts so that the user is aware of the conflict.

Background and Motivation

I did a refactoring in a multi-targeted code yesterday where I turned a method from an instance -> static. This changed a consumption of that method in a completely different class, but ran into some conflicts in some of the targets, making the following change:

/* Unmerged change from project 'Microsoft.VisualStudio.Shell (net472)'
Before:
            if (this.IsBuiltInLocalService(serviceGuid, out Type? serviceType))
After:
            if (Package.IsBuiltInLocalService(serviceGuid, out Type? serviceType))
*/

Because I had existing changes in this file, I did not see this change until after I committed and pushed to my origin. Looking at my tree right now, I see others ran into this and those changes got merged into the tree unbeknownst to them. You can see hundreds of examples of this across Github.

Proposed Feature

I think it would a better experience here if Roslyn choose to use merge markers here to make it painfully obvious that this should be addressed before merging.

Something similar to this:

<<<<<<< Unmerged change from project 'Microsoft.VisualStudio.Shell (net472), before:
            if (this.IsBuiltInLocalService(serviceGuid, out Type? serviceType))
=======
            if (IsBuiltInLocalService(serviceGuid, out Type? serviceType))
>>>>>>> After

Roslyn already automatically recognizes these and shows an error, making a very friendly way of finding these.

CS8300	Merge conflict marker encountered	
CS8300	Merge conflict marker encountered	
CS8300	Merge conflict marker encountered	
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Jul 12, 2024
@arunchndr arunchndr added IDE-CodeStyle Built-in analyzers, fixes, and refactorings and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 15, 2024
@arunchndr arunchndr added this to the 17.12 milestone Jul 15, 2024
@arunchndr
Copy link
Member

Assigning to Sam to load balance, but @CyrusNajmabadi feel free to pull if you feel so inclined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Feature Request IDE-CodeStyle Built-in analyzers, fixes, and refactorings
Projects
None yet
Development

No branches or pull requests

3 participants