Skip to content

Commit 02a735c

Browse files
authored
Merge pull request #290 from stefan-koch-sociomantic/safp
add --space_before_function_parameters
2 parents 87fd168 + 02ba813 commit 02a735c

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/dfmt/config.d

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ struct Config
4444
///
4545
OptionalBoolean dfmt_space_after_keywords;
4646
///
47+
OptionalBoolean dfmt_space_before_function_parameters;
48+
///
4749
OptionalBoolean dfmt_split_operator_at_line_end;
4850
///
4951
OptionalBoolean dfmt_selective_import_space;
@@ -72,6 +74,7 @@ struct Config
7274
dfmt_soft_max_line_length = 80;
7375
dfmt_space_after_cast = OptionalBoolean.t;
7476
dfmt_space_after_keywords = OptionalBoolean.t;
77+
dfmt_space_before_function_parameters = OptionalBoolean.f;
7578
dfmt_split_operator_at_line_end = OptionalBoolean.f;
7679
dfmt_selective_import_space = OptionalBoolean.t;
7780
dfmt_compact_labeled_statements = OptionalBoolean.t;

src/dfmt/formatter.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ private:
281281
{
282282
writeToken();
283283
if (index < tokens.length && (currentIs(tok!"identifier")
284+
|| ( ( isBasicType(peekBack().type) || peekBackIs(tok!"identifier") ) &&
285+
currentIs(tok!("(")) && config.dfmt_space_before_function_parameters)
284286
|| isBasicType(current.type) || currentIs(tok!"@") || currentIs(tok!"if")
285287
|| isNumberLiteral(tokens[index].type) || (inAsm
286288
&& peekBack2Is(tok!";") && currentIs(tok!"["))))

src/dfmt/main.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ else
4848
case "space_after_cast":
4949
optConfig.dfmt_space_after_cast = optVal;
5050
break;
51+
case "space_before_function_parameters":
52+
optConfig.dfmt_space_before_function_parameters = optVal;
53+
break;
5154
case "split_operator_at_line_end":
5255
optConfig.dfmt_split_operator_at_line_end = optVal;
5356
break;
@@ -80,6 +83,7 @@ else
8083
"outdent_attributes", &handleBooleans,
8184
"space_after_cast", &handleBooleans,
8285
"selective_import_space", &handleBooleans,
86+
"space_before_function_parameters", &handleBooleans,
8387
"split_operator_at_line_end", &handleBooleans,
8488
"compact_labeled_statements", &handleBooleans,
8589
"tab_width", &optConfig.tab_width,
@@ -271,6 +275,7 @@ Formatting Options:
271275
--max_line_length
272276
--outdent_attributes
273277
--space_after_cast
278+
--space_before_function_parameters
274279
--selective_import_space
275280
--split_operator_at_line_end
276281
--compact_labeled_statements

0 commit comments

Comments
 (0)