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

`R: Open help for selection` fails for some functions

Open jolars opened this issue 3 years ago • 10 comments

Describe the bug

r.helpPanel.openForSelection (R: Open help for selection) sometimes fail to work although documentation-on-hovering does.

See the example below where I cannot use the command to open the documentation for glmnet::glmnet(), although the documentation shows when hovering (via the language server), and also opens up correctly when I execute ?glmnet. This also happens for instance with the function bag() from the caret package, so this is not a problem only with functions named exactly as the package. For the built-in function lm() and also for other functions such as ggplo2::geom_point() the command works fine.

help-shortcut-fail

To Reproduce Steps to reproduce the behavior:

  1. Open an .R file.
  2. Write the name of a function in the file.
  3. Highlight the function name and select R: Open help for selection from the command tool box.
  4. See error

Do you want to fix by self? (We hope your help!)

Yes, I'll take a look at it.

setting.json:

{
    "r.rterm.linux": <path-to-radian>,
    "r.sessionWatcher": true,
    "r.rmarkdown.codeLensCommands": [
        "r.runCurrentChunk",
        "r.runAboveChunks",
        "r.runAllChunks"
    ],
    "r.bracketedPaste": true
}

Expected behavior

I expected the documentation to open up.

Environment (please complete the following information):

  • OS: Linux
  • VSCode Version: 1.56.2
  • R Version: 4.0.5
  • vscode-R version: 1.6.8

jolars avatar Jun 04 '21 15:06 jolars

I cannot reproduce what you demonstrate in your screencast. Everything works well here. Not sure what caused this. @ManuelHentschel any idea?

renkun-ken avatar Jun 04 '21 15:06 renkun-ken

I had the same experience the other day. (Sorry I haven't reported it) At that time, the problem occurred with a package installed from a different repository than the one set as default.

eitsupi avatar Jun 04 '21 15:06 eitsupi

Does calling "Clear Cached Index Files & Restart Help Server" in the R sidebar do anything?

ManuelHentschel avatar Jun 04 '21 16:06 ManuelHentschel

Does calling "Clear Cached Index Files & Restart Help Server" in the R sidebar do anything?

In my case, this fixed the problem!

eitsupi avatar Jun 04 '21 16:06 eitsupi

Does calling "Clear Cached Index Files & Restart Help Server" in the R sidebar do anything?

Yup, this works for me too! Thanks!

jolars avatar Jun 04 '21 16:06 jolars

Glad to hear this worked. If you frequently run into this issue, you can set "r.helpPanel.cacheIndexFiles": "None" (we could also use this as default to avoid confusion, not sure how the performance of the the help viewer is for other users).

As a side note, usually you don't need to select the entire word you want to look up, having the cursor inside the word should be enough.

ManuelHentschel avatar Jun 04 '21 16:06 ManuelHentschel

@ManuelHentschel Maybe we could put a notice into the error message?

renkun-ken avatar Jun 05 '21 09:06 renkun-ken

It seems vscode-r don't update the help index for the newly installed packages. I have the same problem for the newly installed packages.

Yunuuuu avatar Oct 10 '21 02:10 Yunuuuu

@ManuelHentschel Is it possible to make the background help server more automatic to index the newly installed packages?

renkun-ken avatar Oct 10 '21 13:10 renkun-ken

I have this same issue. I suspect that this is linked to https://github.com/REditorSupport/vscode-R/issues/1096. When I install new packages, they do not appear in the "Help Topics by Package" list. I have some packages in that list, however, that are both created by myself and installed from CRAN/GitHub so it seems that this just stopped working at some point. I have tried all combinations of "r.helpPanel.cacheIndexFiles": "None"/"Global"/"Workspace" and none of them fix this issue. I even tried reinstalling vscode-r with no luck.

nathaneastwood avatar Jul 18 '22 10:07 nathaneastwood

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Jul 19 '23 02:07 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Aug 03 '23 01:08 github-actions[bot]