| 147194 | * to the initial indentation. |
| 147195 | */ |
| 147196 | function getOwnOrInheritedDelta(n, options, sourceFile) { |
| 147197 | var previousLine = -1 /* Constants.Unknown */; |
| 147198 | var child; |
| 147199 | while (n) { |
| 147200 | var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; |
| 147201 | if (previousLine !== -1 /* Constants.Unknown */ && line !== previousLine) { |
| 147202 | break; |
| 147203 | } |
| 147204 | if (formatting.SmartIndenter.shouldIndentChildNode(options, n, child, sourceFile)) { |
| 147205 | return options.indentSize; |
| 147206 | } |
| 147207 | previousLine = line; |
| 147208 | child = n; |
| 147209 | n = n.parent; |
| 147210 | } |
| 147211 | return 0; |
| 147212 | } |
| 147213 | function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, formatContext) { |
| 147214 | var range = { pos: node.pos, end: node.end }; |
| 147215 | return formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end, function (scanner) { return formatSpanWorker(range, node, initialIndentation, delta, scanner, formatContext, 1 /* FormattingRequestKind.FormatSelection */, function (_) { return false; }, // assume that node does not have any errors |