MCPcopy Index your code
hub / github.com/REditorSupport/vscode-R / launchTemplatePicker

Function launchTemplatePicker

src/rmarkdown/draft.ts:75–101  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

73}
74
75async 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
103async function makeDraft(file: string, template: TemplateItem, cwd: string): Promise<string | undefined> {
104 const fileString = ToRStringLiteral(file, '');

Callers 1

newDraftFunction · 0.85

Calls 2

getTemplateItemsFunction · 0.85
openExternalMethod · 0.80

Tested by

no test coverage detected