posit-dev / positron

Positron, a next-generation data science IDE
Other
2.31k stars 68 forks source link

Rmd does not export symbols #3982

Closed artmg closed 1 month ago

artmg commented 1 month ago

Positron Version:

Positron Version: 2024.07.0 (Universal) build 21 Code - OSS Version: 1.90.0 Commit: 82b335e27545e804b7fd806db00477a6eb49951d Date: 2024-07-09T04:32:26.804Z Electron: 29.4.0 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Darwin arm64 23.5.0

Steps to reproduce the issue:

  1. Open an .Rmd RMarkdown file
  2. Move to a section in the document or to a function in a code cell
  3. Look where the breadcrumbs should be at the top
  4. Look in the Outline pane
  5. Use Cmd-Shift-O to open the Go to Symbol search bar

What did you expect to happen?

  1. Open a .R or a .md file and repeat the steps above

Were there any error messages in the output or Developer Tools console?

jmcphers commented 1 month ago

Do you also see this issue in VS Code with the Quarto extension installed, or is it specific to Positron?

See here for some more discussion and context: https://github.com/posit-dev/positron/issues/3824

juliasilge commented 1 month ago

Maybe for additional info, what is your OS? Seems like the other report of a missing outline was on Linux.

artmg commented 1 month ago

I appreciate your speedy responses. Apologies for not including the full version chunk, now in header, showing OS is macOS.

Using VS code instead

Feels like a step back, but let's hope it leads to two steps forwards 😄

code --version
code --install-extension REditorSupport.r
code --install-extension quarto.quarto

R
install.packages("languageserver")

with VS code version 1.91.0 ea1445cc7016315d0f5728f8e8b12a45dc0a7286 arm64 the .Rmd files are recognised as R Markdown and symbols work perfectly, thank you.

The difference is that the Rmd files have the ((R)) icon instead of the 4-cheese Quarto icon, if that helps diagnosis or fixing.

Please let me know if you'd like further diagnostic tests, or a version bump to retest. Thanks

artmg commented 1 month ago

PS: love the issue description for #1421 🤣

artmg commented 1 month ago

If I click the Quarto language setting on the status bar in my Positron version, sadly the R markdown (rmd) language configuration is not available. In plain old VS Code this appears to be delivered by the R extension, which I can't install in Positron because of the (obvious) conflicts. I'm afraid I may have to head back to the Studio for now!

juliasilge commented 1 month ago

Can you share what is in the YAML chunk at the top of your .Rmd? I notice when I have basic YAML like this, the outline is generated correctly, Cmd+Shift+O works correctly, etc:

rmd-outline

If I put something in the YAML there that arguably doesn't belong, then symbols are not exported correctly.

artmg commented 1 month ago

Thanks for the suggestion, Julia. I could not find any option in Positron to create a template .Rmd file, so I used RStudio to create...

---
title: "99 Test"
author: "ArtMG"
date: "2024-07-16"
output: html_document
---

'''{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
'''

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

Unlike your experience, I got no symbols and no breadcrumbs

image

juliasilge commented 1 month ago

Hmmmm, yep, I definitely see symbols in that situation:

Screenshot 2024-07-16 at 9 55 36 AM

Can you tell me if you see this in VS Code with only the Quarto extension installed and not the OSS R language support extension? We want VS Code to treat this is as a Quarto file and not an .Rmd file for comparison.

artmg commented 1 month ago

Well, even if I simply switch the language mode to from R Markdown to Quarto, then the symbols disappear already. That seems to put the issue squarely into Quarto's court. And just to double-check I removed the REditorSupport.r extension as you asked and also no symbols: image

In the meantime, to work around the issue, is there some way that I could select an alternative language support for R Markdown in Positron? or do I just have to use a different product until this Quarto issue is resolved?

Thanks for your prompt assistance

juliasilge commented 1 month ago

Yes, let's have you open an issue at the Quarto VS Code extension repo and I can chime in with what I see. Please do mention me so I get a notification.

Here is what I see in VS Code with the Quarto extension installed (but not the OSS R support extension):

Screenshot 2024-07-17 at 3 40 01 PM

For this document:

---
title: "A wonderful R Markdown document"
output:
  html_document:
    math_method: katex
---

```{r echo = FALSE}
knitr::opts_chunk$set(echo = TRUE)

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

Here is some math:

$1 + 1$

When you render this file, a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars) 

Including Plots

You can also embed plots, for example:

plot(pressure)

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.



It might help if you use the _exact_ same document and share what version of Quarto and the Quarto extension you have.
artmg commented 1 month ago

Raised as quarto-dev issue #488 as requested

juliasilge commented 1 month ago

Thank you! We will track at https://github.com/quarto-dev/quarto/issues/488.