Non-indented comments confuse SimpylFold
Closed this issue · 3 comments
Hi,
If I have a function like this:
def my_func():
#This is a comment.
#This too.
#They start in column 1.
print "Here is a properly indented code snippet."
then SimpylFold will not fold my_func(). Not a big deal, I suppose, but Python allows for comments without concern for indentation level (hence I bumped into this phenomenon).
Not a big deal... it's nice to get folding... but some of my comments include examples that are rather long so I prefer to stick them on the lefthand side. Maybe that's generally hated, I don't know.
In any event, thanks for SimpylFold. It's nice.
Placing a single space at the start of each # will lead to you getting folding as per usual, and only takes up a single character of space.
Regardless, this pull request seems to do what you want:
Thanks for reminding me of this. I've just merged pull request #39 to fix it.
In general, SimpylFold assumes that you roughly follow the PEP 8 formatting conventions, and in this particular case, PEP 8 states: "Block comments generally apply to some (or all) code that follows them, and are indented to the same level as that code." Still, the fix is simple enough that it makes sense to include anyway.
Thanks. Yes, I realize that commenting on the lefthand side may not be purty but at the same time there are moments when I'd like to do it (in order to keep line wrapping from occurring). I appreciate your response. And the plugin works very nicely.