codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.88k stars 352 forks source link

Automatic Cleanup On Save option not working after update to VS 17.7.0 #1014

Open Wozniax1 opened 11 months ago

Wozniax1 commented 11 months ago

Environment

Description

Automatic Cleanup On Save option not working after update to VS 17.7.0. In 17.6.X it worked.

Steps to recreate

  1. Open a C# script
  2. Make a change that should be formatted
  3. Make sure Cleanup On Save is ON
  4. Save the file

Current behavior

Now on saving a file it does nothing, but when clicked Cleanup Active Document directly it formats it.

Expected behavior

Formatting should run on saving a file.

TimDN commented 11 months ago

Seeing the same issue on my machine using the same environment as OP

JackmanA commented 10 months ago

I am seeing the same issue on my machine. Only difference from OP is that I am using Visual Studio Professional 2022 v17.7.2.

I can confirm that a different machine that is running Visual Studio Professional 2022 v17.6.4 IS working as expected.

paro77 commented 10 months ago

Same issue on my end too. Running CodeMaid in Diagnostics mode resulted in this message in the Output:

[CodeMaid Diagnostic 07:24:02 PM] WindowEventListener.OnWindowChange raised for 'C:*****\Application.cs'

Only explicit call to 'Cleanup Active Document' from the extension menu invokes CodeMaid.

Hope this helps. Thanks!

UPDATE: Issue persists after latest update to VS 2022 Community 17.7.3 Re-installing CodeMaid didn't help

gopo9 commented 10 months ago

Same issue on my machine VS 2022 Community 17.7.2 C++ language

paro77 commented 10 months ago

This is my second update on the issue. Here is a list of steps that brought CodeMaid's cleanup-on-save back in the game for me:

In my efforts to solve the case by myself, I cloned and debugged the CodeMaid.2022 project. It had issues that pointed to possible library version conflicts (there were "method not found" exceptions). This made me try re-installation with manual VS files cleanup. Once the debug started working, it turned out it nicely cleans on save some small test app projects with a couple of open source file windows. That's when I went for closing the windows in the bigger solution.

Hope this may help.

illusion-walk commented 9 months ago

Thanks for the tip. This will work if nothing else helps. But that can't be the way to solve this problem. Completely uninstalling Visual Studio is very time-consuming if you also want to have the many extensions back in the same individual configuration.

paro77 commented 9 months ago

Thanks for the tip. This will work if nothing else helps. But that can't be the way to solve this problem. Completely uninstalling Visual Studio is very time-consuming if you also want to have the many extensions back in the same individual configuration.

@illusion-walk I completely agree with your point. I just listed everything I tried. In fact, I had multiple re-installations of VS that just didn't help. Closing all open .cs files for a solution that had probably hundreds of them is what actually made it work, for me.

illusion-walk commented 9 months ago

Yes, after closing all open .cs files the auto format on save is working well! Thanks a lot for the hint! This is definitely much easier than reinstalling VS :D

Q8aghzw3123 commented 6 months ago

If you are also using a CMake project, check this option: Clean -> General -> Perform partial clean when files are no longer part of the solution.