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

Help not shown when using session watcher

Open colinbousige opened this issue 3 years ago • 20 comments

Describe the bug When using the session watcher, R is not able to find the help files. Without the session watcher, I can see the help fine. Plotting and running View() work fine with the session watcher too as they open in a webview, the problem is with the help only.

To Reproduce I don't understand what is happening, because some times it works, sometimes it doesn't... but most of the time it doesn’t.

Expected behavior When running help(function) or ?function, it should show the help on this function in a webview panel, but right now it shows an error (see screenshot) Couldn't show help for path: /library/graphics/html/<function>.default.html

Screenshots Screenshot 2021-05-31 at 13 46 02

Do you want to fix by self? I could help if I knew what to do...

My setting.json

// R path for Mac OS X
"r.rterm.mac": "/Library/Frameworks/Python.framework/Versions/3.9/bin/radian",",

// R command line options (i.e: --vanilla)
"r.rterm.option": ["--no-save", "--no restore"],

// An optional encoding to pass to R when executing the file, i.e. 'source(FILE, encoding=ENCODING)'
"r.source.encoding": "UTF-8",

// Keeping focus when running
"r.source.focus": "editor",

// Use active terminal for all commands, rather than creating a new R terminal
"r.alwaysUseActiveTerminal": false,

// Use bracketed paste mode
"r.bracketedPaste": true,

// Enable R session watcher (experimental)
"r.sessionWatcher": true,

My .Rprofile:

options(vsc.plot = FALSE)
options(vsc.browser = "Beside")
options(vsc.viewer = "Beside")
options(vsc.page_viewer = "Beside")
options(vsc.view = "Beside")
options(vsc.helpPanel = "Beside")

Environment (please complete the following information):

  • OS: macOS 11.3
  • VSCode Version: Version: 1.56.2 (Universal) Commit: 054a9295330880ed74ceaedda236253b4f39a335
  • R Version: 4.1
  • vscode-R version: 1.6.8

colinbousige avatar May 31 '21 12:05 colinbousige

Thanks for reporting this. Does opening the help viewer using the commands in the sidebar work consistently or only sometimes as well? Do you have set r.rpath.mac to anything? If not, could you please check the R version that the help viewer uses (in the R sidebar click "Home", then "Packages" on the webview, then check the installation directory of the default packages).

ManuelHentschel avatar May 31 '21 14:05 ManuelHentschel

What is super weird is that the help and the R sidebar works in some project workspaces but not some others..

I had not set r.rpath.mac to anything. I tried setting it to /usr/local/bin/R but it didn’t do anything

In the workspace where the R sidebar works, I have this : Packages in /Library/Frameworks/R.framework/Versions/4.1/Resources/library

In my other workspace, clicking "Home" on the sidebar shows the popup error "Couldn't show help for path: doc/html/index.html"

Thanks for your help !

colinbousige avatar May 31 '21 14:05 colinbousige

What is super weird is that the help and the R sidebar works in some project workspaces but not some others..

Do you have anything else in your .Rprofile in those workspaces?

ManuelHentschel avatar May 31 '21 14:05 ManuelHentschel

I don’t have a local .Rprofile in any of these workspaces, just the global one in ~/

colinbousige avatar May 31 '21 14:05 colinbousige

That's weird, the .Rprofile (and R-related entries in .vscode/settings.json) should be the only files affecting the help viewer in different workspaces.

There's also the command "Clear Cached Index Files & Restart Help Server", does this do anything?

ManuelHentschel avatar May 31 '21 14:05 ManuelHentschel

"Clear Cached Index Files & Restart Help Server" doesn't do anything. I did some digging and it appears I just have this one workspace where the help doesn't work. I deleted the .RData file that was there (the only .something file in there), but still nothing When clicking on the "Help topics by package" button, it says "Help provider not available!" This is annoying but it concerns just this single workspace, so I can live with it... still, it's weird!

colinbousige avatar May 31 '21 15:05 colinbousige

I had the same thing with a bad R install on WSL - bad permissions meant that the slave R sessions couldn't be executed. Reinstalling fixed this, but permissions might be something to keep in mind

ElianHugh avatar Jun 01 '21 02:06 ElianHugh

The same problems in ubuntu.

Yunuuuu avatar Oct 08 '21 18:10 Yunuuuu

I didn't know whether this could help you, I have solved it by adding a argument in r.rterm.option for I used radian terminal ("--r-binary=/usr/lib/R/bin/R").

here is my vscode-server settings.json:

