Implement folding.

Currently only working the first time the TypeScript file is opened.