quarto-dev / quarto-dev/quarto

Rmd handling in Positron is broken when there is a triple backtick immediately followed by prose on the next line

Open
#493 17 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
645
Forks
62
Avg merge
17h 42m
Merged PRs (30d)
13

Description

See https://github.com/posit-dev/positron/issues/4155

Create an Rmd with the following in it


Lets say you have two variables `x` and `y` that both point to the same underlying data.

```{r}
x <- c(1, 2, 3)
y <- x
```
If you modify `y`, R will first copy the values of `x` to a new position, then point `y` to the new location and only after the copy modify `y`.

```{r}
x <- 1
```

Note the triple backticks immediately followed by If you on the next line (no newline between them). This seems to cause issues.

Place your cursor on x <- 1 and try to run that line with Cmd + Enter, it will instead send this massive block to the console (in Positron):


`
If you modify `y`, R will first copy the values of `x` to a new position, then point `y` to the new location and only after the copy modify `y`.

```{r}
x <- 1
```


Also notice how the highlighting is off here:

Screenshot 2024-07-25 at 3 46 36 PM

A triple backtick immediately followed by prose on the next line works fine in RStudio (and highlights fine) so I think it should be supported here too.

quarto check

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.2: OK
      Dart Sass version 1.55.0: OK
      Deno version 1.33.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.185
      Path: /Applications/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.2
      Path: /Users/davis/.pyenv/versions/3.12.2/bin/python3
      Jupyter: 5.7.2
      Kernels: ark, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources
      LibPaths:
        - /Users/davis/Library/R/arm64/4.4/library
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: 1.48
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction in this issue and the linked Positron issue #4155, using the Rmd example and the Cmd + Enter entry point. Compare the affected code-block highlighting and executed selection with the expected boundaries when prose follows a triple backtick; done means both highlighting and line execution handle that layout correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, r, typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.