Skip to content

Open portable .webrproj bundles as webR Interactive workspaces - #2012

Open
renkun-ken wants to merge 4 commits into
codex/webr-browser-capabilitiesfrom
codex/webr-project-bundles
Open

renkun-ken wants to merge 4 commits into
codex/webr-browser-capabilitiesfrom
codex/webr-project-bundles

Conversation

@renkun-ken

@renkun-ken renkun-ken commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Stacked on #2011. Part of #2003.

Using a webR project

Choose R: New webR Project… to create a .webrproj, or open an existing bundle with File → Open File… or R: Open webR Project…. Its scripts and data become the Explorer workspace. R Interactive starts in /project or reconnects to the existing managed session. Running code and requesting language features from a project file use its owning webR session.

For example, save write.csv(mtcars, "cars.csv", row.names = FALSE) in fit.R and run the script. Both files travel with the bundle. Use saveRDS() to include an R object explicitly. Opening a portable copy on another machine can start a new worker.

Storage and recovery

  • The version-one ZIP contains manifest.json with {"format":1} and the project tree under files/. Archive validation checks paths, file types, expansion bounds and integrity before extraction.
  • Desktop and Remote workspace hosts mount a private checkout into the worker. An editor save commits its file, and the detached session agent checkpoints R writes when a cell settles, even after VS Code exits. The host coordinates writers across processes, checks the backing revision before replacement and retains working files for recovery on a conflict.
  • Browser workspaces open the same ZIP through workspace.fs. Web Locks coordinate cooperating tabs, and R changes are checked against simultaneous editor saves. Native browser file handles support saving without access to the parent directory. Other providers need write and rename support. Page reload restores saved files in a new worker.
  • The source file is identified before switching windows so the filesystem comes up independently of the R worker. When Workspace Trust is enabled, previously unknown bundles outside a trusted workspace require approval before their workspace settings become visible.

Workspace label, terminal and hover

The virtual-workspace indicator shows the bundle filename, retaining its spelling on desktop and browser reload. The full source/host digest still separates identically named bundles. Reopen an older standalone project from its .webrproj file to switch to the named workspace.

The generated VS Code workspace selects webR Project Terminal by default. It starts in /project and can also read and write worker-local files in /tmp and /home/web_user. Type help for its filesystem commands. On browser-only VS Code, Terminal → New Terminal opens the workbench profile picker; R: Open webR Project Terminal opens the target directly. The user's global terminal settings and the contents of the portable archive are independent of the generated workspace preferences.

The native Help index now skips webR project and session documents. With native R deliberately unavailable, lm, summary, par, and plot returned full webR documentation in the project editor, Interactive input, and executed cells without a native process or error notification. Ordinary native R source files retain Help panel links.

Verification

  • Installed the VSIX in isolated desktop profiles and opened the bundle through its default file association. Tested nested binary and text edits, owning-session language features, detached R writes after full application exit, same-session reconnection, creating a blank project, and opening the portable archive alone in another profile.
  • Exercised browser file opening, directory and standalone file handles, page reload, successful, failed and interrupted R cells, and concurrent saves from two real workbench tabs. The browser acceptance uses a locally hosted Chromium VS Code workbench.
  • Added regression coverage for the archive codec, workspace opener, desktop storage and agent lifecycle, and browser project flow. The user guide covers the format, portability limits and recovery.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant