* * 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. *
(n *ast.Node, options lsutil.FormatCodeSettings, sourceFile *ast.SourceFile)
| 86 | * to the initial indentation. |
| 87 | */ |
| 88 | func getOwnOrInheritedDelta(n *ast.Node, options lsutil.FormatCodeSettings, sourceFile *ast.SourceFile) int { |
| 89 | previousLine := -1 |
| 90 | var child *ast.Node |
| 91 | for n != nil { |
| 92 | line := scanner.GetECMALineOfPosition(sourceFile, withTokenStart(n, sourceFile).Pos()) |
| 93 | if previousLine != -1 && line != previousLine { |
| 94 | break |
| 95 | } |
| 96 | |
| 97 | if ShouldIndentChildNode(options, n, child, sourceFile) { |
| 98 | return options.IndentSize // !!! nil check??? |
| 99 | } |
| 100 | |
| 101 | previousLine = line |
| 102 | child = n |
| 103 | n = n.Parent |
| 104 | } |
| 105 | return 0 |
| 106 | } |
| 107 | |
| 108 | func rangeHasNoErrors(_ core.TextRange) bool { |
| 109 | return false |
no test coverage detected