Skip to content

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

Open

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

Activity

  1. ThomasSoeiro commented on Sep 22, 2026

    @ThomasSoeiro
    Collaborator

    I can reproduce with vscode-r 3.0.0-rc.0.

  2. ThomasSoeiro commented on Sep 23, 2026

    @ThomasSoeiro
    Collaborator

    @eitsupi @Fred-Wu @grantmcdermott can you please add the "confirmed" tag?

  3. ThomasSoeiro commented on Sep 27, 2026

    @ThomasSoeiro
    Collaborator

    @eitsupi Is it covered by #472?

  4. renkun-ken commented on Oct 6, 2026

    @renkun-ken
    Member

    The shortcut collision is still present in current package.json: r.runCurrentChunk and r.runSourcewithEcho both bind Ctrl/Cmd+Shift+Enter under overlapping conditions for .R files. The source-with-echo binding occurs later, without a condition distinguishing whether the cursor is inside a chunk.

    This explains why the palette/CodeLens works while the shortcut sources the whole file. Keeping this open; the default keybindings need distinct shortcuts or chunk-aware conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions