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

Support pipe operator in onTypeFormatting #430

Closed
renkun-ken opened this issue May 27, 2021 · 0 comments · Fixed by #431
Closed

Support pipe operator in onTypeFormatting #430

renkun-ken opened this issue May 27, 2021 · 0 comments · Fixed by #431

Comments

@renkun-ken
Copy link
Member

renkun-ken commented May 27, 2021

Currently, we use a trick of appending a zero to complete a partial expression so that it is made stylizable by styler.

However, this trick no longer applies to the newly introduced pipe syntax in R 4.1 where it is syntactically incorrect to pipe to anything other than an explicit function call.

Previously if we hit "enter" in the end of the following line

1:10 %>%

then onTypeFormating will format the following code

1:10 %>%
0

with proper indention, it becomes

1:10 %>%
  0

But the same does not work with

1:10 |>
0

as it is not accepted by the parser.

Now styler has supported pipe expressions via r-lib/styler#803.

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 a pull request may close this issue.

1 participant