Skip to content

Commit c394b17

Browse files
authored
Merge pull request #10 from Fred-Wu/plot-viewer-restore
Plot viewer restore
2 parents b966f68 + 82115d1 commit c394b17

20 files changed

Lines changed: 573 additions & 500 deletions

.github/workflows/release.yml

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ name: release
55

66
on:
77
push:
8-
tags: ["v*"]
8+
tags:
9+
- "v[0-9]*.[0-9]*.[0-9]*"
10+
- "Enhanced_v[0-9]*.[0-9]*.[0-9]*"
11+
12+
permissions:
13+
contents: write
914

1015
env:
1116
SCRIPT_DIR: ./.github/scripts
@@ -14,15 +19,15 @@ jobs:
1419
build:
1520
runs-on: ubuntu-latest
1621
steps:
17-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
1823
- run: node $SCRIPT_DIR/enableWebpack.js
1924
- run: npm install
2025
- uses: lannonbr/vsce-action@4.0.0
2126
with:
2227
args: "package"
2328
- name: Identify output file # can be retrieved as steps.filenames.outputs.file_out
2429
id: filenames
25-
run: echo "::set-output name=file_out::$(ls | grep "^.*\.vsix$" | head -1)"
30+
run: echo "file_out=$(find . -maxdepth 1 -name '*.vsix' -print -quit | sed 's#^\./##')" >> "$GITHUB_OUTPUT"
2631
- uses: actions/upload-artifact@v4
2732
with:
2833
name: ${{ steps.filenames.outputs.file_out }}
@@ -34,28 +39,62 @@ jobs:
3439
runs-on: ubuntu-latest
3540

