Closed ArmoredPony closed 1 year ago
The reason single-parameter calls are uncontrolled is that for consecutive calls, spaces must be kept between them, for eg.
p "12313" "12313131" { aaa = bbb }
Probably you just hope:
p{ a = 123 } "123131" "4665465"
But if we call function not with curly braces but parentheses, then there will be no space after function name, considering space_before_function_open_parenthesis
is false
. If I use parenthesis in consecutive calls then it would look like this: p(var) '123' '456'
which looks similar to p{a = 123} "123131" "4665465"
. Why curly braces should be treated differently than parentheses in terms of formatting?
their grammatical components are different, and this feature(space_before_function_open_parenthesis) was originally added by other contributor. If you want to implement this feature, you can think of a name
I decided to implement this feature before the 1.0.0 release
feature complete, option name is space_before_function_call_single_arg
I love how this feature works with tables, but I would gladly disable it when it comes to strings. In SpaceAnalyzer.cpp, I tried to implement this myself by catching curly brace at this else
branch with something like GetChildToken('{', t)
, however I appear to be not competent enough to comprehend your parser and implement my idea. Would you please consider reopening the request and splitting this feature into two: space_before_function_call_single_table
for tables and space_before_function_call_single_string
for strings?
if you want to develop this project, please see test2
, this will print lua syntax tree. And this feature has been completed space_before_function_call_single_arg=only_string
If
space_before_function_open_parenthesis
parameter is set tofalse
thenf (...)
call is formatted tof(...)
. But curly braces are always formatted with space:f {...}
. Would be nice to control this space presence with the same option or with a new one, likespace_before_function_open_braces
.