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.92k stars 361 forks source link

"cleanup on save" stop working #537

Open sm-g opened 6 years ago

sm-g commented 6 years ago

Since VS 15.6.1 CodeMaid 10.4 Widnows 7

after update VS - saving file does not trigger CodeMaids's Cleanup action. It works when I manually hit "Cleanup active document"

codecadwallader commented 6 years ago

Thanks for reporting the issue, I am unable to reproduce it. A couple things to check:

  1. Have you double checked that your settings are still set so that automatic cleanup on save is enabled? In particular if you load a solution that has solution-specific settings for CodeMaid that turns it off, that will override your user settings.
  2. What version of the .NET Framework do you have installed? Some Windows 7 users have had issues related to not having .NET Framework v4.6 or higher.
sm-g commented 6 years ago
  1. I use solution specific settings: devenv_2018-04-09_15-25-19

  2. I use 4.6.1 for development and also have 4.7.1

I found that issue gone after I switch menu item: devenv_2018-04-09_15-27-30

Should it overwrite solution-specific settings?

codecadwallader commented 6 years ago

When you toggle the menu item, it should toggle the setting at the same level as if you opened the dialog and selected the toggle. So yes if you have solution-specific settings active it will toggle at the solution-specific level. If you close the solution it will toggle at the user level.

eluchsinger commented 6 years ago

I have found this bug too. I have Automatic Cleanup on Save activated and it does not work.

EDIT: After toggling the option off and on, it suddenly started working. Appears to be a bug with the UI and not with the feature itself.

codecadwallader commented 6 years ago

Interesting, can you consistently reproduce the issue?

eluchsinger commented 6 years ago

I have had it multiple times when I open an existing solution that didn't contain that CodeMaid settings file.

codecadwallader commented 6 years ago

If you export your user settings, can you confirm that automatic cleanup on file save is present?

jpeterson88 commented 2 years ago

Hello. I have the same issue here. I'm running VS Pro 2019 (16.11.9). CodeMaid version is V 12. I've tried uninstalling CodeMaid, updating Visual Studio, resetting default CM settings and no luck. If I manually navigate to the format setting or use the hotkey (CTRL + M, Space), it works. It only appears to not work when saving.

Here are my export settings:


<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="SteveCadwallader.CodeMaid.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        </sectionGroup>
    </configSections>
    <userSettings>
        <SteveCadwallader.CodeMaid.Properties.Settings>
            <setting name="Feature_SettingCleanupOnSave" serializeAs="String">
                <value>True</value>
            </setting>
        </SteveCadwallader.CodeMaid.Properties.Settings>
    </userSettings>
</configuration>```
codecadwallader commented 2 years ago

If you turn on diagnostics mode (CodeMaid->Options->Diagnostics mode) does that provide any helpful information in the Output window?

jpeterson88 commented 2 years ago

@codecadwallader I actually uninstalled and then pulled the extension off of the marketplace as opposed to using the extension manager in VS 2019 and it fixed my issue.

illusion-walk commented 1 year ago

I still have the same problem. On several machines. Reinstalling the extension does not help and Automatic Cleanup on Save is activated.

This feature of automatic formatting is unfortunately one of the most important for me while working. I hope there will be a fix soon. I'm using the current Visual Studio 2022 version 17.7.4. But maybe it came from the VS update https://github.com/codecadwallader/codemaid/issues/1014

illusion-walk commented 1 year ago

If you turn on diagnostics mode (CodeMaid->Options->Diagnostics mode) does that provide any helpful information in the Output window?

I have no output when saving a file if I enable the diagnostics mode. Even when I manually click Cleanup Active Document (which by the way works normally).

paro77 commented 1 year ago

@codecadwallader I had the same issue, but not anymore. I described what I did in detail in my reply to #1014, here

Diagnostics mode didn't issue any meaningful output to the very end, when saving the current document. It did, though, output all debug info on manual call to Cleanup Active Document, in constrast with the above comment.