Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help proxy error: R documentation fails to show #6151

Open
genec1 opened this issue Jan 29, 2025 · 8 comments
Open

Help proxy error: R documentation fails to show #6151

genec1 opened this issue Jan 29, 2025 · 8 comments
Labels
info needed Waiting on information

Comments

@genec1
Copy link

genec1 commented Jan 29, 2025

Type: Bug

When trying to get the documentation on a library function in R, I get
Error occurred while trying to proxy: 127.0.0.1:53201/library/DBI/html/dbConnect.html

VS Code version: Positron 1.95.0 (Universal) (bc8820b, 2025-01-09T23:29:00.471Z)
OS version: Darwin arm64 24.2.0
Modes:

System Info
Item Value
CPUs Apple M2 Max (12 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 6, 6, 6
Memory (System) 96.00GB (27.86GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (12)
Extension Author (truncated) Version
pyright ms- 1.1.392
debugpy ms- 2024.14.0
js-debug ms- 1.96.0
project-manager ale 12.8.0
ruff cha 2025.4.0
codeium Cod 1.30.18
python-environment-manager don 1.2.7
prettier-vscode esb 11.0.0
rainbow-csv mec 3.3.0
shiny Pos 1.1.0
shinyuieditor pos 0.5.0
ayu tea 1.0.3
@juliasilge juliasilge changed the title R documentation fails to show Help proxy error: R documentation fails to show Jan 29, 2025
@juliasilge
Copy link
Contributor

We have definitely had some challenges with the Help proxy in the past! Can you give us a bit more information? For example, does this happen to you every time you bring up Help? Or is it an intermittent problem?

If you can reproduce this (or to get us more information the next time you run into it), can you change the R kernel log level to trace:

Image

And then share the logs from the R Kernel if you see this error again? If you don't know where these logs are, you can find them by:

  • Bring up Command Palette
  • Search for "Output: Show output channels"
  • Choose the one for "R x.y.z: Kernel" where x.y.z is your version
  • Copy the entire log and paste it in or upload it as an attachment (.log file) to this issue

You are looking for what happens after a message like:

Sending frontend event ShowHelp with R url 'http://127.0.0.1:24910/library/DBI/html/dbConnect.html' and proxy url 'http://127.0.0.1:50958/library/DBI/html/dbConnect.html'

@juliasilge juliasilge added the info needed Waiting on information label Jan 29, 2025
@genec1
Copy link
Author

genec1 commented Jan 30, 2025

The issue is not replicating right now. I will report back if it does.

However, I am seeing this related issue:
If I type, for example, ? dbConnect in the Console, the R documentation comes up in the help panel. But if I right click on dbConnect() in my Rmd file, none of the help options work. They all report “No references found for ‘dbConnect’”

@juliasilge
Copy link
Contributor

@genec1 are you trying to bring up Help docs in the Help pane? I don't believe that right-clicking will do that (no Help in the context menu there). Instead I believe that F1 should bring up the Help pane with the correct content. Note that this currently uses your current R session, so you would need to do library(DBI) and then F1 on dbConnect() (similar to how ? behaves).

@genec1
Copy link
Author

genec1 commented Jan 30, 2025

I've found that the F1 popup help works in a .R file, but it does not work in a .Rmd file.

In a .Rmd file, the code interpreter is confused by back-ticks earlier in the code, in a separate code block.

I have these two code blocks:

# ```{r}
# ... some stuff
ggplot(all_strats_pl, aes(x=date)) +
	geom_line(aes(y= `5delta-600-SL`), col=1) +
	geom_line(aes(y= `15delta-600-SL`), col=2) +
	geom_line(aes(y= `ABC-3-2-LC`), col=3) +
	geom_line(aes(y= `ABC-3-2-LP`), col=4)

#```
#```{r}
con <- dbConnect(duckdb())
# ... some stuff
#```

(I put comments in front of the code block delimiters so that they would be visible in this post)

When I F1 on the dbConnect statement, an alert at the bottom of the screen says:
"No R help available for '), col=3) + geom_line(aes(y= '"

I was having the same issue trying to Ctrl-Return run single lines in the R code block. Ctrl-Returning on the dbConnect statement would enter lines from part of the ggplot statement above, including the code block end and start.

@juliasilge
Copy link
Contributor

I'm not able to reproduce the problem with F1 in an .Rmd with those two chunks in them. Can you create a shareable .Rmd where you see F1 not working and attach it as a file to this issue?

Alternatively, you can use this guide for how to include a Quarto/.Rmd file in a GitHub issue. That page has lots of helpful info on sharing a useful bug report for Quarto/.Rmd!

@genec1
Copy link
Author

genec1 commented Jan 30, 2025

It was hard to isolate the code section that caused the error. In the end, I needed a big chunk of code above the section where I am reproducing the error. I am attaching an Rmd file (re-named to a .txt file for the upload) where I can reproduce the error. The code probably won't run, since I've removed earlier code chunks.

If I hit F1 on dbConnect in the last code chunk I see the error:

Image

posit_help_error.txt

@juliasilge
Copy link
Contributor

Ah, you need to add a newline at the current line 23 of what you shared. We use Quarto as the engine for parsing .Rmd files and the type of syntax you had like this is not valid:

```r
# r code
```
# A new header that breaks the parsing
```r
# more R code
```

Instead you need this:

```r
# r code
```

# A new header that works fine
```r
# more R code
```

And to be even safer and avoid parsing problems in general, I would recommend this:


```r
# r code
```

# A new header that works fine

```r
# more R code
```

@genec1
Copy link
Author

genec1 commented Jan 30, 2025

Thanks Julia. Is that in the markdown specs or a peculiarity to the parser in posit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info needed Waiting on information
Projects
None yet
Development

No branches or pull requests

2 participants