| 133 | } |
| 134 | |
| 135 | function nodeRange( |
| 136 | node: { range?: [number, number, number] | null }, |
| 137 | lineCounter: LineCounter, |
| 138 | yamlLineOffset: number |
| 139 | ): Range { |
| 140 | if (!node.range) { |
| 141 | return { start: { line: 0, col: 0 }, end: { line: 0, col: 0 } }; |
| 142 | } |
| 143 | const [start, end] = node.range; |
| 144 | const startPos = lineCounter.linePos(start); |
| 145 | const endPos = lineCounter.linePos(end); |
| 146 | return { |
| 147 | start: { line: startPos.line - 1 + yamlLineOffset, col: startPos.col - 1 }, |
| 148 | end: { line: endPos.line - 1 + yamlLineOffset, col: endPos.col - 1 }, |
| 149 | }; |
| 150 | } |