Skip to content

Don't run chunks with eval = FALSE. Fixes #651#653

Merged
renkun-ken merged 1 commit intoREditorSupport:masterfrom
jolars:master
May 30, 2021
Merged

Don't run chunks with eval = FALSE. Fixes #651#653
renkun-ken merged 1 commit intoREditorSupport:masterfrom
jolars:master

Conversation

@jolars
Copy link
Copy Markdown
Contributor

@jolars jolars commented May 29, 2021

What problem did you solve?

When using the code lens actions in the extension, such as "Run Above", code chunks with eval = FALSE are evaluated although they probably should not be since they often contain pseudo-code or other things that are not intended to actually be run. The default behavior in R Studio, for instance, is not to run these code chunks. See #653 for more details.

The extension already collects information on the value of eval, so the fix is just to implement a few if-clauses to prevent evaluation when eval = FALSE. I purposely did not include actions runNextChunk, runPreviousChunk, runCurrentChunk, and runCurrentAndBelowChunks since I think they signal that the user explicitly wants the specific chunk to be run. This also conforms to the behavior in R Studio when using "Run Next Chunk" and "Run Current Chunk".

Screenshot

Peek 2021-05-29 22-00

@jolars jolars marked this pull request as ready for review May 29, 2021 20:06
Copy link
Copy Markdown
Member

@renkun-ken renkun-ken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks!

@renkun-ken renkun-ken merged commit 86e56c8 into REditorSupport:master May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants