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

Function makeDraft

src/rmarkdown/draft.ts:103–110  ·  view source on GitHub ↗
(file: string, template: TemplateItem, cwd: string)

Source from the content-addressed store, hash-verified

101}
102
103async function makeDraft(file: string, template: TemplateItem, cwd: string): Promise<string | undefined> {
104 const fileString = ToRStringLiteral(file, '');
105 const cmd = `cat(normalizePath(rmarkdown::draft(file='${fileString}', template='${template.info.id}', package='${template.info.package}', edit=FALSE)))`;
106 return await executeRCommand(cmd, cwd, (e: Error) => {
107 void window.showErrorMessage(e.message);
108 return '';
109 });
110}
111
112export async function newDraft(): Promise<void> {
113 const cwd = getCurrentWorkspaceFolder()?.uri.fsPath ?? os.homedir();

Callers 1

newDraftFunction · 0.85

Calls 2

ToRStringLiteralFunction · 0.90
executeRCommandFunction · 0.90

Tested by

no test coverage detected