atom-fold-comments
atom-fold-comments copied to clipboard
Folding/Unfolding per level
Hello, I can't found a way in Atom to fold all keeping the comments unfolded. Your work is the most nearby but would be nice expand per levels, at least level 1.
Thanks in advance
Hey there,
Sorry, but I don't entirely understand what you're asking here. Could you try to explain this again?
For example...
When you fold all in Atom it really fold all, including comments:
Before fold
/**
- asdadasd */ .asdasd { background: #ddd ; }
After fold
/** .asdasd {
And would be nice keep comments unfolded or using your module to unfold only first level at least. For now the package unfold all levels so it display all the nested code like this:
/**
- asdadasd
/
.adsfadsf {
background: #ddd ;
/*
- qweqwe */ }
And this is what would be nice:
/**
- asdadasd */ .asdasd {
This is SASS language, I don't know if work in the same way as the language you use in the screenshot.
So you're saying when you unfold all comments, you only want the first level of comments to be unfolded? That kind of goes against the primary purpose of the package, which is folding and unfolding all comments.
While it's possible that a third type of command could be added for "fold and unfold only the first level of comments" or "only the Nth level", I don't have the time or interest to implement it. If you sent in a PR, I'd be happy to take a look though!
Actually, for me, the default behavior is folding just the 1st level comments where I expected all comments to be folded/unfolded. The file is this: https://github.com/chili-epfl-cellulo/qml-plugin/blob/master/src/CelluloBluetooth.h
Ok! Again, this is open source so please feel free to submit a PR if you are interesting in changing behavior and I'd be happy to take a look 😁
No, what I mean is that the intended behavior (fold all) isn't what I'm seeing (folds only 1st level).
~~What's going on is probably isBufferRowCommented()
failing on a comment that's indented, as in:~~
/**
* @brief Gets the latest camera frame
*
* @return The latest camera frame; IMG_WIDTH*IMG_HEIGHT many ints in grayscale, 0 to 255
*/
So I debugged this and the problem is actually the following: All my indented comments in the file I linked to were ~~doxygen comments with @brief
in their first line.~~ The problem has nothing to do with doxygen, any indented comment block seems to have two initial lines foldable. These lines somehow get tagged as foldable (on top of the first line of the block comment that is also foldable) so the comment actually has two fold points. So iterating over all lines and toggling these fold actually toggles the block twice and effectively has no effect.
#14 fixes the above problem I mentioned. Please check thoroughly as I have zero experience with coffeescript.