@@ -64,39 +64,50 @@ tidyverse_style <- function(scope = "tokens",
64
64
65
65
space_manipulators <- if (scope > = " spaces" ) {
66
66
lst(
67
- partial(indent_braces , indent_by = indent_by ),
68
- partial(indent_op , indent_by = indent_by ),
69
- partial(indent_eq_sub , indent_by = indent_by ),
70
- partial(indent_without_paren , indent_by = indent_by ),
71
-
67
+ indent_braces = partial(indent_braces , indent_by = indent_by ),
68
+ indent_op = partial(indent_op , indent_by = indent_by ),
69
+ indent_eq_sub = partial(indent_eq_sub , indent_by = indent_by ),
70
+ indent_without_paren = partial(indent_without_paren ,
71
+ indent_by = indent_by
72
+ ),
72
73
fix_quotes ,
73
74
remove_space_before_closing_paren ,
74
75
remove_space_before_opening_paren = if (strict ) remove_space_before_opening_paren ,
75
76
add_space_after_for_if_while ,
76
77
add_space_before_brace ,
77
78
remove_space_before_comma ,
78
- partial(
79
+ style_space_around_math_token = partial(
79
80
style_space_around_math_token , strict ,
80
81
math_token_spacing $ zero ,
81
82
math_token_spacing $ one
82
83
),
83
- partial(
84
+ style_space_around_tilde = partial(
84
85
style_space_around_token , strict = strict , tokens = " '~'" , level = 1L ),
85
- if (strict ) set_space_around_op else add_space_around_op ,
86
- if (strict ) set_space_after_comma else add_space_after_comma ,
86
+ spacing_around_op = if (strict ) {
87
+ set_space_around_op
88
+ }else {
89
+ add_space_around_op
90
+ },
91
+ spacing_around_comma = if (strict ) {
92
+ set_space_after_comma
93
+ } else {
94
+ add_space_after_comma
95
+ },
87
96
remove_space_after_opening_paren ,
88
97
remove_space_after_excl ,
89
98
set_space_after_bang_bang ,
90
99
remove_space_before_dollar ,
91
100
remove_space_after_fun_dec ,
92
101
remove_space_around_colons ,
93
- partial(
94
- start_comments_with_space ,
102
+ start_comments_with_space = partial(start_comments_with_space ,
95
103
force_one = start_comments_with_one_space
96
104
),
97
-
98
105
remove_space_after_unary_pm_nested ,
99
- if (strict ) set_space_before_comments else add_space_before_comments ,
106
+ spacing_before_comments = if (strict ) {
107
+ set_space_before_comments
108
+ } else {
109
+ add_space_before_comments
110
+ },
100
111
set_space_between_levels ,
101
112
set_space_between_eq_sub_and_comma
102
113
)
@@ -111,17 +122,20 @@ tidyverse_style <- function(scope = "tokens",
111
122
if (strict ) remove_line_break_before_round_closing_after_curly ,
112
123
remove_line_break_before_round_closing_fun_dec =
113
124
if (strict ) remove_line_break_before_round_closing_fun_dec ,
114
- partial(style_line_break_around_curly , strict ),
125
+ style_line_break_around_curly = partial(style_line_break_around_curly ,
126
+ strict
127
+ ),
115
128
set_line_break_after_opening_if_call_is_multi_line = if (strict )
116
129
partial(
117
130
set_line_break_after_opening_if_call_is_multi_line ,
118
131
except_token_after = " COMMENT" ,
119
132
except_text_before = c(" switch" , " ifelse" , " if_else" )
120
133
),
121
- set_line_break_before_closing_call = if (strict )
134
+ set_line_break_before_closing_call = if (strict ) {
122
135
partial(
123
136
set_line_break_before_closing_call , except_token_before = " COMMENT"
124
- ),
137
+ )
138
+ },
125
139
remove_line_break_in_empty_fun_call ,
126
140
add_line_break_after_pipe
127
141
)
0 commit comments