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

Function runAboveChunks

src/rmarkdown/chunks.ts:272–294  ·  view source on GitHub ↗
(chunks: RMarkdownChunk[] = _getChunks(),
    line: number = _getStartLine())

Source from the content-addressed store, hash-verified

270}
271
272export async function runAboveChunks(chunks: RMarkdownChunk[] = _getChunks(),
273 line: number = _getStartLine()): Promise<void> {
274 const currentChunk = getCurrentChunk(chunks, line);
275 const previousChunk = getPreviousChunk(chunks, line);
276 if (!currentChunk || !previousChunk) {
277 return;
278 }
279 const firstChunkId = 1;
280 const previousChunkId = previousChunk.id;
281
282 const codeRanges: vscode.Range[] = [];
283
284 // Only do something if current chunk is not the first chunk
285 if (currentChunk.id > 1) {
286 for (let i = firstChunkId; i <= previousChunkId; i++) {
287 const chunk = chunks.find(e => e.id === i);
288 if (chunk?.eval) {
289 codeRanges.push(chunk.codeRange);
290 }
291 }
292 await runChunksInTerm(codeRanges);
293 }
294}
295
296export async function runBelowChunks(chunks: RMarkdownChunk[] = _getChunks(),
297 line: number = _getStartLine()): Promise<void> {

Callers

nothing calls this directly

Calls 5

runChunksInTermFunction · 0.90
_getChunksFunction · 0.85
_getStartLineFunction · 0.85
getCurrentChunkFunction · 0.85
getPreviousChunkFunction · 0.85

Tested by

no test coverage detected