For the past few hours I've been searching R source code, manuals and fora to no avail.
Suppose I have a snippet called mysnippet in a R.snippets file that has not yet been refreshed.
snippet mysnippet
${1:var}("hello world")
note: snippets are not available until the save button is clicked (Tools > Global Options > Code > Edit Snippets > Save). This save button (I assume) inserts into, and reads the R.snippets file.
Question
Where can we learn about how snippets are processed internally, and in the R start-up process?
That is, where does snippets-related code live in the R source code or the R manual?
What I want to find out:
How does one programmatically execute or prepare a snippet?
One of the following would constitute a solution:
1.
Directly executing a snippet from file (without refreshing it) or snippet syntax with a call at the command line.
example: inserting snippet in the console
{code here?} ${1:var}("hello world")
#OR
{code here?} mysnippet
2
Programmatically refreshing the list of available snippets, without exiting RStudio.
Meaning, to programmatically hit the Tools > Global Options > Code > Edit Snippets > Save button.
A clue or the solution might be the process in the R startup process that does this
not a solution:
exiting and reopening R studio.