-
Notifications
You must be signed in to change notification settings - Fork 138
Closed
Labels
engineeringMaintenance, style, development processMaintenance, style, development process
Description
Many of VSCode-R's features use a background R process to perform tasks (e.g., help providers, previewing and knitting documents). We currently define the calls to R in-line, e.g.
const cmd = (
`knitr::opts_knit[['set']](root.dir = ${knitWorkingDirText});` +
`cat('${lim}', rmarkdown::render(` +
`'${filePath.replace(/\\/g, '/')}',` +
`output_format = rmarkdown::html_document(),` +
`output_file = '${outputFile.replace(/\\/g, '/')}',` +
`intermediates_dir = '${tmpDir().replace(/\\/g, '/')}'), '${lim}',` +
`sep='')`
);I think that long-term this could get hard to maintain. Also, it can be difficult to wrap your head around all the quoting!
Describe the solution you'd like
I think that it might be neater and easier to maintain if we instead stuck these calls in their own R files, and then sourced them. For instance:
cp.spawn(`R -f test.R`) We can use the commandArgs method to pass values to a given file. E.g.
# test.r
print(commandArgs(trailingOnly = TRUE))R --silent --slave --no-save -f test.r --args "arg1" "arg2" "arg3"
#> [1] "arg1" "arg2" "arg3"ManuelHentschel
Metadata
Metadata
Assignees
Labels
engineeringMaintenance, style, development processMaintenance, style, development process