Skip to content

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

Closed

Description

@stockbal

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

Activity

  1. changed the title [-]Alignement of VALUE Expressions with BASE[/-] [+]Alignement of VALUE Expressions with BASE/FOR[/+] on Oct 23, 2023
  2. changed the title [-]Alignement of VALUE Expressions with BASE/FOR[/-] [+]Bug/Request: Alignment of VALUE Expressions with BASE/FOR[/+] on Oct 27, 2023
  3. changed the title [-]Bug/Request: Alignment of VALUE Expressions with BASE/FOR[/-] [+]Bug/Request: Single line alignment of VALUE Expressions with BASE/FOR[/+] on Oct 27, 2023
  4. jmgrassau commented on Oct 28, 2023

    @jmgrassau
    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

  5. stockbal commented on Oct 30, 2023

    @stockbal
    ContributorAuthor

    Hi Jörg-Michael,

    a new option sounds good 😊.

    Kind regards,
    Ludwig

  6. self-assigned this
    on Jan 1, 2024
  7. jmgrassau commented on Jan 1, 2024

    @jmgrassau
    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

  8. stockbal commented on Jan 1, 2024

    @stockbal
    ContributorAuthor

    Hi Jörg-Michael,

    thanks a lot 😊👍🏻.

    Kind regards,
    Ludwig

  9. jmgrassau commented on Jan 5, 2024

    @jmgrassau
    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions