MCPcopy Create free account
hub / github.com/REditorSupport/vscode-R / getNextChunk

Function getNextChunk

src/rmarkdown/chunks.ts:191–205  ·  view source on GitHub ↗
(chunks: RMarkdownChunk[], line: number)

Source from the content-addressed store, hash-verified

189}
190
191function 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
208function _getChunks(): RMarkdownChunk[] {

Callers 4

runCurrentChunkAndMoveFunction · 0.85
runNextChunkFunction · 0.85
runBelowChunksFunction · 0.85
goToNextChunkFunction · 0.85

Calls 1

getCurrentChunkFunction · 0.85

Tested by

no test coverage detected