@@ -13,6 +13,14 @@ function camelize(str) {
1313  } ) ; 
1414} 
1515
16+ function  isCommentFold ( line )  { 
17+   var  isAFold  =  false ; 
18+   if  ( / ^ \s * ( \/ \* | \/ \/ ) # ? r e g i o n \b / . test ( line ) )  {  isAFold  =  true ;  } 
19+   if  ( / \/ \/ ( .* ) \{ / . test ( line ) )  {  isAFold  =  true ;  } 
20+   if ( / ^ \s * ( \/ \* \* \* ) .* \* \/ \s * $ / . test ( line ) )  {  isAFold  =  true ;  } 
21+   return  isAFold ; 
22+ } 
23+ 
1624const  Editor  =  React . createClass ( { 
1725  propTypes : { 
1826    theme : React . PropTypes . string , 
@@ -38,7 +46,7 @@ const Editor = React.createClass({
3846          if  ( foldWidgets [ row ]  ==  null ) 
3947              foldWidgets [ row ]  =  this . getFoldWidget ( row ) ; 
4048          if  ( foldWidgets [ row ]  !=  "start" )  continue ; 
41-           if  ( ! / # r e g i o n / . test ( this . getLine ( row ) ) )  continue 
49+           if  ( ! isCommentFold ( this . getLine ( row ) ) )  continue 
4250          var  range  =  this . getFoldWidgetRange ( row ) ; 
4351          // sometimes range can be incompatible with existing fold 
4452          // TODO change addFold to return null istead of throwing 
@@ -50,13 +58,10 @@ const Editor = React.createClass({
5058              try  { 
5159                  // addFold can change the range 
5260                  var  fold  =  this . addFold ( "..." ,  range ) ; 
53-                   if  ( fold ) 
54-                       fold . collapseChildren  =  depth ; 
5561              }  catch ( e )  { } 
5662          } 
5763      } 
5864    } ; 
59-     console . log ( this . refs . ace . editor . session ) ; 
6065   this . refs . ace . editor . session . foldRegion ( ) ; 
6166  } , 
6267
0 commit comments