You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Aligning single parameters for functional calls #66
I am using the "Align parameters and components" rule with the following settings:
Typically we are allowing one parameter behind functional calls since that would keep it on one line. This keeps it nice and tidy for exporting parameters, but the issue arises when IMPORTING or CHANGING is involved. The rule is then enforcing this type of format which I'd be surprised if anyone wanted:
class->method( CHANGING
field = value ).
I would like to see it still kept on the one line:
class->method( CHANGING field = value ).
Is there a way to accomplish this with the current settings? Or can it be tweaked to allow for this? I wouldn't want to uncheck "put keywords on own line", because then that negatively affects the scenarios where there are multiple parameters.
Not sure here. We could of course turn the "…put keywords … on own line" into a selection, e.g. "Always / Only below the call / Never"; then the second option would 'allow' us to behave differently if we continue after the call.
Regarding the multi-line cases, we are not running into this since we're limiting to 1 parameter behind the call. However, if I was to use it for multiple lines and I had the "Put keywords on own line" setting on, I would assume I'd get this:
perfect, then the behavior for >1 parameter is as you would expect it, too. Unless someone explicitly wants >1 parameters cases to look different, we can close this for now!
Activity
jmgrassau commentedon Jun 25, 2023
Hi Josh,
good point – I completely agree that no-one would want …
That was easy to fix. However, what should be done if someone configures this:
Should the rule then continue after the keywords as well (ignoring the second setting) …
… or would you then rather expect …
… for cases that are not one-liners?
Not sure here. We could of course turn the "…put keywords … on own line" into a selection, e.g. "Always / Only below the call / Never"; then the second option would 'allow' us to behave differently if we continue after the call.
Kind regards,
Jörg-Michael
enhance AlignParametersRule for one-liners behind the call (SAP#66)
enhance AlignParametersRule for one-liners behind the call (#66)
jmgrassau commentedon Jun 26, 2023
Hi Josh,
version 1.4.1 was just released and should do the trick for one-liners. Keeping this open, though, to find a solution for multi-line cases as well.
Kind regards,
Jörg-Michael
jelliottp commentedon Jun 27, 2023
Thank you!
Regarding the multi-line cases, we are not running into this since we're limiting to 1 parameter behind the call. However, if I was to use it for multiple lines and I had the "Put keywords on own line" setting on, I would assume I'd get this:
I would like to hear from others though who are using the settings in this manner.
jmgrassau commentedon Jul 5, 2023
Hi Josh,
perfect, then the behavior for >1 parameter is as you would expect it, too. Unless someone explicitly wants >1 parameters cases to look different, we can close this for now!
Kind regards,
Jörg-Michael