Great tool. However, it doesn't seem to format VB as well as C#. One thing I noticed is it does not add an empty line between functions. Running CodeMaid on the below will not add an empty line between Foo and Bar.
Public Class Class1 Public Function Foo() As Integer Return 1 End Function Public Function Bar() As Integer Return 2 End Function End Class
Hi, Great Extension. By default, *.rc2 files should be excluded. If you remove the last CR/LF at the end of those files (ie if the file doesn't end with an empty line), the project doesn't compile anymore. Fred
This "great" plugin destroyed one week of work. Im really angry, cleaning up singel files works good, but when it came to cleaning up the whole solution it is deleting whole files! Big fat warning to everybody! DO NOT CLEAN THE WHOLE SOLUTION AS MENTIONED!
I'm very sorry to hear that happened to you. I have not heard of it happening before to anyone else, and I'd like to determine a root cause if you have any interest in pursuing it further. Please contact me directly via codemaid on gmail if you would like to discuss.
That's odd that you'd be seeing intermittent behavior like that. Have you tried the classic uninstall/reinstall technique? If that doesn't help please report some more details on BitBucket and we can take a look: https://bitbucket.org/s_cadwallader/codemaid/issues
DISABLED for me in Visual Studio 2012 premium. Since this is the 1st time, i am usng it, i felt that i was making some mistakes. this tool has raving reviews and i am wondering why it is not working or disabled for me. any help would be appreciated. regards, Ravi.
This is an awesome util. Thanks a lot Steve! Saved me a ton of precious time. :-)
I just wanted to bring to your notice a minor problem. When I Format the comments, it automatically messes up my copyright info at the top of the file. My company's copyright info normally follows a 3 line comment like: // <copyright file="file.cs" company="MyCompany"> // Copyright (c) 2013 CompanyName. All rights reserved. // </copyright> // <summary>The class summary</summary>
But on formatting comments, it puts it all in just a single line (sometimes 2 lines). Is this intended or am I doing something wrong :^)
Really glad to hear you like it, you're welcome. :)
There are two kinds of comment formatting, traditional comments "//" and XML comment formating "///". It looks like you have XML tags within your copyright definition, but they aren't being marked with the triple slash syntax usually associated with XML comments. If you put the third slash in that will improve behavior. You will also want to mark 'copyright' as a major tag within CodeMaid's configuration (CodeMaid->Configuration->Cleaning->Comments) so that it will always keep new lines before and after.
Hope that helps. If you're still seeing an issue please post a code sample on BitBucket and I'll take a deeper look. :)
Just learnt about this tool today reading a SO answer. Awesome utility to reformat a huge bunch of files that I had to import from another system. And managed to get it done in all of 2 mins.. Great work.
I have to reiterate a point brought up by a previous reviewer.
I like cleaning up the code to add the this keyword in front of class members and methods. It helps to make the code more unified because you NEED to use the this keyword when applying extension methods to the local class. I agree it is not needed in most cases, but it does clarify the target of the request.
StyleCop has this rule for a good reason: code transparency and consistency. Please support this in CodeMaid. it is the last item only thing it doesn't do for me.
Thanks for the suggestion. Personally I always remove them, but there's arguments for both directions.
To implement adding/removing "this." requires a richer code model than what is currently exposed through the Visual Studio API. The Roslyn project promises to expose a code model rich enough to add this kind of functionality in the future, but it has not been released. To get that behavior today you'll need to use a commercial tool (e.g. ReSharper) that has its own static compilation engine.
Trying to use CodeMade 0.6.2 with VS2012. After I open the project everything works well until I go to the "Spade" window, then everything hangs and VS shows the "waiting for a background process" window forever. nothing works until I kill VS and start over.
This is a known issue with the C++ API in VS2012. You can use CodeMaid, but you will have to close the Spade tool window which accesses parts of the API that are now hanging in VS2012. This is not an issue in VS2010, and Microsoft has fixed it for VS2013. So the issue only occurs with VS2012 C++ projects.
Microsoft was very helpful when I worked with them on this issue, and in addition to resolving it for future releases (e.g. VS2013) they provided some workaround suggestions for VS2012. They're non-trivial, but they are on my radar and progress can be tracked on BitBucket here: https://bitbucket.org/s_cadwallader/codemaid/issue/142/spade-starts-endless-process-in-vs-2012-c
I have a rater big C# Project, on witch VS2012 crashes when I run a Code CleanUp.
The Project has ~770 files, and VS always crashes at ~400 cleaned up with OOM or another simmilar exception. (Before that the Memory use slowly increases)
If I copy a piece of code to a different C# code files and go back to the file that the code was copied from (two files are unsaved at this point), Visual Studio crashes and had to restart. If I save all the files immediately and reopen the file it doesn't crash. This crash is happening on the latest update, which I installed today on July 11.
I copied code in two different projects.
After today's update (July 9, 2013), CodeMaid is now crashing Visual Studio 2012 after a file is saved after an F2-initiated Rename Refactor. This occurs after ALL renames, including methods and classes. If I rename class 'SampleClass' to 'SampleClass2' for example, all other code files referencing SampleClass are changed and saved successfully, but SampleClass.cs is not saved and Visual Studio freezes for a while with the message "CodeMaid is cleaning 'SampleClass.cs'..." in the lower left corner (using about 30% of my i5 750 CPU consistently).
After about half a minute, Visual Studio crashes and I get the following message from Windows: http://i.imgur.com/U9mzYd5.png
The crash also occurs after refactoring the name of a method not referenced by any other code.
This is particularly frustrating because I use CodeMaid constantly. I'm going to try re-installing it with the hope of the error disappearing.
Reinstalling didn't fix the issue, but I found a setting that prevents crashing. In the top Cleaning section in the Configuration window, unchecking 'Use undo transactions' eliminates the issue. So the crash seems to be related to using CodeMaid's undo feature with Rename Refactors.
Yes, this is a known issue that was reported with v0.6.1 - see BitBucket here: https://bitbucket.org/s_cadwallader/codemaid/issue/213/refactor-rename-starts-endless-clean-loop
The workaround you suggested is the recommended approach for now (disable undo transactions).
Thanks for the report and sorry for the trouble.
I've just uploaded a beta release with a fix for this issue here: https://bitbucket.org/s_cadwallader/codemaid/downloads/CodeMaid_v0.6.1.1_BETA.vsix
If you have a chance will you give it a try? The change is pretty minimal, a new configuration option that by default will skip undo transactions during automatic cleanup on save which is what led to an infinite loop.
I have just come across your fantastic utility, but in my codebase I have alot of compiler directives inside my code.
If I have a compiler directive inside a method, it handles the reorganizing fine.
If I have a compiler directive around a method or some properties they loose their place.
I tried too wrk around this by commenting out the #if #endif statement, but it only moves the comments above the section and not below it.
Hi d3 -
You're right, reorganization does not currently handle preprocessor directives. There is a card in the backlog to add that functionality, feel free to visit it to vote it up and/or add comments: https://trello.com/c/Qqd0GLqI
Glad to hear otherwise you are liking the tool. :)
I installed codemaid tonight using nuget, but now when I open my unmanaged C++ solution in VS2012 and try to open a file, VS hangs "waiting for background operation to complete". I gave it 10 minutes hoping it was a one time set up issue. I've had to disable it for now. Suggestions on what to check? I have these extensions installed: AStyle, Indent Guides, Visual Studio Extensions, VS Commands for Visual Studio 2012, Windows Debugger Extension, Windows Driver Tools
This is a known issue with the C++ API in VS2012. You can use CodeMaid, but you will have to close the Spade tool window which accesses parts of the API that are now hanging in VS2012 (used to work in VS2010). There is an open bug for CodeMaid here: https://bitbucket.org/s_cadwallader/codemaid/issue/142/spade-starts-endless-process-in-vs-2012-c
and more importantly an open bug on Microsoft Connect here: https://connect.microsoft.com/VisualStudio/feedback/details/770205/accessing-envdte80-codeclass2-c-members-hangs-vs2012
If you can go vote up the Microsoft Connect bug that would be very appreciated and we'll hopefully get it resolved soon!
That means the next year number release (e.g. VS2013). I've spoken with them a lot and they've provided some work-arounds in the short term, but they require some significant changes so I've been heads down expanding out the unit tests before tackling it. The BitBucket issue is still the best place to keep tabs on this item: https://bitbucket.org/s_cadwallader/codemaid/issue/142/spade-starts-endless-process-in-vs-2012-c
You're welcome - glad you like it!
Spade supports zooming - you can hold down the Ctrl-key and use the mouse wheel to zoom-in or zoom-out. :) Holding down the Ctrl-key and clicking the middle button will reset the zoom to 100%.
Sure if you would like to send a screenshot that would be good (codemaid on gmail). Since it is a full window scale transform vs. a font size change the appearance may not remain as crisp depending on the font.
I am using VS 2012 Premium update 2, with python tools for visual studio. When I save the file, the trailing spaces at the end of lines are not getting removed, even though "Remove end of line whitespace" option is checked.
Is there a fix?
Wouldn't it be useful to sort base class and interface names at a class definition to some definitive order? Like base class first, then all interfaces in alphabetical order. Similar to sorting all using statements (which have their own special sorting as well). I usually don't have too many interfaces in my code, what do others think about it?
I didn't have a strong opinion on this one which is why I haven't chimed in. I turned this concept into a Trello card for you to see if you get any more responses over there: https://trello.com/c/3GqHdVqW