@@ -3,7 +3,7 @@ namespace ts.OutliningElementsCollector {
33 const collapseText = "..." ;
44 const maxDepth = 20 ;
55 const defaultLabel = "#region" ;
6- const regionMatch = new RegExp ( "^\\s*//\\s*(#region|#endregion) (?:\\s+(.*))?$" ) ;
6+ const regionMatch = new RegExp ( "^\\s*//\\s*#(end)?region (?:\\s+(.*))?$" ) ;
77
88 export function collectElements ( sourceFile : SourceFile , cancellationToken : CancellationToken ) : OutliningSpan [ ] {
99 const elements : OutliningSpan [ ] = [ ] ;
@@ -103,7 +103,7 @@ namespace ts.OutliningElementsCollector {
103103 const result = comment . match ( regionMatch ) ;
104104
105105 if ( result && ! isInComment ( sourceFile , currentLineStart ) ) {
106- if ( result [ 1 ] === "#region" ) {
106+ if ( ! result [ 1 ] ) {
107107 const start = sourceFile . getFullText ( ) . indexOf ( "//" , currentLineStart ) ;
108108 const textSpan = createTextSpanFromBounds ( start , lineEnd ) ;
109109 const region : OutliningSpan = {
@@ -117,9 +117,8 @@ namespace ts.OutliningElementsCollector {
117117 else {
118118 const region = regions . pop ( ) ;
119119 if ( region ) {
120- const newTextSpan = createTextSpanFromBounds ( region . textSpan . start , lineEnd ) ;
121- region . textSpan = newTextSpan ;
122- region . hintSpan = newTextSpan ;
120+ region . textSpan . length = lineEnd - region . textSpan . start ;
121+ region . hintSpan . length = lineEnd - region . textSpan . start ;
123122 elements . push ( region ) ;
124123 }
125124 }
0 commit comments