Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 0744476

Browse files
authored
Update the R definition according to the extension update (#1007)
* update the R container definition * update the R test-project
1 parent 602e850 commit 0744476

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
lines changed

containers/r/.devcontainer/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# R version: latest, ... , 4.0.3
2-
ARG VARIANT="latest"
1+
# R version: 4, 4.1, 4.0
2+
ARG VARIANT="4"
33
FROM rocker/r-ver:${VARIANT}
44

55
# Use the [Option] comment to specify true/false arguments that should appear in VS Code UX
@@ -32,10 +32,12 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
3232
httpgd \
3333
&& rm -rf /tmp/downloaded_packages
3434

35+
# VSCode R Debugger dependency, install the latest release version from GitHub.
36+
RUN Rscript -e 'remotes::install_github("ManuelHentschel/vscDebugger@*release", dependencies = FALSE)'
37+
3538
# R Session watcher settings.
3639
# See more details: https://github.com/REditorSupport/vscode-R/wiki/R-Session-watcher
37-
RUN echo 'source(file.path(Sys.getenv("HOME"), ".vscode-R", "init.R"))' >> ${R_HOME}/etc/Rprofile.site \
38-
&& echo 'options(vsc.use_httpgd = TRUE)' >> ${R_HOME}/etc/Rprofile.site
40+
RUN echo 'source(file.path(Sys.getenv("HOME"), ".vscode-R", "init.R"))' >> ${R_HOME}/etc/Rprofile.site
3941

4042
# [Optional] Uncomment this section to install additional OS packages.
4143
# RUN apt-get update \

containers/r/.devcontainer/devcontainer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
"name": "R (Community)",
33
"build": {
44
"dockerfile": "Dockerfile",
5-
// Update VARIANT to pick a specific R version: latest, ... , 4.0.3
6-
"args": { "VARIANT": "latest" }
5+
// Update VARIANT to pick a specific R version: 4, 4.1, 4.0
6+
"args": { "VARIANT": "4" }
77
},
88

99
// Set *default* container specific settings.json values on container create.
1010
"settings": {
1111
"r.rterm.linux": "/usr/local/bin/radian",
1212
"r.bracketedPaste": true,
13+
"r.plot.useHttpgd": true,
1314
"[r]": {
1415
"editor.wordSeparators": "`~!@#%$^&*()-=+[{]}\\|;:'\",<>/?"
1516
},
@@ -23,7 +24,8 @@
2324

2425
// Add the IDs of extensions you want installed when the container is created.
2526
"extensions": [
26-
"ikuyadeu.r"
27+
"ikuyadeu.r",
28+
"rdebugger.r-debugger"
2729
],
2830

2931
// Use 'forwardPorts' to make a list of ports inside the container available locally.

containers/r/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ This definition includes some test code that will help you verify it is working
3535
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
3636
2. Clone this repository.
3737
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
38-
4. Select the `containers/R` folder.
39-
5. After the folder has opened in the container, you should see the R version printed in the terminal.
40-
6. Now open the `test-project/sample.R` and press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd> to run the script.
38+
4. Select the `containers/r` folder.
39+
5. Open the `test-project/hello.R` and press the "Run Source" icon displayed in the upper right (or <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd> key) to run the code.
40+
6. You should see "Hello, remote world!" in a terminal window after the program executes.
4141

4242
## License
4343

containers/r/test-project/hello.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
6+
say_hello <- function(name) {
7+
message(paste0("Hello, ", name, "!"))
8+
}
9+
10+
say_hello("remote world")

containers/r/test-project/sample.R

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)