nl_tokens: / * For cases like if ( a || b ||$ c ) { ... } If we hit Enter at $ we want line b || to be indented . Formatting will be applied to the last two lines . Node that fully encloses these lines is binary expression a || ... . Initial indentation for this node will be 0 . Binary expressions don t introduce new indentation scopes however it is possible that some parent node on the same line does - like if statement in this case . Note that we are considering parents only from the same line with initial node - if parent is on the different line - its delta was already contributed to the initial indentation .
pl_tokens: function getOwnOrInheritedDelta ( n , options , sourceFile ) { var previousLine = - 1 /* Unknown */ ; var childKind = 0 /* Unknown */ ; while ( n ) { var line = sourceFile . getLineAndCharacterOfPosition ( n . getStart ( sourceFile ) ) . line ; if ( previousLine !== - 1 /* Unknown */ && line !== previousLine ) { break ; } if ( formatting . SmartIndenter . shouldIndentChildNode ( n . kind , childKind ) ) { return options . IndentSize ; } previousLine = <mask> ; childKind = n . kind ; n = n . parent ; } return 0 ; }