function enableFoldingInEditor(editor) {
        restoreLineFolds(editor);
        setupGutterEventListeners(editor);
        editor._codeMirror.refresh();
    }
Add gutter and restore saved expand/collapse state.
@param {Editor} editor the editor instance where gutter should be added.