-
Notifications
You must be signed in to change notification settings - Fork 137
Description
Description
When using the R extension, I consistently receive these error messages:
-
Failed to get list of R functions. Make sure that jsonlite is installed and r.rpath.windows points to a valid R executable. -
R library paths: C:/R_libs/4.5 C:/Program Files/R/R-4.5.2/library Error: No method asJSON S3 class: NativeRoutineMap
The error occurs even when just selecting lines of code in the editor (without executing), suggesting it's triggered by autocomplete/hover features.
Environment
- OS: Windows 11 x64
- VS Code version: (1.107.1)
- vscode-R extension version: 2.8.6
- R version: 4.5.2 (2025-10-31 ucrt)
- jsonlite version: 2.0.0
- languageserver version: 0.3.16
Attempted fixes (none worked)
-
Added S3 method fix for
asJSON.NativeRoutineMapin:~/.RprofileRprofile.site(R's site profile)- OneDrive shared
.Rprofile
-
Set
R_PROFILE_USERas system environment variable -
Configured
r.lsp.args: ["--no-save", "--no-restore"] -
Reinstalled languageserver from GitHub (
remotes::install_github) -
Updated jsonlite to 2.0.0
Root cause hypothesis
The languageserver appears to run with --vanilla flag internally, which skips all profile files including Rprofile.site. This prevents any runtime fix from being applied before jsonlite encounters the NativeRoutineMap class.
Suggested fix
Either:
- Don't use
--vanillawhen spawning the languageserver R process, or - Add a built-in handler for
NativeRoutineMapclass in the extension/languageserver - Use
force = TRUEin jsonlite calls (similar to fix in PR Useforce=TRUEwhen viewing data.frame and list #1255)
Minimal reproducible example
The error occurs on any R file when the extension tries to provide autocomplete suggestions.