vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

r.libPaths setting for renv-enabled projects not working

Open uhkeller opened this issue 1 year ago • 11 comments

Describe the bug The instructions given in the Wiki for installing languageserver in a separate minimal library and having vscode-R load it from there do not work for me. The r.libPaths setting seems to have no effect. I get the message

VSCode R Session Watcher requires jsonlite, rlang. Please install manually in order to use VSCode-R.

during R startup in projects using renv and can't send commands to R, use the help viewer, etc. When I use .libPaths() in the R session to point R to the standalone library manually, I can load languageserver and jsonlite without a problem.

To Reproduce Follow the steps outlined in the Wiki, then create an R terminal in a renv-enabled project. The error message appears and help viewer etc. do not work.

Can you fix this issue by yourself? (We appreciate the help)

No

(If applicable) Please attach setting.json

{
    "security.workspace.trust.untrustedFiles": "open",
    "editor.largeFileOptimizations": false,
    "editor.unicodeHighlight.ambiguousCharacters": false,
    "editor.unicodeHighlight.nonBasicASCII": false,
    "r.plot.useHttpgd": true,
    "editor.fontLigatures": true,
    "editor.fontFamily": "'CaskaydiaCove Nerd Font', Menlo, Monaco, 'Courier New', monospace",
    "files.autoSave": "afterDelay",
    "r.rterm.option": [
        "--restore",
        "--save"
    ],
    "typescript.suggest.paths": false,
    "javascript.suggest.paths": false,
    "workbench.startupEditor": "newUntitledFile",
    "r.rterm.mac": "/opt/homebrew/bin/radian",
    "editor.fontSize": 13,
    "terminal.integrated.fontSize": 13,
    "editor.minimap.enabled": false,
    "terminal.integrated.defaultLocation": "editor",
    "window.confirmBeforeClose": "keyboardOnly",
    "terminal.integrated.confirmOnExit": "hasChildProcesses",
    "editor.formatOnType": true,
    "editor.tabSize": 2,
    "editor.inlineSuggest.enabled": true,
    "codeium.enableConfig": {
        "*": true,
        "rmd": true,
        "plaintext": true
    },
    "diffEditor.ignoreTrimWhitespace": false,
    "gitblame.statusBarMessageFormat": "${author.name} (${commit.summary, 30}, ${time.ago})",
    "codeium.enableSearch": true,
    "editor.acceptSuggestionOnEnter": "off",
    "editor.accessibilitySupport": "off",
    "latex-workshop.latex.autoBuild.run": "never",
    "r.bracketedPaste": true,
    "r.libPaths": [
        "/Users/user/.R-pkgs-vscode/renv/library/R-4.3/aarch64-apple-darwin20"
    ]
}

(where /Users/user is my user folder)

Expected behavior languageserver should be loaded from the library specified in the r.libPaths setting, help viewer etc. should work.

Environment (please complete the following information):

  • OS: macOS 14.2.1
  • VSCode Version: 1.85.2
  • R Version: 4.3.2
  • vscode-R version: 2.8.2

Additional context Maybe additional settings have to be changed that are not mentioned in the Wiki? I read about "r.lsp.args": ["--vanilla"], which did not have any effect, and r.lsp.libPath, which does not seem to exist any more (and, unsurprisingly, also has no effect).

uhkeller avatar Jan 19 '24 17:01 uhkeller

I have the same issue. I have set r.libPaths to include a folder with languageserver and httpgd installed with renv but R doesn't pick this up and these paths aren't shown in R with .libPaths().

I am on Windows 10 22H2, R version 4.2.1, VSCode version 1.86.1, vscode-R version 2.8.2

I have R_LIBS_USER set in an environment variable that is shown with libPaths(). Will this have an effect? (I cannot remove this)

benmoon1 avatar Feb 09 '24 11:02 benmoon1

Same here. r.libPaths is not being recognized by the R session.

I've tried installing R using Homebrew and using rig and neither option works. I also tried creating a separate library directory for the libraries required by the extension as outlined in the wiki to no avail.

OS: macOS Sonoma 14.4.1 M1 MAX

VSCode R Extension v2.8.3

> R.version
               _
platform       aarch64-apple-darwin20
arch           aarch64
os             darwin20
system         aarch64, darwin20
status         Patched
major          4
minor          4.0
year           2024
month          05
day            03
svn rev        86521
language       R
version.string R version 4.4.0 Patched (2024-05-03 r86521)
nickname       Puppy Cup

wahalulu avatar May 08 '24 19:05 wahalulu

For completeness - the r.libPaths setting does not work on GNU/Linux either (Ubuntu 20.04 LTS, locally compiled R version 4.3.3). Contrary to the title of this Github issue, this setting is equally useful when one does not use renv. The only library path that shows up for .libPaths() is the equivalent of .Library.

Let me know if I can provide more information to get this setting working again.

tverbeke avatar Aug 16 '24 18:08 tverbeke