{
    "[r]": {
        "editor.rulers": [
            80 
        ],
        "editor.wordWrap": "bounded",
        "editor.wordSeparators": "`~!@#%$^&*()-=+[{]}\\|;:'\",<>/?",
        "rewrap.autoWrap.enabled": true,
        "rewrap.wrappingColumn": 80,
        "rewrap.doubleSentenceSpacing": true
    },
    "r.lsp.debug": true,
    "r.alwaysUseActiveTerminal": true,
    "r.bracketedPaste": true,
    "r.rpath.linux": "/usr/lib/R/bin/R",
    "r.rterm.linux": "/home/*****/.local/bin/radian",
    "r.rterm.option": [
        "--no-save",
        "--no-restore",
        "--r-binary=/usr/lib/R/bin/R",
        "--local-history"
    ],
    "r.plot.useHttpgd": true,
    "r.session.levelOfObjectDetail": "Detailed",
    "r.session.objectLengthLimit": 100,
    "r.session.viewers.viewColumn": {
        "plot": "Active",
        "viewer": "Active",
        "view": "Active",
        "helpPanel": "Active"
    }
}

It can work for me now.

Yunuuuu avatar Oct 08 '21 19:10 Yunuuuu

Hello all,

I am having a similar problem since I upgraded to R 4.2.1 (on Windows).

With session watcher enabled I get the "Couldn't show help path" error when using something like ?plot in the terminal. And all of the help features in the R pane return the same / similar path errors. If I disable session watcher, the pane features still don't work and I get nothing with ?plot.

I am using radian and it doesn't work whether I set the rterm option or not. .libPaths() returns the right system and user paths for the library. Clearing the cache doesn't work - seems to hang. Global .Rprofile.

The main difference for me is that it seems to affect all workspaces.

Any ideas? Maybe a permissions thing?

Edit: forgot to say - very similar to #752 as well, except I'm on standard vscode no vscodium.

Edit 2: I've also noticed that since the upgrade to R 4.2.1, none of the lintr functionality is working. Seems like maybe there's a permissions issue or something with R in the background? I tried adding R to path in environment variables, but nothing. I wonder if whatever they had in vscodium that caused the issue in #753 has now made its way to vscode?

Edit 3: I'm a complete moron. I forgot to update Rpath setting! Usually I don't as it sorts itself out automatically but the last R upgrade I had to set it (and Rterm option, the --binary=etc) for some reason to get everything working. I updated Rterm option this time, but forgot Rpath. Ignore me. FWIW, everything now works again without setting either Rterm option or Rpath. Not sure what about my R 4.2.0 installation caused the initial hiccup.

py9mrg avatar Jun 28 '22 08:06 py9mrg

I got similar error with R 4.2.1 but I am on Windows 10. I have already setup both R.path and R.term (Radian used for this one) but ?plot didn't show any help page. it worked well when I was using R4.1.2 with similar VSCcode setup, not sure what happened...

ifendo avatar Sep 19 '22 02:09 ifendo

Had the same problem as above, also R 4.2.1 on Windows 10, both R.path and R.term (not Radian) being set properly...also got the "couldn't show help path" error. What solved it for me was logging out of github in VSCode (I use it to sync settings). Then, everything worked, also after I logged in again. No idea why.

motorlearner avatar Sep 30 '22 16:09 motorlearner

I am witnessing same error (with help functionality) on Windows 11 (but not in WSL2 eg Ubuntu 20.04). I am usually using radian with R on WIN11. I tried switching to "normal" R (binary) path and turning off the R session watcher as mentioned above - but that did not fix it. Any other ideas? What is even more "interesting" is that VS Code Insider edition has no issues displaying the help - isn't that "strange"?

gwd999 avatar Oct 06 '22 00:10 gwd999

Same problem. Even I cannot view workspace. It shows only Help pages heading and no workspace heading. I have enabled session watcher and checked in settings.json as well but nothing happens

shahnawaz323 avatar Nov 04 '22 12:11 shahnawaz323

Hi, I'm changing Windows system-wide locale from Japanese to UTF-8, then help is appear with R.exe console. radian too.

cf: https://learn.microsoft.com/en-us/answers/questions/587680/where-can-i-find-34beta-use-unicode-utf-8-for-worl.html

tetlabo avatar Nov 05 '22 13:11 tetlabo

It may have something to do with the fact that Python (i.e. Radian) on Windows is not UTF-8.

eitsupi avatar Nov 05 '22 13:11 eitsupi

Rhelp_VSCode He there !. I solved the same issue by checking my environmental variables. The steps I followed:

  • I added the bin installation file (C:\R\R-4.1.3\bin in my case, or C:\Program Files\R\R-4.1.3\bin) to the path in my user environmental variables. If you have an admin account, then you have to add the bin folder to the system environmental variables.
  • Check if you can start a R console from any terminal by writing r.
  • If that is positive, then in the Rpath settings for the R extension in vscode write r, or in the settings.json: "r.rpath.windows":"r"
  • Restart vscode. Check if the help pages are working.

After and update, I have to change the R version. Hope this helps ! Cheers.

byryepez avatar Nov 11 '22 00:11 byryepez

I had this problem and it turned out I had a typo in r.rpath.windows but not r.rterm.windows (or maybe it was the other way around). So R console, plots, etc. worked fine, it was only the help section that was broken.

It might be helpful for the extension to provide documentation on the difference between these two paths. I don't really understand why we need to specify both since they point to the same executable.

mkoohafkan avatar Oct 05 '23 17:10 mkoohafkan