Repository navigation
Closed
Labels
bugregressionvisual markdownFor bugs related to the new visual editor mode added for RMarkdown docs in the 1.4 release.
Milestone
Description
System details
RStudio Edition : Desktop and Server
RStudio Version : 2022.11.0-daily+202
OS Version : MacOS 13, Ubuntu 20.04 via Chrome on MacOS 13
R Version : 4.2.1
Steps to reproduce the problem
- Create a new Quarto document.
- Switch to source mode.
- Paste in the contents of the file at https://github.com/hadley/r4ds/blob/c24e0b86920aba0b57c7ca314215c04716cd0f3c/iteration.qmd
- Switch to visual mode.
- Click on the first line in the first chunk,
#| results: "asis" - Cmd-Return
- The first bit of code is executed
- Note: the warning is expected because we didn't create the file being sourced, but that's not important.
> #| results: "asis"
> #| echo: false
> source("_common.R")
Warning: cannot open file '_common.R': No such file or directoryError in file(filename, "r", encoding = encoding) :
cannot open the connection
- Place the cursor at the end of the first header,
Iteration, and hit Return - Enter some text, e.g.
Now is the winter of our discontent. - Click on the first line in the first chunk,
#| results: "asis" - Cmd-Return
- The new text above is executed.
> Now is the winter of our discontent.
Error: unexpected symbol in "Now is"
- Click on the last line in the first chunk,
status("drafting") - Cmd-Return
- The line above it is executed.
> source("_common.R")
Warning: cannot open file '_common.R': No such file or directoryError in file(filename, "r", encoding = encoding) :
cannot open the connection
Describe the problem in detail
After a chunk's line of code is run and new lines are added, running a line of code tries to execute a line above it—even if that line is in the body of the text and not in the chunk.
I haven't been able to pinpoint a minimal example—whether it's the length of the file or something specific to the contents—which is why I'm using all ofiteration.qmd in the reprex.
Describe the behavior you expected
Cmd-Return should always run the current line. This works correctly in RStudio Desktop 2022.07.2+576 on MacOS 13.
- I have read the guide for submitting good bug reports.
- I have installed the latest version of RStudio, and confirmed that the issue still persists.
- If I am reporting an RStudio crash, I have included a diagnostics report.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
Metadata
Metadata
Assignees
Labels
bugregressionvisual markdownFor bugs related to the new visual editor mode added for RMarkdown docs in the 1.4 release.
Activity
ronblum commentedon Sep 23, 2022
Note: Switching to source mode and back resolves the issue temporarily, but once a new line is inserted again, the problem recurs.
kevinushey commentedon Sep 23, 2022
Also saw this warning in the JS console.
kevinushey commentedon Sep 23, 2022
It looks like the issue might be related to indented chunks (which live as part of a bulleted list)? I can reproduce fairly readily with a document like this:
jmcphers commentedon Sep 23, 2022
All the code execution happens in the source editor; the warning indicates that the code that aligns the source editor with the visual editor (which we do every time you execute code) isn't seeing a consistent view of the set of chunks. It is almost certainly responsible for the error.
hadley commentedon Sep 25, 2022
It just occurred to me that this setting might also add to the problem:
hadley commentedon Sep 26, 2022
FWIW this is making the visual editor almost unusable for me (and I can't switch back to the released version, because the data corruption there is a worse problem).
jonvanausdeln commentedon Sep 29, 2022
Verified on 2022.11.0-daily+228
Windows 11, Ubuntu 22.04
Tested with OP example and additional example from Kevin. Both work as expected. I also tried with a few other variations of those 2 examples.
hadley commentedon Oct 5, 2022
I'm still seeing this in 2022.11.0-daily+245 😞
12 remaining items
jmcphers commentedon Nov 9, 2022
Moved this to Test. @hadley fix should be in build 319 or newer if you want to try it out.
hadley commentedon Nov 9, 2022
DOWNLOADING NOW
hadley commentedon Nov 9, 2022
So far so good!
hadley commentedon Nov 10, 2022
Ok, I hit the problem again, but this time it was because I had accidentally created a corrupted code chunk that looked like this:
jonvanausdeln commentedon Nov 10, 2022
When I tried that corrupted chunk, it doesn't execute anything. The original example works.
hadley commentedon Nov 10, 2022
@jonvanausdeln you would need to put the corrupted chunk somewhere further down the document.
jonvanausdeln commentedon Nov 15, 2022
@kevinushey , should this be moved back to in-progress? Or should this corrupted chunk be broken out into a separate issue?
kevinushey commentedon Nov 15, 2022
I placed the issue back to in-progress. @jmcphers, do you have the bandwidth to take a look?
mikebessuille commentedon Nov 15, 2022
Is that new problem as critical to fix for Elsbeth? We are looking to move out anything that isn't absolutely critical at this point...
kevinushey commentedon Nov 15, 2022
@hadley is the existing fix "good enough" or are you still bumping into this on a regular basis?
hadley commentedon Nov 17, 2022
Oh yeah, this is working well for me, thanks!
mikebessuille commentedon Nov 17, 2022
@kevinushey @jonvanausdeln i feel like if we're going to fix part of this for Elsbeth, and defer the special case, it should be split into a separate issue.
jonvanausdeln commentedon Nov 17, 2022
I agree. I will create a new issue for the special case and close out this one as it resolves the main issue.