(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem)
| 147463 | consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); |
| 147464 | } |
| 147465 | function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { |
| 147466 | if (ts.nodeIsMissing(child)) { |
| 147467 | return inheritedIndentation; |
| 147468 | } |
| 147469 | var childStartPos = child.getStart(sourceFile); |
| 147470 | var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line; |
| 147471 | var undecoratedChildStartLine = childStartLine; |
| 147472 | if (child.decorators) { |
| 147473 | undecoratedChildStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(child, sourceFile)).line; |
| 147474 | } |
| 147475 | // if child is a list item - try to get its indentation, only if parent is within the original range. |
| 147476 | var childIndentationAmount = -1 /* Constants.Unknown */; |
| 147477 | if (isListItem && ts.rangeContainsRange(originalRange, parent)) { |
| 147478 | childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation); |
| 147479 | if (childIndentationAmount !== -1 /* Constants.Unknown */) { |
| 147480 | inheritedIndentation = childIndentationAmount; |
| 147481 | } |
| 147482 | } |
| 147483 | // child node is outside the target range - do not dive inside |
| 147484 | if (!ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) { |
| 147485 | if (child.end < originalRange.pos) { |
| 147486 | formattingScanner.skipToEndOf(child); |
| 147487 | } |
| 147488 | return inheritedIndentation; |
| 147489 | } |
| 147490 | if (child.getFullWidth() === 0) { |
| 147491 | return inheritedIndentation; |
| 147492 | } |
| 147493 | while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) { |
| 147494 | // proceed any parent tokens that are located prior to child.getStart() |
| 147495 | var tokenInfo = formattingScanner.readTokenInfo(node); |
| 147496 | if (tokenInfo.token.end > originalRange.end) { |
| 147497 | return inheritedIndentation; |
| 147498 | } |
| 147499 | if (tokenInfo.token.end > childStartPos) { |
| 147500 | if (tokenInfo.token.pos > childStartPos) { |
| 147501 | formattingScanner.skipToStartOf(child); |
| 147502 | } |
| 147503 | // stop when formatting scanner advances past the beginning of the child |
| 147504 | break; |
| 147505 | } |
| 147506 | consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); |
| 147507 | } |
| 147508 | if (!formattingScanner.isOnToken() || formattingScanner.getStartPos() >= originalRange.end) { |
| 147509 | return inheritedIndentation; |
| 147510 | } |
| 147511 | if (ts.isToken(child)) { |
| 147512 | // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules |
| 147513 | var tokenInfo = formattingScanner.readTokenInfo(child); |
| 147514 | // JSX text shouldn't affect indenting |
| 147515 | if (child.kind !== 11 /* SyntaxKind.JsxText */) { |
| 147516 | ts.Debug.assert(tokenInfo.token.end === child.end, "Token end is child end"); |
| 147517 | consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); |
| 147518 | return inheritedIndentation; |
| 147519 | } |
| 147520 | } |
| 147521 | var effectiveParentStartLine = child.kind === 165 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; |
| 147522 | var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); |
no test coverage detected