Open KatlehoJordan opened 1 year ago
Who is the user in the container? This may be a matter of write permission to the directory.
Did you try the Dev Container Template provided by rocker-org? https://github.com/rocker-org/devcontainer-templates/tree/main/src/r-ver
It is the official R image hosted on Dockerhub.
I am quite sure that it is not a problem with which base image I am using, but rather something with how the image has been configured.
In earlier iterations wih the same base image rendering html
in the side view was working, but I did not commit the repo at that time and I've done lots of changes since so I'm not sure what is wrong with the current setup, 😢.
Yeah, this is not a base image issue but a Dev Container configuration issue. Therefore, I recommend using existing templates. And, I would recommend including a minimal reproducible example, not one that takes 20 minutes to build.
I agree with your sentiment! I do not like needing 20 minutes to build the container, but I have not found a Dockerfile
+ .devcontainer/devcontainer.json
template that includes this VS Code extension with all features working that is faster to build.
It seems that to get all of the VS Code features working one must install multiple dependencies, hence the long build time. But possibly I am doing it wrong!
Can you recommend a template Dockerfile that includes this VS Code extension with all features working?
The one you linked does not seem to include this extension, nor its dependencies, so I think to get that working would require signifcant modifications to the template and then the same long-build-time problem would arise.
Again, thank you for your feedback, 🙂
The one you linked does not seem to include this extension, nor its dependencies, so I think to get that working would require signifcant modifications to the template and then the same long-build-time problem would arise.
The template contains most of them. Please try it once.
I will try, thank you.
I link the devcontainer.json that I use to create the R package, since the R configurations are included in the base container, the user only needs to keep the non-R configuration. https://github.com/eitsupi/prqlr/blob/0f27151ee4a7511e1c1780345d30e3999e656718/.devcontainer/devcontainer.json
I have started working with the rocker template you provided. So far so good. I have not finished the evaluation yet (have not yet tested plotting, shiny, R Markdown, and debugging), but will try to finish that later today.
In any case, I am closing this because we seem to agree that my problem is how I configured the Docker container... And not a bug in this extension.
Sorry for opening an issue with the wrong label, and thank you for your guidance!
Update:
Even with the linked rocker
container, the RMarkdown knitting to html
is not working. The same behavior is observed.
I do believe that some days ago I was able to render the previews to the side and knit with the GUI provided by the extension, but since I cannot replicate there's a chance my memory is wrong.
If my memory is correct though, then it seems I've changed something in my machine that has led to this problem, but I'm not sure what. Commenting out my entire settings.json
file does not resolve the problem, so I do not think it's a VS Code problem but rather a system-wide problem.
I found the problem!
The extension does not escape characters when generating the path that is used to knit to HTML.
If the path of the .Rmd
file contains whitespace, for example, it seems to fail.
Observe this log from when a friend tried it recently:
[VSC-R] explore Rmd.Rmd process started
==> rmarkdown::render('/workspaces/jobSearch/KJ's suggestions/Assignments/Assignment 05/brave new world in R with Docker/explore Rmd.Rmd', output_format = 'html_document')
The '
in KJ's suggestions
and the whitespaces used throughout are never escaped.
Conversely, running the following command (escaping those characters with \
) from an R terminal works:
rmarkdown::render('/workspaces/jobSearch/KJ\'s\ suggestions/Assignments/Assignment\ 05/brave\ new\ world\ in\ R\ with\ Docker/explore\ Rmd.Rmd', output_format = 'html_document')
I will reopen the issue to catch the attention of the developers since I think I've pointed towards a fix.
Thank you @KatlehoJordan for looking into this! I should have some spare time in the coming days to work on a fix :)
So, as per your comment, further escaping of the path string is needed here: https://github.com/REditorSupport/vscode-R/blob/dc5be834db12ffd6f52650620e8547d358a30e77/src/rmarkdown/knit.ts#L259
OK, so a very simple fix is to replace '
with \\'
(which does fix this issue*, thank you!) but this doesn't cover all issues with path names. I'll have to take a closer look at util.ToRStringLiteral
as it's gobbling up quotes in the path name as well
This issue is stale because it has been open for 365 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
I have this issue also with word_document target.
I've had setting "r.rpath.windows" in settings.json pointing to an old non existing R installation. After correcting this setting kniting is again working O.K.
Describe the bug
I have built a VS Code Dev Container for a colleague to explore R in VS Code in order to convince them to replace RStudio. Within the Dev Container, when I use the commands to knit a
.Rmd
file to.html
or to preview the html in another pane, an information window appears that the document is being knit, but it never advances past 0%. See the screenshots.To Reproduce
Dockerfile
; provided below.devcontainer/devcontainer.json
; provided belowdependencies.R
; provided belowexplore Rmd.Rmd
; provided belowcode <path to directory with files>
explore Rmd.Rmd
within the Dev Containerctrl
/cmd
+shift
+p
-> 'R: knit Rmd to HTML')ctrl
/cmd
+shift
+p
-> 'R Markdown: Open Preview')Can you fix this issue by yourself? (We appreciate the help)
I would like to try to help, but am unsure how to proceed, 😦
Files for reproducing
Dockerfile
.devcontainer/devcontainer.json
dependencies.R
explore Rmd.Rmd