Skip to content

Support webR for R Interactive and language features on desktop and vscode.dev #2003

Backlog

Description

@renkun-ken

Implementation PRs

  • languageserver #905 adds the embedded message-based server, on top of the Wasm symbol fix in languageserver #903.
  • vscode-R #2004 adds the desktop language fallback, pinned runtime cache, and the shared language transport.
  • vscode-R #2005 adds the desktop R Interactive provider on top of Provide R language features through webR when native R is unavailable #2004.
  • vscode-R #2006 adds the browser entry point, Interactive notebooks, file import/export, and the browser language client on top of Add a managed webR provider to R Interactive #2005.
  • vscode-R #2007 makes bound Interactive inputs and notebook cells follow their execution session, including when an ordinary source file uses the opposite language-server runtime. Native sessions supply their R executable and library paths. The worker stays independent of the running computation; Share installed webR packages and attachment order with notebook language workers #2009 supplies its session’s package context.
  • vscode-R #2008 adds sortable tables, nested list navigation, full viewer panels and interactive HTML widgets to webR. The Gapminder Plotly example rendered 142 points across five traces, with working hover and zoom in desktop VS Code. Interactive table/list and Plotly controls were also exercised in Chromium running VS Code for the Web.
  • languageserver #907 cleans terminal overstrikes from help and lets embedded analysis follow the execution session’s installed packages and attachment order.
  • vscode-R #2009 shares verified read-only package images between each webR session and its language workers. Installing data.table makes it available in package and namespace completion; attaching it adds its unqualified exports.
  • vscode-R #2010 shows webR in the session tree, kernel button and status bar, explains the filesystem inside Interactive, and implements Open webR Session File…, file.edit() and a text help pager. Desktop /project is mounted from the host; the browser’s /workspace contains imported files. Session-local editors are tied to their owning generation.
  • vscode-R #2011 adds nine browser editor commands and a desktop/browser/native capability guide. An audit of the combined manifest covered 139 commands and 77 settings.
  • vscode-R #2012 adds portable .webrproj workspaces on top of Complete browser editor commands and document webR capabilities #2011. Opening a bundle shows its files in Explorer and starts or reconnects to webR Interactive in /project. Editor saves and completed R cells update the bundle, including desktop cells that finish after the editor closes.

Release dependency. The VSIX bundles the checksum-verified R-universe build of languageserver 0.3.22 containing the Wasm symbol fix from #903. The previous archive stopped being available when R-universe published a replacement. Before a Marketplace release, update the bundled package to a published Wasm build that exports the session-aware embedded API and remove the development R source overlay. vscode-R review and cold-start verification

Verified on the combined stack. In an isolated desktop installation of the VSIX, the Interactive status bar and kernel showed webR: Analysis smoke · idle. Installing data.table enabled namespace completion and attaching it enabled unqualified fread in the Interactive input. The input and executed-cell library() hovers returned clean documentation. The editor saved a change to /tmp/foo.R and the owning R session sourced it successfully. The final Chromium test used a locally hosted VS Code web workbench, where diagnostics toggled on the open buffer, session package completion stayed isolated across notebooks, and viewers, file editing and transcript reopening passed. The reviewed server also negotiates confirmation for project-level Rename in open documents and regroups unsaved buffers when workspace folders change. languageserver review response · Desktop and browser capability guide

Verification of the implementation. In Chrome on public vscode.dev (VS Code 1.148.0), the proposed extension code navigated between unsaved documents, reported spacing diagnostics and formatted a document. An R Interactive notebook ran source, selections and a Markdown chunk, displayed a PNG, and exported a file through a virtual workspace provider. The language worker answered while the execution worker was busy. Interrupting a loop retained live variables. Reopening a saved notebook restored the transcript and started a fresh R session. The test build was served from a temporary development-extension location. The PRs also include desktop and headless-browser regression tests.

Proposal

A user who opens an R script in desktop VS Code without R installed, or in browser-only VS Code on vscode.dev, should be able to navigate the code immediately and choose to run it. Use webR in two independent workers so that a long-running analysis leaves editing features responsive. This follows up on #1335.

Run code with R Interactive

Offer webR in the R Interactive provider picker before requiring an R or arf executable. Selecting it would route Run Selection, Run Source, and Run R Markdown Chunk to one stateful R session. Reuse the existing execution queue, transcript, and plot display. The session should support console output and conditions, input prompts, interruption, static plots, and reading or writing files relative to the selected project directory. Packages installed for the session would come from compatible Wasm builds. Interactive backend interface · Current provider picker

