REditorSupport / REditorSupport/vscode-R

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

Open
#1,714 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

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

Contributor guide

Open the contributing guide

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 by locating the command and keybinding definitions for “Run source with echo” and “Run current code chunk” in the vscode-R extension, then reproduce the Cmd-Shift-Enter behavior with an R file containing # %% chunks. Confirm whether the conflicting binding or chunk detection causes the whole file to run; done means the shortcut runs only the current chunk without breaking the other actions.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.