Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically fold code in ACE editor

ACE (Bespin successsor) features code folding. Also, there is an event changeFold which fires upon code being folded or unfolded.

How do I trigger/set code folding from JavaScript?

I.e. fold up code for function beginning at line N.

like image 891
oberstet Avatar asked Oct 10 '12 15:10

oberstet


1 Answers

see addfold at https://github.com/ajaxorg/ace/blob/master/lib/ace/edit_session/folding.js#L259 and onFoldWidgetClick https://github.com/ajaxorg/ace/blob/master/lib/ace/edit_session/folding.js#L685 for the usage example

like image 147
nig Avatar answered Oct 27 '22 06:10

nig