Runtime tests with webR 0.6.1 and R 4.6.0 read a CSV, fitted an lm(), and retrieved its coefficients in a later submission. Interrupting a loop preserved the model. Other tests answered a readline() prompt, generated a PNG, sourced a project helper, wrote a result to disk, and ran a grouped query with the Wasm build of data.table. Displaying the plot inside R Interactive and reconnecting after a window reload are integration milestones.

Provide language features for open documents

When r.lsp.enabled is on, use the configured native R installation if available. Otherwise, start languageserver in a dedicated webR worker on the first R document, including an untitled buffer. The user should get completion, hover, signature help, Outline, and Go to Definition without opening an Interactive session or receiving a native-R setup prompt.

  • Verified in VS Code. A temporary extension ran vscode-languageclient with webR 0.6.1 and languageserver 0.3.22 in VS Code 1.145.2 on macOS. Neither R nor Rscript was on the extension host’s PATH, though R was installed elsewhere. With double_it <- function(x) x * 2 in one unsaved editor, Go to Definition on double_it(8) in another opened the declaration. Completion, hover, signature help, Outline updates after an unsaved edit, document close, and shutdown also passed.
  • Verified in separate probes. The language server returned completion and signature help for stats::lm. Its providers found references, returned rename edits across two open documents, and produced semantic tokens. Direct calls to styler formatted an example, and a lintr rule reported the expected positions. The editor prototype had diagnostics and workspace indexing disabled. Project-wide references and rename across closed files would need workspace access and indexing.

Implementation and related work

  • vscode-R would download and cache a pinned runtime and package library on first use. The Interactive provider would use the session agent. The language client would send JSON-RPC messages to its own worker, preserving document URIs and incremental edits. Client startup
  • languageserver needs a supported message-based entry point and a Wasm task executor. The prototype reused the existing parser and request handlers and ran parse jobs serially. Rapid edits, stale requests, cancellation, and large documents need testing. JSON-RPC dispatch · Native worker scheduling
  • Upstream compatibility. Both languageserver and collections export stack_push and stack_pop with incompatible signatures. Loading collections first allowed the prototype to run. The upstream issue tracks the collision and its reproducer. REditorSupport/languageserver#902

VS Code for the Web (vscode.dev)

The browser version can provide both open-document language features and a stateful R session. It needs a browser extension entry point, a browser language client, and separate webR workers for editing and execution. Route virtual workspace files through vscode.workspace.fs and preserve their URIs for navigation and edits. Today's desktop session agent depends on Node processes and sockets. A browser-owned worker lives with its tab, so browser reload should restore any saved transcript and clearly identify a fresh R session. Native R/arf terminals and external Quarto/Pandoc rendering still require a native or remote host. VS Code web extensions · Discussion #1903

Verified on hosted vscode.dev. A temporary web extension loaded into the public VS Code 1.148.0 workbench in Chrome. A local HTTPS server served the extension and Wasm assets, and both R execution and language analysis ran in browser workers. Go to Definition jumped between two unsaved documents, completion, hover and signature help worked, and an edit updated Outline. The execution probe retained a variable, captured a 1008 × 1008 plot bitmap, and, using the hosted site's shared-memory console channel, interrupted a loop without losing that variable and answered readline(). On other hosts, the PostMessage fallback needs different UI for input and stopping. The language-client probe also exposed a late write during shutdown. webR communication channels

Acceptance on a machine without native R

  1. Open two unsaved R documents through ordinary vscode-R activation. Verify cross-document navigation and completion after an edit. Disabling r.lsp.enabled should skip the language worker.
  2. Select webR in R Interactive, run selections and a chunk against shared data, source a helper, and display a plot. Interrupt a long calculation, verify the data is still available, then reload the VS Code window and reconnect to the session.
  3. On hosted vscode.dev with no remote compute, open R documents from a virtual workspace, complete and navigate between them, run a selection with project data, and display a plot in the editor. Verify the runtime controls supported by the channel and the documented behavior after tab reload.

Activity

  1. changed the title [-]Use webR to provide R language features when native R is unavailable[/-] [+]Support webR for R Interactive sessions and language features without native R[/+] on Nov 28, 2026
  2. changed the title [-]Support webR for R Interactive sessions and language features without native R[/-] [+]Support webR for R Interactive and language features on desktop and vscode.dev[/+] on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions