@@ -20,28 +20,12 @@ namespace ts.OutliningElementsCollector {
2020 if ( current === n ) break ;
2121 const firstImport = statements [ current ] ;
2222 while ( current < n && isAnyImportSyntax ( statements [ current ] ) ) {
23- visitImportNode ( statements [ current ] as AnyImportSyntax , sourceFile , cancellationToken , out ) ;
23+ addOutliningForLeadingCommentsForNode ( statements [ current ] , sourceFile , cancellationToken , out ) ;
2424 current ++ ;
2525 }
2626 const lastImport = current < n ? statements [ current - 1 ] : statements [ n - 1 ] ;
2727 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 ) ) ;
4529 }
4630 }
4731
0 commit comments