3641
steps:
42+
- uses: actions/checkout@v4
3743
- name: Download artifacts
3844
uses: actions/download-artifact@v4.1.7
3945
with:
4046
path: "artifacts/"
4147
- name: Get version from tag
4248
id: get_version
43-
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\/v/}
49+
run: |
50+
tag="${GITHUB_REF_NAME}"
51+
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
52+
echo "version=${tag##*v}" >> "$GITHUB_OUTPUT"
53+
- name: Extract release notes from changelog
54+
run: |
55+
version="${{ steps.get_version.outputs.version }}"
56+
extract_section() {
57+
awk -v heading="$1" '
58+
/^##[[:space:]]+/ {
59+
current = $0
60+
sub(/^##[[:space:]]+/, "", current)
61+
sub(/[[:space:]]+-.*$/, "", current)
62+
if (current == heading) {
63+
in_section = 1
64+
next
65+
}
66+
if (in_section) {
67+
exit
68+
}
69+
}
70+
in_section { print }
71+
' CHANGELOG.md
72+
}
73+
extract_section "$version" > release-notes.md
74+
if ! grep -q '[^[:space:]]' release-notes.md; then
75+
extract_section "Unreleased" > release-notes.md
76+
fi
77+
if ! grep -q '[^[:space:]]' release-notes.md; then
78+
echo "::error::CHANGELOG.md does not contain a section for ${version} or Unreleased."
79+
exit 1
80+
fi
4481
- name: Create release
45-
uses: marvinpinto/action-automatic-releases@latest
46-
with:
47-
repo_token: ${{ secrets.GITHUB_TOKEN }}
48-
files: "artifacts/*/*"
49-
prerelease: false
50-
draft: false
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
run: |
85+
gh release create "${{ steps.get_version.outputs.tag }}" artifacts/*/* \
86+
--title "${{ steps.get_version.outputs.tag }}" \
87+
--notes-file release-notes.md \
88+
--verify-tag
5189
5290
5391
publish:
5492
name: Publish
93+
needs: release
5594
timeout-minutes: 30
5695
runs-on: ubuntu-latest
5796
steps:
58-
- uses: actions/checkout@v3
97+
- uses: actions/checkout@v4
5998
- run: node $SCRIPT_DIR/enableWebpack.js
6099
- run: npm install
61100
- name: Publish to Open VSX Registry

.markdownlint.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
"allowed_elements": [ "details", "summary", "br" ]
44
},
55
"line-length": false,
6+
"no-duplicate-heading": {
7+
"siblings_only": true
8+
},
69
"no-trailing-punctuation": false
7-
}
10+
}

CHANGELOG.md

Lines changed: 87 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,111 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Bug Fixes
6+
7+
* Fixed plot viewer restore for multiple R terminals. After an extension host restart, `R Plot: Show Viewers` now restores only the plot viewer for the currently attached R process.
8+
* Fixed httpgd plot routing for multiple attached R terminals. New plots now continue in the plot viewer that belongs to the focused terminal's R process.
9+
* Fixed direct plotting after plot viewer restore so new httpgd plots can reopen or update the attached session's viewer without first manually showing the viewer.
10+
11+
### Minor
12+
13+
* Added the attached R process ID to data viewer tab titles, including Live Share guest data viewers.
14+
* Updated the GitHub release workflow so versioned releases use the matching `CHANGELOG.md` section as the GitHub Release notes.
15+
16+
### Maintenance
17+
18+
* Removed confirmed unused TypeScript helpers, imports, and stale help viewer CRAN parsing code.
19+
* Removed the bundled npm `node` dependency so build scripts use the environment-provided Node.js runtime.
20+
* Removed the deprecated npm `crypto` shim; the extension uses Node.js' built-in `crypto` module.
21+
* Updated in-range development dependency lockfile entries while leaving `ag-grid-community` unchanged.
22+
* Tightened release tag handling to version-shaped tags and removed deprecated GitHub Actions `set-output` usage.
23+
324
## 3.0.6 - 2026-03-17
425

5-
* Removed "No text editor active." warning pop-up.
26+
### Bug Fixes
27+
28+
* Removed the "No text editor active." warning pop-up.
29+
* Reverted the `later`-based workspace scan change.
630

731
## 3.0.5 - 2026-01-04
832

9-
### Major
33+
### Features
1034

1135
* Added a UI button to refresh data viewer.
36+
* Added support for viewing `polars` data frames.
37+
* Added support for viewing environments in the data viewer.
38+
39+
### Bug Fixes
40+
41+
* Fixed data viewer refresh behavior.
42+
* Fixed data viewer rendering for environment objects.
43+
* Fixed completion after `$` for cases such as R6, R7, and packages where unavailable methods previously stopped completion results from appearing.
44+
* Fixed Live Share guest attach handling for httpgd plot servers.
1245

1346
### Minor
1447

1548
* Simplified data viewer loading overlay text.
16-
* Fixed completion trigger `$` that may not show anything, ie from R6 or R7. For a package like `torch`, if a method was not implemented, and resulted in an error, the completion would not suggest the method.
17-
* Fixed data viewer if an object is an environment.
1849

19-
## 3.0.2 - 2025-11-17
50+
## 3.0.4 - 2025-12-25
51+
52+
### Features
53+
54+
* Added one plot viewer per R session so multiple sessions no longer share a single plot panel.
55+
* Added a loading indicator and updated grid behavior in the data viewer.
56+
57+
### Bug Fixes
58+
59+
* Fixed Live Share startup and session sharing behavior.
60+
* Fixed cleanup of data viewers and httpgd plot viewers when workspace or server sharing is toggled.
61+
* Fixed disposal of open viewers after an extension restart when the R session is still running.
62+
* Fixed data viewer name display for single-column data.
2063

2164
### Minor
2265

23-
* Further improvements to R language service stoping mechanism to a Quarto document.
66+
* Improved data viewer grid configuration for large and complex data.
67+
* Stopped the R language server for temporary source files and stopped the help server after the help viewer is closed.
68+
69+
## 3.0.2 - 2025-11-17
70+
71+
### Bug Fixes
72+
73+
* Improved R language server shutdown for Quarto documents.
74+
* Fixed language server shutdown for untitled Quarto documents.
75+
* Included updates related to bracketed paste behavior on Windows.
76+
77+
## 3.0.1 - 2025-11-06
78+
79+
### Bug Fixes
2480

25-
## 3.0.1 - 2025-10-27
81+
* Fixed plot viewer panels not reopening after an R session is dropped and reattached.
2682

27-
### Major
83+
## 3.0.0 - 2025-10-27
2884

29-
* Added support for dynamic data loading in the Data Viewer.
85+
### Features
86+
87+
* Added a redesigned data viewer with server-side row loading for large data.
88+
* Added support for dynamic data loading in the data viewer.
89+
* Added data viewer filtering support, including date, boolean, `POSIXct`, and `POSIXlt` columns.
90+
* Added support for Arrow table data in the data viewer.
3091
* Added an option to launch the R terminal within the side editor area.
3192
* Updated language server behavior to start only when an R-related file is opened and shut down when all files are closed.
93+
* Updated the session status bar so it appears only when an R terminal is attached.
94+
95+
### Bug Fixes
96+
97+
* Fixed disappearing data viewer rows.
98+
* Fixed multiple data viewer request handling.
99+
* Fixed `dataview_table` behavior.
100+
101+
### Minor
102+
103+
* Improved R syntax highlighting.
104+
* Improved data viewer configuration for large and complex data.
105+
* Improved data viewer row number and filtered-column display.
106+
* Moved R and R Markdown syntax definitions to `vscode-R-syntax`.
107+
* Showed the R sidebar icon only when the extension is active.
108+
109+
See [CHANGELOG.old.md](https://github.com/REditorSupport/vscode-R/blob/master/CHANGELOG.old.md) for changes before v3.0.0.
32110

33111
<!-- generated by git-cliff -->

R/session/vsc.R

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ dataview_table <- local({
117117
metadata_only = FALSE, force = FALSE) {
118118

119119
if (!is.data.frame(data) && !is.matrix(data) &&
120-
!inherits(data, "ArrowTabular") &&
121-
!inherits(data, "polars_data_frame")) {
120+
!inherits(data, "ArrowTabular") &&
121+
!inherits(data, "polars_data_frame")) {
122122
stop("data must be a data frame, a matrix or an arrow table object.")
123123
}
124124

@@ -747,12 +747,55 @@ removeTaskCallback("vsc.plot")
747747
use_httpgd <- identical(getOption("vsc.use_httpgd", FALSE), TRUE)
748748
show_plot <- !identical(getOption("vsc.plot", "Two"), FALSE)
749749
if (use_httpgd && "httpgd" %in% .packages(all.available = TRUE)) {
750+
httpgd_plot_updated <- FALSE
751+
752+
is_httpgd_dev <- function() {
753+
names(dev.cur()) %in% c("httpgd", "unigd")
754+
}
755+
756+
request_httpgd <- function() {
757+
tryCatch({
758+
if (length(httpgd::hgd_details()) > 0) {
759+
.vsc$request("httpgd", url = httpgd::hgd_url())
760+
}
761+
}, error = message)
762+
}
763+
764+
new_httpgd_plot <- function(...) {
765+
if (is_httpgd_dev()) {
766+
httpgd_plot_updated <<- TRUE
767+
}
768+
}
769+
750770
options(device = function(...) {
751771
httpgd::hgd(
752772
silent = TRUE
753773
)
754-
.vsc$request("httpgd", url = httpgd::hgd_url())
774+
request_httpgd()
755775
})
776+
777+
update_httpgd_plot <- function(...) {
778+
tryCatch({
779+
if (httpgd_plot_updated && is_httpgd_dev()) {
780+
httpgd_plot_updated <<- FALSE
781+
request_httpgd()
782+
}
783+
}, error = message)
784+
TRUE
785+
}
786+
787+
setHook("plot.new", new_httpgd_plot, "replace")
788+
setHook("grid.newpage", new_httpgd_plot, "replace")
789+
790+
rebind(".External.graphics", function(...) {
791+
out <- .Primitive(".External.graphics")(...)
792+
if (is_httpgd_dev()) {
793+
httpgd_plot_updated <<- TRUE
794+
}
795+
out
796+
}, "base")
797+
798+
addTaskCallback(update_httpgd_plot, name = "vsc.plot")
756799
} else if (use_httpgd) {
757800
message("Install package `httpgd` to use vscode-R with httpgd!")
758801
} else if (show_plot) {

0 commit comments

Comments
 (0)