Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- The httpgd plot backend now requires the `httpgd` R package version 2.0.1 or later. Older versions are treated as unavailable when choosing the plot backend. (#1855)

## 3.0.1 - 2026-09-28

- Bump version of both the extension and `sess` to `3.0.1` so users who installed an earlier `3.0.0` pre-release build of `sess` (before its connection protocol was finalized) are prompted to reinstall `sess`. (#1794)
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"R Markdown"
],
"engines": {
"vscode": "^1.94.0"
"vscode": "^1.98.2"
},
"activationEvents": [
"workspaceContains:**/*.{rproj,Rproj,r,R,rd,Rd,rmd,Rmd}",
Expand Down Expand Up @@ -2216,7 +2216,7 @@
"default": false,
"scope": "window",
"ignoreSync": true,
"markdownDescription": "Legacy compatibility setting for selecting the httpgd plot viewer. When `#r.plot.backend#` is `auto`, setting this to `true` selects the `httpgd` backend. Workspace settings take precedence over user settings. Within the same scope, an explicit `#r.plot.backend#` value takes precedence.\n\nRequires the `httpgd` R package version 1.2.0 or later.",
"markdownDescription": "Legacy compatibility setting for selecting the httpgd plot viewer. When `#r.plot.backend#` is `auto`, setting this to `true` selects the `httpgd` backend. Workspace settings take precedence over user settings. Within the same scope, an explicit `#r.plot.backend#` value takes precedence.\n\nRequires the `httpgd` R package version 2.0.1 or later.",
"markdownDeprecationMessage": "Deprecated: use `#r.plot.backend#` instead. This setting is retained for compatibility with existing configurations but will be removed in a future release.",
"deprecationMessage": "Deprecated: use r.plot.backend instead. This setting is retained for compatibility with existing configurations but will be removed in a future release."
},
Expand Down Expand Up @@ -2567,7 +2567,6 @@
"cheerio": "1.0.0-rc.12",
"ejs": "^3.1.10",
"highlight.js": "^11.11.1",
"httpgd": "0.1.6",
"js-yaml": "^4.3.2",
"vscode-languageclient": "^10.1.2",
"winreg": "^1.2.5"
Expand Down
87 changes: 0 additions & 87 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions sess/R/hooks.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ runtime_start <- function(use_rstudioapi = TRUE,
.sess_env$runtime_start_phase <- "plot"
has_jgd <- plot_backend %in% c("auto", "jgd") &&
nzchar(Sys.getenv("JGD_SOCKET")) && requireNamespace("jgd", quietly = TRUE)
# The built-in client requires the 2.x renderer schema, including descr.
has_httpgd <- plot_backend %in% c("auto", "httpgd") &&
requireNamespace("httpgd", quietly = TRUE)
requireNamespace("httpgd", quietly = TRUE) &&
package_version(getNamespaceVersion("httpgd")) >= "2.0.1"
selected_backend <- .select_plot_backend(plot_backend, has_httpgd, has_jgd)
if (selected_backend == "jgd") {
.runtime_set_option("device", function(...) {
Expand Down Expand Up @@ -270,9 +272,9 @@ runtime_start <- function(use_rstudioapi = TRUE,
"connection is available. Falling back to the standard plot ",
"viewer.", call. = FALSE)
} else if (plot_backend == "httpgd") {
warning("[sess] Plot backend \"httpgd\" was requested but the httpgd ",
"package is not installed. Falling back to the standard plot ",
"viewer. Install httpgd, or change the r.plot.backend setting.",
warning("[sess] Plot backend \"httpgd\" requires httpgd >= 2.0.1. ",
"Falling back to the standard plot viewer. ",
"Install or update httpgd, or change the r.plot.backend setting.",
call. = FALSE)
}
}
Expand Down
38 changes: 38 additions & 0 deletions sess/inst/tinytest/test-httpgd-version.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Exercise the real backend selection without installing old httpgd binaries.
local({
sess_env <- sess:::.sess_env
old_plot_path <- sess_env$latest_plot_path
sess_env$latest_plot_path <- tempfile(fileext = ".png")
on.exit({
sess:::runtime_stop()
unlink(sess_env$latest_plot_path)
sess_env$latest_plot_path <- old_plot_path
})

env <- new.env(parent = asNamespace("sess"))
start <- sess:::runtime_start
environment(start) <- env
env$requireNamespace <- function(package, ...) {
identical(package, "httpgd") && !is.null(version)
}
env$getNamespaceVersion <- function(package) version
versions <- list(NULL, "1.2.0", "2.0.0", "2.0.1", "2.1.4", "10.0.0")
supported <- c(FALSE, FALSE, FALSE, TRUE, TRUE, TRUE)
for (i in seq_along(versions)) {
version <- versions[[i]]
for (backend in c("auto", "httpgd")) {
warnings <- character()
withCallingHandlers(
start(use_rstudioapi = FALSE, plot_backend = backend),
warning = function(w) {
warnings <<- c(warnings, conditionMessage(w))
invokeRestart("muffleWarning")
}
)
expect_equal("sess.plot" %in% getTaskCallbackNames(), !supported[i])
expect_length(warnings, if (backend == "httpgd" && !supported[i]) 1L else 0L)
if (length(warnings)) expect_true(grepl("httpgd >= 2.0.1", warnings, fixed = TRUE))
sess:::runtime_stop()
}
}
})
2 changes: 1 addition & 1 deletion src/helpViewer/cran.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import * as cheerio from 'cheerio';
import { Package} from './packages';
import { getHttpText } from './http';
import { getHttpText } from '../http';

type ParseFunction = (html: string, baseUrl: string) => Package[];

Expand Down
2 changes: 1 addition & 1 deletion src/helpViewer/helpProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Memento, window } from 'vscode';
import * as cp from 'child_process';

import * as rHelp from '.';
import { getHttpText } from './http';
import { getHttpText } from '../http';
import { extensionContext } from '../extension';
import { catchAsError, config, DisposableProcess, getRLibPaths, spawn, spawnAsync } from '../util';

Expand Down
Loading
Loading