@@ -50,7 +50,7 @@ namespace ts.OutliningElementsCollector {
50
50
51
51
if ( ! result [ 1 ] ) {
52
52
const span = createTextSpanFromBounds ( sourceFile . text . indexOf ( "//" , currentLineStart ) , lineEnd ) ;
53
- regions . push ( createOutliningSpan ( span , span , /*autoCollapse*/ false , result [ 2 ] || "#region" ) ) ;
53
+ regions . push ( createOutliningSpan ( span , OutliningSpanKind . Region , span , /*autoCollapse*/ false , result [ 2 ] || "#region" ) ) ;
54
54
}
55
55
else {
56
56
const region = regions . pop ( ) ;
@@ -83,7 +83,7 @@ namespace ts.OutliningElementsCollector {
83
83
break ;
84
84
case SyntaxKind . MultiLineCommentTrivia :
85
85
combineAndAddMultipleSingleLineComments ( ) ;
86
- out . push ( createOutliningSpanFromBounds ( pos , end ) ) ;
86
+ out . push ( createOutliningSpanFromBounds ( pos , end , OutliningSpanKind . Comment ) ) ;
87
87
singleLineCommentCount = 0 ;
88
88
break ;
89
89
default :
@@ -95,13 +95,13 @@ namespace ts.OutliningElementsCollector {
95
95
function combineAndAddMultipleSingleLineComments ( ) : void {
96
96
// Only outline spans of two or more consecutive single line comments
97
97
if ( singleLineCommentCount > 1 ) {
98
- out . push ( createOutliningSpanFromBounds ( firstSingleLineCommentStart , lastSingleLineCommentEnd ) ) ;
98
+ out . push ( createOutliningSpanFromBounds ( firstSingleLineCommentStart , lastSingleLineCommentEnd , OutliningSpanKind . Comment ) ) ;
99
99
}
100
100
}
101
101
}
102
102
103
- function createOutliningSpanFromBounds ( pos : number , end : number ) : OutliningSpan {
104
- return createOutliningSpan ( createTextSpanFromBounds ( pos , end ) ) ;
103
+ function createOutliningSpanFromBounds ( pos : number , end : number , kind : OutliningSpanKind ) : OutliningSpan {
104
+ return createOutliningSpan ( createTextSpanFromBounds ( pos , end ) , kind ) ;
105
105
}
106
106
107
107
function getOutliningSpanForNode ( n : Node , sourceFile : SourceFile ) : OutliningSpan | undefined {
@@ -136,7 +136,7 @@ namespace ts.OutliningElementsCollector {
136
136
default :
137
137
// Block was a standalone block. In this case we want to only collapse
138
138
// the span of the block, independent of any parent span.
139
- return createOutliningSpan ( createTextSpanFromNode ( n , sourceFile ) ) ;
139
+ return createOutliningSpan ( createTextSpanFromNode ( n , sourceFile ) , OutliningSpanKind . Code ) ;
140
140
}
141
141
case SyntaxKind . ModuleBlock :
142
142
return spanForNode ( n . parent ) ;
@@ -166,11 +166,11 @@ namespace ts.OutliningElementsCollector {
166
166
return undefined ;
167
167
}
168
168
const textSpan = createTextSpanFromBounds ( useFullStart ? openToken . getFullStart ( ) : openToken . getStart ( sourceFile ) , closeToken . getEnd ( ) ) ;
169
- return createOutliningSpan ( textSpan , createTextSpanFromNode ( hintSpanNode , sourceFile ) , autoCollapse ) ;
169
+ return createOutliningSpan ( textSpan , OutliningSpanKind . Code , createTextSpanFromNode ( hintSpanNode , sourceFile ) , autoCollapse ) ;
170
170
}
171
171
}
172
172
173
- function createOutliningSpan ( textSpan : TextSpan , hintSpan : TextSpan = textSpan , autoCollapse = false , bannerText = "..." ) : OutliningSpan {
174
- return { textSpan, hintSpan, bannerText, autoCollapse } ;
173
+ function createOutliningSpan ( textSpan : TextSpan , kind : OutliningSpanKind , hintSpan : TextSpan = textSpan , autoCollapse = false , bannerText = "..." ) : OutliningSpan {
174
+ return { textSpan, kind , hintSpan, bannerText, autoCollapse } ;
175
175
}
176
- }
176
+ }
0 commit comments