Removal of leading spaces from comments
I have some comments in an Objective-C file which I formatted with some leading spaces on some of the lines for readability (these will eventually get removed but I just need them during development). I noticed however, when I copy this comment and paste it somewhere else that all of the leading spaces get stripped off the lines. Is there any way of stopping this? I can see an option for "Stripping trailing spaces on Save" in the preferences, but nothing for this. So for example:
/**
This is my comment
*/
Becomes
/**
This is my comment
*/
When cut and pasted. Any help appreciated - thanks.
Please sign in to leave a comment.
Go to Preferences | Editor | Smart Keys. There is an option Reformat on paste. Set it to Indent Block. This should help with the copy/paste
Thanks, that helped. However ... if you re-format the file with Command-Option-L, it strips the spaces out again. Any option that can help with that?
It only seems to affect Documentation comments (starting with /**). In Preferences -> Code Style -> Code Generation, I have got "Line comment at first column" and "Block comment at first column" both off, but there is no option for Documentation comments as well?
Yes, you are right. Both options don't affect the document comment /**. This is because the document comment suggests '*' on each comment line like this:
Yes, it is a bug (http://youtrack.jetbrains.com/issue/OC-10577). Feel free to vote for the it!