REditorSupport / vscode-R

R Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=REditorSupport.r
MIT License
1.06k stars 125 forks source link

Help not shown when using session watcher #659

Open colinbousige opened 3 years ago

colinbousige commented 3 years ago

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):

ManuelHentschel commented 3 years ago

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).

colinbousige commented 3 years ago

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 !

ManuelHentschel commented 3 years ago

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?

colinbousige commented 3 years ago

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

ManuelHentschel commented 3 years ago

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?

colinbousige commented 3 years ago

"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!

ElianHugh commented 3 years ago

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

Yunuuuu commented 2 years ago

The same problems in ubuntu.

Yunuuuu commented 2 years ago

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.

py9mrg commented 2 years ago

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.

ifendo commented 1 year ago

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...

motorlearner commented 1 year ago

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.

gwd999 commented 1 year ago

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"?

shahnawaz323 commented 1 year ago

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

tetlabo commented 1 year ago

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

eitsupi commented 1 year ago

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

byryepez commented 1 year ago

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

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

mkoohafkan commented 11 months ago

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.

DavidASimao commented 3 months ago

A: LibPaths I had the same problem on Windows 11, I added the library path to R Lib Paths and it is working.

mqzhu04 commented 3 months ago

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

Hi, I had the same trouble in win11, and tried your suggestion above. It worked. Thank you!

8xiom commented 1 month ago

I also encountered the exact same problem on two different machines (PC Windows 10 Pro, Laptop Windows 11 Pro) with synced settings, though. I did try every suggestion in this thread and checked the entries specific to R and the R extension for VSC to no avail. The solution I stumbled across was extremly simple but, at least for me, not really understandable: I deleted the entry for r.rpath.windows! After doing this and restarting VSC everything worked as intended, help viewer from the panel, ?<search text> et cetera. Maybe this helps someone, too.

Remark: Of course I have the proper settings regarding R, namely R_HOME environment variable and R executable in the PATH (Windows, cf. above).