Skip to content

Commit 46aa8f5

Browse files
authored
fix: deprecate useHttpgd setting (#1733)
1 parent 17437a1 commit 46aa8f5

3 files changed

Lines changed: 36 additions & 8 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* feat: evaluate params from YAML header in Rmd files before running code
1616
* feat: check sess package version and prompt for update
1717
* feat(session): implement file-based reconnection and suppress verbose logs
18-
* feat(plot): new `r.plot.backend` enum setting for finer-grained control of the preferred plotting backend, including integration with the lightweight `jgd` graphics device (default if installed). `r.plot.useHttpgd` is still respected, but may be deprecated in a future release.
18+
* feat(plot): new `r.plot.backend` enum setting for finer-grained control of the preferred plotting backend, including integration with the lightweight `jgd` graphics device (default if installed). `r.plot.useHttpgd` is deprecated in favor of `r.plot.backend`; it remains supported for compatibility with existing configurations but will be removed in a future release.
1919
* feat(term): new `r.rterm.preferredConsoles` enum setting enables for string-based R console selection (`"R"` (default), `"arf"`, and/or `"radian"`), automatically resolved against the user's `PATH`. `r.term.<os>` is still respected (and prioritized) if provided.
2020
* feat(dataview): keep one viewer per data name, refreshing the existing viewer on repeated `View()` calls
2121
* feat(dataview): load data rows on demand while scrolling, with support for Arrow and Polars DataFrames

‎package.json‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,7 @@
17871787
},
17881788
"r.plot.devArgs": {
17891789
"type": "object",
1790-
"markdownDescription": "The supplementary arguments for the rendering device (e.g., `png()` or `svglite()`) used by the standard plot viewer. Note that width and height are now handled dynamically by the responsive viewer and will be overridden. Requires `#r.plot.useHttpgd#` to be set to `false`. \n\nChanges the option `sess.devArgs` in R.",
1790+
"markdownDescription": "Supplementary arguments for the rendering device (for example, `png()` or `svglite()`) used by the `standard` plot backend. This setting is ignored by the `httpgd` and `jgd` backends. Width and height are managed dynamically by the responsive viewer and will be overridden.\n\nChanges the option `sess.devArgs` in R.",
17911791
"default": {
17921792
"width": 800,
17931793
"height": 1200
@@ -1821,7 +1821,9 @@
18211821
"r.plot.useHttpgd": {
18221822
"type": "boolean",
18231823
"default": false,
1824-
"markdownDescription": "Use the httpgd-based plot viewer instead of the base VSCode-R plot viewer.\n\nRequires the `httpgd` R package version 1.2.0 or later.\n\n**Deprecated:** Use `#r.plot.backend#` instead. When `#r.plot.backend#` is `auto`, setting this to `true` forces httpgd."
1824+
"markdownDescription": "Legacy compatibility setting for selecting the httpgd plot viewer. When `#r.plot.backend#` is `auto`, setting this to `true` selects the `httpgd` backend. An explicit `#r.plot.backend#` value takes precedence.\n\nRequires the `httpgd` R package version 1.2.0 or later.",
1825+
"markdownDeprecationMessage": "Deprecated: use `#r.plot.backend#` instead. This setting is retained for compatibility with existing configurations but will be removed in a future release.",
1826+
"deprecationMessage": "Deprecated: use r.plot.backend instead. This setting is retained for compatibility with existing configurations but will be removed in a future release."
18251827
},
18261828
"r.plot.backend": {
18271829
"type": "string",
@@ -1833,12 +1835,12 @@
18331835
"jgd"
18341836
],
18351837
"markdownEnumDescriptions": [
1836-
"Automatic: tries JGD first (if installed), then httpgd, then standard. Respects `#r.plot.useHttpgd#` if set.",
1838+
"Automatic: tries JGD first (if installed), then httpgd, then standard. Existing `#r.plot.useHttpgd#` configurations remain supported.",
18371839
"Standard static plot viewer (PNG/SVG)",
18381840
"httpgd-based interactive plot viewer (requires `httpgd` R package)",
18391841
"JGD-based interactive plot viewer (requires `jgd` R package)"
18401842
],
1841-
"markdownDescription": "Select the plot backend.\n\nWhen set to `auto`, the best available backend is used (JGD if installed, then httpgd, then standard). Setting `#r.plot.useHttpgd#` to `true` forces httpgd."
1843+
"markdownDescription": "The canonical setting for selecting the plot backend.\n\nWhen set to `auto`, the best available backend is used (JGD if installed, then httpgd, then standard). For compatibility, setting `#r.plot.useHttpgd#` to `true` selects httpgd while this setting remains `auto`; an explicit backend value takes precedence."
18421844
},
18431845
"r.plot.jgd.historyLimit": {
18441846
"type": "number",
@@ -1867,7 +1869,7 @@
18671869
"png",
18681870
"svglite"
18691871
],
1870-
"description": "The graphics format to use for the standard plot viewer. Requires `#r.plot.useHttpgd#` to be set to `false`."
1872+
"markdownDescription": "The graphics format used by the `standard` plot backend. This setting is ignored by the `httpgd` and `jgd` backends."
18711873
},
18721874
"r.plot.defaults.colorTheme": {
18731875
"type": "string",

‎src/test/suite/terminal.test.ts‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ suite('R Terminal', () => {
2222
sandbox.restore();
2323
});
2424

25-
test('makeTerminalOptions sets session watcher environment variables', async () => {
26-
// Stub config to enable sessionWatcher with httpgd backend
25+
test('makeTerminalOptions respects legacy plot.useHttpgd configurations', async () => {
26+
// Leave plot.backend at its default to verify the legacy boolean still selects httpgd.
2727
const configStub = {
2828
get: (key: string, defaultValue?: unknown) => {
2929
if (key === 'sessionWatcher') {
@@ -57,6 +57,32 @@ suite('R Terminal', () => {
5757
assert.ok(options.env['R_PROFILE_USER'].endsWith(path.join('R', 'profile.R')));
5858
});
5959

60+
test('makeTerminalOptions prefers an explicit plot.backend over legacy plot.useHttpgd', async () => {
61+
const configStub = {
62+
get: (key: string, defaultValue?: unknown) => {
63+
if (key === 'sessionWatcher') {
64+
return true;
65+
}
66+
if (key === 'plot.backend') {
67+
return 'standard';
68+
}
69+
if (key === 'plot.useHttpgd') {
70+
return true;
71+
}
72+
return defaultValue;
73+
}
74+
};
75+
sandbox.stub(util, 'config').returns(configStub as unknown as vscode.WorkspaceConfiguration);
76+
sandbox.stub(util, 'getRterm').resolves(process.execPath);
77+
sandbox.stub(util, 'promptToInstallSessPackage').resolves();
78+
79+
const options = await rTerminal.makeTerminalOptions();
80+
81+
assert.ok(options.env);
82+
assert.strictEqual(options.env['SESS_USE_HTTPGD'], 'FALSE');
83+
assert.strictEqual(options.env['SESS_PLOT_BACKEND'], 'standard');
84+
});
85+
6086
test('makeTerminalOptions does not set session watcher env if disabled', async () => {
6187
const configStub = {
6288
get: (key: string) => {

0 commit comments

Comments
 (0)