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

Feature Request: Add option for conditional per-file Automatic Cleanup on Save based on comment at top of file #1043

Open RichardSinden opened 4 months ago

RichardSinden commented 4 months ago

Environment

Description

I'm working on a large legacy codebase and I don't want to automatically cleanup every file that I save, because reorganising everything creates a bit of pain detecting actual changes in the changelogs. However, when I add a new file, I would like the option to tag that file to always be cleaned up on save.

Therefore, I propose adding an option to make the automatic cleanup conditional, based on a configurable comment at the top of the file. When cleanup is run manually on a file then CodeMaid should write the comment to the file. e.g. defaulting to something like // Auto-organized by CodeMaid (obviously the comment syntax would need to be appropriate to the language)

When a file is saved then CodeMaid should check for the presence of the comment and, if it exists, then cleanup can be performed. If it doesn't then the file should be ignored by CodeMaid.