@@ -465,11 +465,8 @@ namespace ts.formatting {
465465 }
466466 return false ;
467467 }
468-
469- /**
470- * Function returns true when a node with conditional indentation rule will indent certain child node
471- */
472- function nodeWillIndentChild ( parent : TextRangeWithKind , child : TextRangeWithKind , indentByDefault : boolean ) {
468+
469+ export function nodeWillIndentChild ( parent : TextRangeWithKind , child : TextRangeWithKind , indentByDefault : boolean ) {
473470 let childKind = child ? child . kind : SyntaxKind . Unknown ;
474471 switch ( parent . kind ) {
475472 case SyntaxKind . DoStatement :
@@ -487,24 +484,15 @@ namespace ts.formatting {
487484 case SyntaxKind . SetAccessor :
488485 return childKind !== SyntaxKind . Block ;
489486 }
490- // No explicit rule for selected nodes, so result will follow the default value argument
487+ // No explicit rule for given nodes so the result will follow the default value argument
491488 return indentByDefault ;
492489 }
493490
491+ /*
492+ Function returns true when the parent node should indent the given child by an explicit rule
493+ */
494494 export function shouldIndentChildNode ( parent : TextRangeWithKind , child ?: TextRangeWithKind ) : boolean {
495- if ( nodeContentIsAlwaysIndented ( parent . kind ) ) {
496- return true ;
497- }
498- return nodeWillIndentChild ( parent , child , false ) ;
499- }
500-
501- /**
502- * Function returns true if existing node content indentation should be suppressed for a specific child
503- */
504- export function shouldInheritParentIndentation ( parent : TextRangeWithKind , child : TextRangeWithKind ) : boolean {
505- // Consider parents without indentation rules can indent their children
506- // so that they can apply inherited delta value to them
507- return ! nodeWillIndentChild ( parent , child , true ) ;
495+ return nodeContentIsAlwaysIndented ( parent . kind ) || nodeWillIndentChild ( parent , child , false ) ;
508496 }
509497 }
510498}
0 commit comments