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

Function shouldDisplayChunkOptions

src/rmarkdown/chunks.ts:53–67  ·  view source on GitHub ↗
(document: vscode.TextDocument, position: vscode.Position)

Source from the content-addressed store, hash-verified

51 return (!!text.match(/^#+\|/g));
52}
53export function shouldDisplayChunkOptions(document: vscode.TextDocument, position: vscode.Position) {
54 const line = document.lineAt(position).text;
55 const isRDoc = isRDocument(document);
56 const currentChunk = getCurrentChunk(getChunks(document), position.line);
57 const withinChunk = currentChunk && isWithinChunk(currentChunk, position.line);
58 if (!withinChunk) {
59 return false;
60 }
61
62 const isRChunk = isRDoc ?
63 true :
64 getChunkLanguage(document.lineAt(currentChunk?.startLine).text, isRDoc) === 'r';
65
66 return isRChunk && (isChunkStartLine(line, isRDoc) || isOptionComment(line));
67}
68
69export interface RMarkdownChunk {
70 id: number;

Callers 1

Calls 7

isRDocumentFunction · 0.85
getCurrentChunkFunction · 0.85
getChunksFunction · 0.85
isWithinChunkFunction · 0.85
getChunkLanguageFunction · 0.85
isChunkStartLineFunction · 0.85
isOptionCommentFunction · 0.85

Tested by

no test coverage detected