codemaid
codemaid copied to clipboard
Option to disable to formatting of comments
Environment
- Visual Studio version: Visual Studio 2017 15.6.7
- CodeMaid version: example 10.4
- Code language: C#
Description
Disable the formatting of comments would be nice Sometimes comments are put on 1 line, where we want it to be on several.
Steps to recreate
// example of // comment that is // put on one line
Current behavior
// example of comment that is put on one line
Expected behavior
// example of // comment that is // put on one line
We have similar scenarios where this would be useful. Are there any tags that could be used to mark a set of comments so that they would be ignored by our general CodeMaid formatting rules?
For the original request, you can simply not use the comment formatting functionality? Comment formatting is off by default until turned on.
For the second request, no we don't currently have any conventions for decorating comments that should be ignored by comment formatting. I'm not sure what that would look like, do you have any ideas? I think having to put a tag (comment) around a comment saying don't format this comment would be pretty awkward... :)
As soon as you have even one line in a comment without a leading space, it will be ignored by the formatter.
//example of
// comment that will not
// be formatted
Or any other version of that same idea. If you're suggesting prefixes, I'm assuming you therefor do not mind some extra characters. Consider:
//; something
//; like this?
I hope this helps you out!
My personal preference would be to separate XML comment headers from regular comments. I'd like CodeMaid to fix up the XML comment headers, but leave my other comments alone. If I could turn these options on and off separately, that would solve my problems entirely. If this is already there and I've somehow overlooked it, please let me know.
This would be a useful feature to have.
@MelGrubb great idea! Should even be very easy to implement, since the formatter already knows if it's formatting XML or not, it just requires a setting update.
I want to lend some support to this as CM is currently messing up our copyright banners, and there's no way to fix this without completely disabling comment formatting. XML comment formatting is very helpful, but disabling it for other types of comments would help make the difference between our team being able to use CM or not.
As soon as you have even one line in a comment without a leading space, it will be ignored by the formatter.
//example of // comment that will not // be formatted
Or any other version of that same idea. If you're suggesting prefixes, I'm assuming you therefor do not mind some extra characters. Consider:
//; something //; like this?
I hope this helps you out!
You can also insert a "Zero Width Whitespace" which looks a bit nicer but is more work. Here's a link to easily copy it: https://codepen.io/chriscoyier/pen/iLKwm
This still doesn't fix the "issue" but is in my eyes a "nasty" work around.
My personal preference would be to separate XML comment headers from regular comments. I'd like CodeMaid to fix up the XML comment headers, but leave my other comments alone. If I could turn these options on and off separately, that would solve my problems entirely. If this is already there and I've somehow overlooked it, please let me know.
@codecadwallader Any thoughts on this?
Having some different options for XML and non-XML comment formatting makes sense to me. Which all option(s) would fall under that umbrella? It seems like the one that might be of most interest in this thread is "Run format comments during cleanup" but curious if there are others?
Also multi-line string literals would be nice to disable auto-formatting for.