How does code folding work in Atom?


One of my greatest grievances in my attempted switch from Vim to Atom is that the code folding in Ruby folds way too much. In Atom, it appears that absolutely everything gets folded as long as it’s indented. In Vim, I wrote my own code folding logic using foldmethod=expr. What mechanism is it that controls folding in Atom?

This resource isn’t very technical:

And Googling has produced no other relevant results.

Poking around in package-ruby I found the setting foldEndPattern which sounds very relevant, but I can’t find any documentation on how it works. For example, how does a fold start? Does Atom just assume that every indent should be folded?

Could somebody explain how folding works in Atom?


it fold using tabs AND it is not very friendly to end block / brace.


See the discussion here for more information on folding:


Same issue for me, code folding in Atom is not logical at all.
Plus, I code in react.js then I use another package to integrate .JSX to Atom that is not working perfectly yet, and this package is making mistake with the indentation sometimes… Then Atom will fold illogicaly later… I can’t use Atom because of that.
I don’t wan’t to know how the folding works, I want it to be fix !! :slight_smile: