Skip to content

Supporting more indention patterns #120

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

Merged
merged 10 commits into from
Aug 13, 2017

Conversation

lorenzwalthert
Copy link
Collaborator

See tests for examples. This closes #108.

@lorenzwalthert lorenzwalthert requested a review from krlmlr August 9, 2017 07:44
update the newline attribute according to lag_newlines after line breaks are definitively set.
indent on more operators such as logical, special and equal assignment.
This will create merge conflict with r-lib#119. Merge with strategy theirs.
@codecov
Copy link

codecov bot commented Aug 9, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@82ebd0c). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #120   +/-   ##
========================================
  Coverage          ?   88.6%           
========================================
  Files             ?      18           
  Lines             ?     676           
  Branches          ?       0           
========================================
  Hits              ?     599           
  Misses            ?      77           
  Partials          ?       0
Impacted Files Coverage Δ
R/token.R 0% <ø> (ø)
R/modify_pd.R 91.66% <100%> (ø)
R/relevel.R 100% <100%> (ø)
R/rules-spacing.R 94.59% <100%> (ø)
R/get_transformers.R 96.77% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82ebd0c...c37d8b9. Read the comment docs.

Copy link
Member

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good.

@@ -10,6 +10,7 @@ token <- tribble(
">=" , "logical" , "GE",
"!=" , "logical" , "NE",
"==" , "logical" , "EQ",
"=" , "assign_left" , "EQ_SUB",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between "EQ_SUB" and "EQ_ASSIGN"? (Just curious.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data_frame(a = 3))
# vs.
a = 3


nested(
function_call(with),
many
many
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks odd.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine, because the rule add_space_after_comma() was not checking for line break (which we need if we want to support raw indention) and this is the flat styling anyways. The token is now where it is in the in.R file.

@@ -130,7 +130,7 @@ test <- function() {
difficult(nested(
"function", call
),
with, more, args
with, more, args
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this looks like we should force the nested() call on a new line (#118).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this is flat styling. Maybe we should remove tests for it anyways when implementing #121.

R/modify_pd.R Outdated
#' (R/rules-line_break.R) but we need `newlines` to determine
#' whether or not to set `spaces` (R/rules-spacing.R), we have to update the
#' attribute. We cannot simply use `dplyr::lead(pd$lag_newlines)` since we would
#' loose information for the last token. `spaces` is left as is in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loose -> lose

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uups

@lorenzwalthert lorenzwalthert merged commit 08200b8 into r-lib:master Aug 13, 2017
@lorenzwalthert lorenzwalthert deleted the indent_op branch September 17, 2017 20:57
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 this pull request may close these issues.

Add indention support for multi-line method chaining in R6
2 participants