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
Code cleanup on save while resolving merge conflicts #60818
Comments
Very annoying, we must deactivate "Code Cleanup on Save" before resolving conflicts. |
I don't know if this is the only time it happens, but I have noticed that if you have conflicts in a project file it causes the project to be unloaded. If you are then reviewing conflicts in a file within that project then it loads the files from outside of the project i.e. with the path to file on disk. Which means the code cleanup does not have context and removes all using statements. This happens even in the diff window not just the merge window. As a workaround, it may be possible that resolving project conflicts first prevents this from happening. |
Hi, We have the same behavior. Any news on this issue ? |
Unfortunately not. I didn't find any workaround apart from deactivating "Code Cleanup on Save". |
I am also facing the same problem, I found code cleanup feature very handy but for this problem I had to unable it. |
i'm having the same behavior |
Can confirm this is still a problem as of VS 2022 17.3.4. Very annoying bug. |
Confirming this is still an issue |
Still an issue, quite a big one (VS2022 17.3.6). |
Same issue using VS2022 17.4.1 |
Very annoying |
Same for me in VS2022 17.4.2.. 🙁 |
Same here |
Note that this not only removes all using directives, but also breaks the code style of the merged file by ignoring rules defined in the EditorConfig file. If someone needs steps to reproduce:
|
Same problem here, in VS 2022 version 17.4.2 |
Our team is also seeing this issue. It's a big pain. Please fix. VS 17.4.0 |
@JoeRobich Can we get a quick update on this? 🙂 Seems like lots of people are running into this (including myself! 😄) |
Visual Studio 17.5.1 the issue is still a thing. It's almost a year now since the issue was created... |
This bug is almost having a birthday lol |
I see that sharwell removed JoeRobich and marked this as |
Very annoying bug |
Please fix the bug. My teammates are already using alternative merge tools, I can't get them back to the Visual Studio standard. |
Yes, please fix this issue as soon as possible. We are also using an alternative merge tool because of this annoying and major issue. |
1 year later, pretty obvious MS doesn't really care about this bug. Maybe it'll be fixed in VS 2024... |
I've been tearing my hair out over why merges where losing usings, finding out MS has known about this for over a year and hasn't even responded on the ticket 😡 |
Can please @CyrusNajmabadi @mavasani @sharwell @JoeRobich @Cosifne @genlu @beccamc @jasonmalinowski or someone else have more clarity on why the second most updated bug is still not fixed after a year? |
I feel like part of the problem is that this seems like a VS issue, but it's logged in the Roslyn repo. |
All Visual Studio bug reports (on the MS Developer Community) were closed as duplicates of this GitHub issue. |
That's part of what concerns me 😅 |
The IDE just instructs the language service to "run cleanup" with a given profile. The actual changes being made in response to that instruction are defined by the language service, which in this case is Roslyn. We haven't had the chance to investigate what makes a merge situation different from other situations. If someone wanted to investigate, this is the specific block of code which is responsible for removing using directives during this operation: roslyn/src/Features/LanguageServer/Protocol/Features/CodeCleanup/AbstractCodeCleanupService.cs Lines 115 to 123 in 6e2fc19
|
As I've explained in my comment above, this issue is not just about the removal of using statements. So the bug might be somewhere else (or there are multiple bugs). |
Thanks, @sharwell, good to know 🙂 |
Thank you @sharwell for the code ref. As far as i can tell, the problem lies in how the cleanup works. Line 30 in 6e2fc19
Presumably not everything is loaded in the semantic model. Otherwise no warnings would arise. You can see the same behavior when using the "Compare with unmodified..." command in the git changes panel or in the merge conflict view. If you try to use IntelliSense to find a local class (or some class in a imported namespace) you will be disappointed, nothing will be suggested. For me there are now two options, first removing of unnecessary imports should be disabled in this "compare/merge views" or secondly the imported namespaces must also be loaded in the "compare/merge views". |
Imho I would go a step further than @luccawilli pointed out in his first suggestion. For me it would be okay to disable the format on save completely in the merge view. |
Please fix it! |
This is becoming increasingly annoying, (i.e. forgetting to restore using prior to a force push and discovering CI build failures). |
There are many people here who are experiencing this extremely annoying and counterproductive bug. I wonder if we can collect enough bribe money to have someone fix this 15-month-old bug...? |
Moved to VS Editor, tracked internally as https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1847852, tracked externally as https://developercommunity.visualstudio.com/t/Code-cleanup-on-save-while-resolving/10015181 (please vote on it). |
Closed and back to the original Developer Community issue? Can someone please help me understand? |
I assume someone analyzed the bug in detail and noticed that it's not a bug in Roslyn, but in VS itself. |
Bully work, all of us ignored for 15 months because of some good old fashioned buck passing at MS. Couldn't be arsed to verify where the issue really was in 2022 when it was buck-passed to Roslyn, so here we are again. |
We did a bunch of work last week to consolidate feedback on this issue to the team that now has ownership of it. Please place additional feedback on the tracking issue, as feedback here will not be seen by the team working on a fix for the issue. |
This issue has been moved from a ticket on Developer Community.
[severity:It's more difficult to complete my work] [regression] [worked-in:VS2019]
With turned on feature 'Code Cleanup on Save', while resolving conflicts after merging branches, after applying changes all 'using' directives are gone.
Original Comments
Feedback Bot on 4/18/2022, 01:41 AM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: