(cwd: string)
| 73 | } |
| 74 | |
| 75 | async function launchTemplatePicker(cwd: string): Promise<TemplateItem | undefined> { |
| 76 | const options: QuickPickOptions = { |
| 77 | matchOnDescription: true, |
| 78 | matchOnDetail: true, |
| 79 | canPickMany: false, |
| 80 | ignoreFocusOut: false, |
| 81 | placeHolder: '', |
| 82 | onDidSelectItem: undefined |
| 83 | }; |
| 84 | |
| 85 | const items = await getTemplateItems(cwd); |
| 86 | |
| 87 | if (items) { |
| 88 | if (items.length > 0) { |
| 89 | const selection = await window.showQuickPick<TemplateItem>(items, options); |
| 90 | return selection; |
| 91 | } else { |
| 92 | void window.showInformationMessage('No templates found. Would you like to browse the wiki page for R packages that provide R Markdown templates?', 'Yes', 'No') |
| 93 | .then((select: string | undefined) => { |
| 94 | if (select === 'Yes') { |
| 95 | void env.openExternal(Uri.parse('https://github.com/REditorSupport/vscode-R/wiki/R-Markdown#templates')); |
| 96 | } |
| 97 | }); |
| 98 | } |
| 99 | } |
| 100 | return undefined; |
| 101 | } |
| 102 | |
| 103 | async function makeDraft(file: string, template: TemplateItem, cwd: string): Promise<string | undefined> { |
| 104 | const fileString = ToRStringLiteral(file, ''); |
no test coverage detected