Skip to content

"Run source with echo" overrides "Run current code chunk" #1714

Description

@memeplex

Describe the bug

When the cursor is located inside a code chunk and I press Cmd-Shift-Enter the entire file is run.

For example:

Image

Sends:

r$> source("/Users/carlos/Desktop/scratch.R", encoding = "UTF-8", echo = TRUE)

r$> 5
[1] 5

r$> # %%
r$> a <- 1:3

r$> b <- 4:6

r$> outer(a, b)
     [,1] [,2] [,3]
[1,]    4    5    6
[2,]    8   10   12
[3,]   12   15   18

r$> # %%
r$> 2
[1] 2

To Reproduce

  • Create a code chunk with # %% ...
  • Run it using "Run current code chunk" from the command palette -> fine
  • Run it using code lens actions -> fine
  • Run it using C-S-Enter -> the entire file is run

Can you fix this issue by yourself? (We appreciate the help)

Yes, I need to remove the conflicting binding. But I guess that the intention here is to use the same shortcut for both and the problem is that chunk detection is failing.

(If applicable) Please attach setting.json

  "[r]": {"editor.tabSize": 2},
  "r.rterm.mac": "/Users/carlos/.venv/bin/radian",
  // https://github.com/REditorSupport/vscode-R/issues/809#issuecomment-935947010
  "r.bracketedPaste": true,
  "r.plot.useHttpgd": true,

Environment (please complete the following information):

  • OS: macOS Tahoe
  • VSCode Version: 1.125.1
  • R Version: 4.5.3
  • vscode-R version: 2.8.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions