Repository navigation
Provide R language features through webR when native R is unavailable - #2004
renkun-ken wants to merge 6 commits into
Conversation
eitsupi
left a comment
There was a problem hiding this comment.
Review by ChatGPT:
-
"src/webr/nodeRuntime.ts": The cache signature only includes file paths and sizes, so same-size file corruption goes undetected. Subsequent startup attempts would reuse the corrupted runtime. Please validate the cached file contents or provide a cache invalidation and recovery mechanism when runtime initialization fails, with a regression test.
-
"src/languageService.ts": "startWithRetry()" handles initial startup failures, but "CloseAction.DoNotRestart" leaves no recovery path after an initialized webR worker fails. Please provide a retry mechanism without requiring a window reload, similar to the browser implementation in #2006.
-
"r.lsp.runtime" has resource scope, but with "r.lsp.multiServer = false" (the default), the shared language server uses the first workspace folder's runtime preference. Please document this limitation or reconsider the configuration scope.
-
Loading R source files from an unmerged languageserver commit introduces availability and compatibility risks. Please replace this temporary mechanism with a published Wasm build providing "run_embedded()" before releasing the feature. This does not need to block merging this PR.
|
Thanks for the review. Commit 03dfb3a addresses the cache, retry and configuration findings.
Typechecking, bundling, formatting and lint passed, along with the focused cache tests and all 17 desktop initialization, cancellation and retry tests. |
|
An uncached browser run reproduced the availability concern in the review. After R-universe published the build containing the fix for languageserver #902, the previous Wasm archive started returning HTTP 404. Existing caches had masked the failure. f0b52b9 includes the official R-universe Wasm archive built from beef692 in the VSIX. Both extension hosts read its bytes from the installed extension and verify the pinned SHA-256. The new binary includes the symbol fix, so the previous package load-order workaround has been removed. The combined browser workbench suite passed from a fresh profile, including open-document navigation, changing diagnostics without reloading, installing and completing packages, viewers, and editing session files. The remaining release prerequisite is a published languageserver Wasm build exporting the session-aware |
Summary
When
r.lsp.enabledis on and the extension cannot resolve native R, open R documents receive language features from a dedicated webR worker.r.lsp.runtimecan also select native R or webR explicitly. Native sessions continue to use their configured R installation.The worker supplies completion, hover, signatures, cross-document navigation and rename for open buffers, Outline, semantic tokens, document formatting, syntax diagnostics and an in-process lint rule. The first use downloads a pinned runtime, package library and embedded server modules. Subsequent sessions reuse verified cached assets. No project text is sent to the package servers.
This is the base of the vscode-R stack for #2003. It uses the public Wasm binary with the matching embedded server sources pinned from languageserver #905, which builds on #903.
Verification