(chunks: RMarkdownChunk[], line: number)
| 189 | } |
| 190 | |
| 191 | function getNextChunk(chunks: RMarkdownChunk[], line: number): RMarkdownChunk | undefined { |
| 192 | const currentChunk = getCurrentChunk(chunks, line); |
| 193 | if (!currentChunk) { |
| 194 | return undefined; |
| 195 | } |
| 196 | if (currentChunk.id !== chunks.length) { |
| 197 | // When cursor is above the first 'chunk start line', the definition of the next chunk is the first chunk |
| 198 | const nextChunkId = line < currentChunk.startLine ? currentChunk.id : currentChunk.id + 1; |
| 199 | const nextChunk = chunks.find(i => i.id === nextChunkId); |
| 200 | return nextChunk; |
| 201 | } else { |
| 202 | return currentChunk; |
| 203 | } |
| 204 | |
| 205 | } |
| 206 | |
| 207 | // Helpers |
| 208 | function _getChunks(): RMarkdownChunk[] { |
no test coverage detected