Folding C++ blocks (possible bug)



I have Atom installed with just the Core Packages, language-haskell and the minimap. When I type any C++ program and try to fold a block -the main function for instance- it will “stop the folding” at the first comment that it finds that start on the column 1.

For example:

#include <iostream>

int main(void) {
  std::cout << "Atom" << std::endl;
// Comment starting at column 1  

  return 0;   // This line won't be folded.

When folded results in:

Note that the folding stops at the first comment writte starting on column 1. Is it right? I believe that it should fold the entire block, from { to }.

Btw, the folding works normally if I indent the line 6 (making it start from the column 3 instead of 1).

Also, it can be anything starting on column 1, it doesn’t need to be a comment, but I don’t see why someone would put anything beside a comment without indenting…


I suspect folding in Atom is based on indentation…


Yes, it seems to be based on indentation. Do you know if there is a package or some way to make it fold the real block?


I’m not aware of it, but there was another discussion about folding here, recently…

Found it: