@@ -20,28 +20,12 @@ namespace ts.OutliningElementsCollector {
20
20
if ( current === n ) break ;
21
21
const firstImport = statements [ current ] ;
22
22
while ( current < n && isAnyImportSyntax ( statements [ current ] ) ) {
23
- visitImportNode ( statements [ current ] as AnyImportSyntax , sourceFile , cancellationToken , out ) ;
23
+ addOutliningForLeadingCommentsForNode ( statements [ current ] , sourceFile , cancellationToken , out ) ;
24
24
current ++ ;
25
25
}
26
26
const lastImport = current < n ? statements [ current - 1 ] : statements [ n - 1 ] ;
27
27
if ( lastImport !== firstImport ) {
28
- out . push ( createOutliningSpanFromBounds ( findChildOfKind ( firstImport , SyntaxKind . ImportKeyword , sourceFile ) ! . getStart ( sourceFile ) , lastImport . getEnd ( ) , OutliningSpanKind . Import ) ) ;
29
- }
30
- }
31
-
32
- function visitImportNode ( node : AnyImportSyntax , sourceFile : SourceFile , cancellationToken : CancellationToken , out : Push < OutliningSpan > ) {
33
- // Add outlining spans for comments if they exist
34
- addOutliningForLeadingCommentsForNode ( node , sourceFile , cancellationToken , out ) ;
35
- // Add outlining spans for the import statement itself if applicable
36
- if ( isImportDeclaration ( node ) && node . importClause && node . importClause . namedBindings &&
37
- node . importClause . namedBindings . kind !== SyntaxKind . NamespaceImport && node . importClause . namedBindings . elements . length ) {
38
- const openToken = findChildOfKind ( node . importClause . namedBindings , SyntaxKind . OpenBraceToken , sourceFile ) ;
39
- const closeToken = findChildOfKind ( node . importClause . namedBindings , SyntaxKind . CloseBraceToken , sourceFile ) ;
40
- if ( openToken && closeToken ) {
41
- out . push ( createOutliningSpan (
42
- createTextSpanFromBounds ( openToken . getStart ( sourceFile ) , closeToken . getEnd ( ) ) ,
43
- OutliningSpanKind . Import , createTextSpanFromNode ( node , sourceFile ) ) ) ;
44
- }
28
+ out . push ( createOutliningSpanFromBounds ( findChildOfKind ( firstImport , SyntaxKind . ImportKeyword , sourceFile ) ! . getStart ( sourceFile ) , lastImport . getEnd ( ) , OutliningSpanKind . Imports ) ) ;
45
29
}
46
30
}
47
31
0 commit comments