From d28ac5d8d958c9b7f254533ac2c1268d0a275119 Mon Sep 17 00:00:00 2001 From: robinlovelace Date: Thu, 30 Jul 2026 06:58:08 +0100 Subject: [PATCH 1/2] Enable httpgd plot viewer and session watcher in VS Code / Codespaces (Closes #134) --- .devcontainer/devcontainer.json | 5 +++++ minimal/Dockerfile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8461dd6..8458359 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,6 +3,11 @@ "image": "ghcr.io/geocompx/minimal:latest", "customizations": { "vscode": { + "settings": { + "r.sessionWatcher": true, + "r.plot.useHttpgd": true, + "r.bracketedPaste": true + }, "extensions": [ "REditorSupport.r", "quarto.quarto", diff --git a/minimal/Dockerfile b/minimal/Dockerfile index f566802..8533038 100644 --- a/minimal/Dockerfile +++ b/minimal/Dockerfile @@ -12,7 +12,7 @@ RUN apt-get update \ # Install only the essential geocompkg Imports (not Suggests) to keep the # image lean. The full geocompkg Suggests set (60+ packages) is available # via the `suggests` image or users can install on demand. -RUN R -e "if (!requireNamespace('pak', quietly = TRUE)) install.packages('pak', repos = 'https://cloud.r-project.org/'); pak::pak(c('sf','terra','spData','units','dplyr','languageserver','methods'), upgrade = FALSE)" +RUN R -e "if (!requireNamespace('pak', quietly = TRUE)) install.packages('pak', repos = 'https://cloud.r-project.org/'); pak::pak(c('sf','terra','spData','units','dplyr','languageserver','httpgd','methods'), upgrade = FALSE)" # Strip binary shared libraries from RSPM packages to reduce final image size # See https://github.com/rocker-org/rocker-versioned2/issues/340 From 1ca9b2c349001ca671fce576a670e9ae8b331f66 Mon Sep 17 00:00:00 2001 From: robinlovelace Date: Thu, 30 Jul 2026 07:03:50 +0100 Subject: [PATCH 2/2] Configure Rprofile.site to auto-activate httpgd in VS Code / Codespaces --- minimal/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/minimal/Dockerfile b/minimal/Dockerfile index 8533038..abc4de9 100644 --- a/minimal/Dockerfile +++ b/minimal/Dockerfile @@ -23,5 +23,14 @@ RUN echo '{' > /etc/rstudio/rstudio-prefs.json \ && echo ' "rmd_chunk_output_inline": false' >> /etc/rstudio/rstudio-prefs.json \ && echo '}' >> /etc/rstudio/rstudio-prefs.json +# Enable httpgd plot device automatically when running interactively in VS Code / Codespaces +RUN echo 'if (interactive() && (Sys.getenv("TERM_PROGRAM") == "vscode" || Sys.getenv("CODESPACES") == "true")) {' >> /usr/local/lib/R/etc/Rprofile.site \ + && echo ' if (requireNamespace("httpgd", quietly = TRUE)) {' >> /usr/local/lib/R/etc/Rprofile.site \ + && echo ' options(vsc.plot = FALSE)' >> /usr/local/lib/R/etc/Rprofile.site \ + && echo ' options(device = httpgd::hgd)' >> /usr/local/lib/R/etc/Rprofile.site \ + && echo ' }' >> /usr/local/lib/R/etc/Rprofile.site \ + && echo '}' >> /usr/local/lib/R/etc/Rprofile.site + # Clean up apt caches RUN rm -rf /var/lib/apt/lists/* +