Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run current line or selection (Ctrl + Enter) does not execute properly if piped code is not formatted in specific way. #6248

Closed
3 of 4 tasks
m1kejay opened this issue Feb 17, 2020 · 6 comments · Fixed by #7409 or #7896
Assignees
Labels
Milestone

Comments

@m1kejay
Copy link

m1kejay commented Feb 17, 2020

System details

RStudio Edition : Desktop
RStudio Version : 1.3.820
OS Version      :  Windows 10 Pro
R Version       :  3.6.2

Steps to reproduce the problem

In an .rmd file, type the following inside an R chunk:

mtcars %>%
  filter(
    mpg > 20) %>%
  select(everything())

Place cursor on line three or four and hit ctrl+enter. R will only run from line three, which produces the following (expected) error: Error: unexpected ')' in " mpg > 20)".

The following code works as I expect:

mtcars %>%
  filter(
    mpg > 20
    ) %>%
  select(everything())

Placing cursor on line 3-5 and hitting ctrl+enter executes the entire pipe.

Describe the problem in detail

When code is formatted as in my first code example, R does not execute the entire pipe, but only from line 3/4 when my cursor is on line 3/4. However, if the code is formatted as in the second example, placing the cursor on line 3-5 and hitting ctrl+enter executes the whole pipe.

Describe the behavior you expected

I expect the entire pipe to be executed when placing the cursor on line 3/4 in first example.

@kevinushey
Copy link
Contributor

Other example from #7256:

library(tidyverse)

mpg %>% 
  mutate(
    x1 = "ok here") %>% 
  mutate(
    x2 = "not ok") # use Ctrl + Enter in this line

@R-Hannibal
Copy link

@m1kejay, thanks again for finding and reporting this issue.

We have a fix in place in our latest preview build (available HERE). If you get the chance will you let us know if the issue is resolved for you in that build?

@R-Hannibal R-Hannibal self-assigned this Aug 18, 2020
@m1kejay
Copy link
Author

m1kejay commented Aug 18, 2020

Hi @R-Hannibal, I've downloaded the latest preview build (1.4.720) and can confirm the above specific issue as I described is fixed. However, the following does not work:

mtcars %>%
  filter(
    mpg > 20) %>% select(everything())

If you place cursor on row 3 and hit ctrl+enter you get the following error:

Error: unexpected ')' in "    mpg > 20)"

@dfalty
Copy link

dfalty commented Sep 26, 2020

Same as @m1kejay, it looks like the previous reprex are fixed but the last one is not on version 1.4.874. Reopening

mtcars %>%
  filter(
    mpg > 20) %>% select(everything())

@mikebessuille
Copy link
Contributor

Kevin, if the fix for this case is clear, let's fix for 1.4. Otherwise, we should move to 1.5 due to where we are in the 1.4 release.

@melissa-barca
Copy link
Contributor

Verified both reprexes in 1.4.938

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