The syntax aware code folder was initially adapted from the Typescript version. However when porting to C# the behaviour was correct but the implementation was slow and created many objects.
This ticket tracks the effort to speed up the code folding provider.