Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/Request: Single line alignment of VALUE Expressions with BASE/FOR #170

Closed
stockbal opened this issue Oct 23, 2023 · 5 comments
Closed
Assignees

Comments

@stockbal
Copy link
Contributor

stockbal commented Oct 23, 2023

Hi,

in an an earlier version - I think before 1.8.0 - small short VALUE expressions that used BASE or FOR were usually kept in one line. Now they are always put into 2 lines.

The following snippet:

result = VALUE #( BASE result ( NEW zcl_sat_os_subp_method_std( ) ) ).
result = VALUE #( BASE result ( comp = 4 ) ).
lt_cds_range = VALUE #( FOR cds IN io_node_helper->mt_cds_views ( sign = 'I' option = 'EQ' low = cds-name ) ).

... is formatted into this in the current version:

result = VALUE #( BASE result
                  ( NEW zcl_sat_os_subp_method_std( ) ) ).
result = VALUE #( BASE result
                  ( comp = 4 ) ).
lt_cds_range = VALUE #( FOR cds IN io_node_helper->mt_cds_views 
                        ( sign = 'I' option = 'EQ' low = cds-name ) ).

If this change is because of some clean code rule, I would like the option that such short assignment are kept in one line.
If it's a bug, then please fix it.

Thanks and Regards,
Ludwig

@stockbal stockbal changed the title Alignement of VALUE Expressions with BASE Alignement of VALUE Expressions with BASE/FOR Oct 23, 2023
@stockbal stockbal changed the title Alignement of VALUE Expressions with BASE/FOR Bug/Request: Alignment of VALUE Expressions with BASE/FOR Oct 27, 2023
@stockbal stockbal changed the title Bug/Request: Alignment of VALUE Expressions with BASE/FOR Bug/Request: Single line alignment of VALUE Expressions with BASE/FOR Oct 27, 2023
@jmgrassau
Copy link
Member

Hi Ludwig,

you're right, this was previously kept on one line, but unintentionally (see #154): the option "Table rows: Keep multiple components on single line" did more than it was meant to do. But I do see your point – maybe we just need a dedicated option for these cases…

Kind regards,
Jörg-Michael

@stockbal
Copy link
Contributor Author

Hi Jörg-Michael,

a new option sounds good 😊.

Kind regards,
Ludwig

@jmgrassau jmgrassau self-assigned this Jan 1, 2024
@jmgrassau
Copy link
Member

Hi Ludwig,

with the next release, you will find the following new option in the rule "Align parameters and components":

image

For "Never", you get:

image

For "Always" or "If maximum line length A is observed", the code on the left-hand side is preserved. This is then similar to the behavior before version 1.8.0, but a bit stricter, requiring line length A (default: 120 chars) to be observed instead of line length B (default: 160 chars).

Kind regards,
Jörg-Michael

@stockbal
Copy link
Contributor Author

stockbal commented Jan 1, 2024

Hi Jörg-Michael,

thanks a lot 😊👍🏻.

Kind regards,
Ludwig

@jmgrassau
Copy link
Member

Hi Ludwig,

thanks for opening this issue – the new option is now available with version 1.13.0, which was just released!

Kind regards,
Jörg-Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants