diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-08-30 15:59:57 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-08-30 15:59:57 -0400 |
| commit | 9090a2a09f119510f40c5385f3790cc6b6539abc (patch) | |
| tree | 06616ba7f497a1d14003413816b98c2e0e81bda3 /src/formatter/formatter.c | |
| parent | f38fa3389c881ef8341011c05d7b2435686068e7 (diff) | |
Arg formatting tweaks
Diffstat (limited to 'src/formatter/formatter.c')
| -rw-r--r-- | src/formatter/formatter.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c index addf8445..1719a294 100644 --- a/src/formatter/formatter.c +++ b/src/formatter/formatter.c @@ -774,14 +774,16 @@ Text_t format_code(ast_t *ast, Table_t comments, Text_t indent) { /*multiline*/ case FunctionCall: { if (inlined_fits) return inlined; DeclareMatch(call, ast, FunctionCall); - return Texts(fmt(call->fn, comments, indent), "(\n", indent, single_indent, - format_args(call->args, comments, indent), "\n", Texts(indent, single_indent), ")"); + Text_t args = format_args(call->args, comments, indent); + return Texts(fmt(call->fn, comments, indent), "(", args, + Text$has(args, Text("\n")) ? Texts("\n", indent) : EMPTY_TEXT, ")"); } /*multiline*/ case MethodCall: { if (inlined_fits) return inlined; DeclareMatch(call, ast, MethodCall); - return Texts(termify(call->self, comments, indent), ".", Text$from_str(call->name), "(\n", indent, - single_indent, format_args(call->args, comments, indent), "\n", Texts(indent, single_indent), ")"); + Text_t args = format_args(call->args, comments, indent); + return Texts(termify(call->self, comments, indent), ".", Text$from_str(call->name), "(", args, + Text$has(args, Text("\n")) ? Texts("\n", indent) : EMPTY_TEXT, ")"); } /*multiline*/ case DocTest: { DeclareMatch(test, ast, DocTest); |
