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

Feature request: Align FORM calls #83

Closed
ConjuringCoffee opened this issue Aug 2, 2023 · 3 comments
Closed

Feature request: Align FORM calls #83

ConjuringCoffee opened this issue Aug 2, 2023 · 3 comments
Assignees

Comments

@ConjuringCoffee
Copy link
Contributor

Hi Jörg-Michael, I'd like to request the automatic alignment of FORM calls. As much as I'd like to not work with forms, there's no escape from them in a legacy system... 😅

@jmgrassau
Copy link
Member

Hi ConjuringCoffee,

funny, actually, that this hasn't already been suggested (including during the Inner Source phase of the project). Maybe that's a good sign… but yes, this would be great to have!

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi ConjuringCoffee,

along with "Algin FORM declarations" (see #84), version 1.10.0 also offers the new cleanup rule "Align PERFORM parameters"! Again, I hope options allow to get the desired outcome; they are inspired by both "Align METHODS declarations" and "Align parameters and components". Defaults are:

image

These defaults will change …

FORM any_form.
  PERFORM any_subroutine_with_a_long_name USING lv_any_value 42 'ABCDEFGHIJKLMN' gc_any_constant '3.14159265'.

  PERFORM other_subr
    TABLES lt_any
    USING lt_any_table[] lv_other_table[].

  PERFORM third_subr IN PROGRAM any_program TABLES lt_any_table lt_other_table
          USING lv_other_value.

  PERFORM (lv_subr_name) IN PROGRAM other_program
  TABLES lr_table_ref->*
    <lt_other_table>
    USING if_any_interface=>co_any_constant
      lo_any_instance->mv_any_attribute
      CHANGING <ls_any_structure>-any_component IF FOUND.

  PERFORM (lv_subr_name)  IN PROGRAM (lv_program_name) IF  FOUND
    USING 100  200   300 400   500 600 700 800 " comment
       'abcde' 'fghij' 'klmno' 'pqrst'  'uwvxy'
      gc_any_constant gc_other_constant
   gc_third_constant gc_fourth_constant
    CHANGING lv_any_value lv_other_value.

  PERFORM lv_subr_index OF form_one form_two form_three form_four
   form_five form_six form_seven.

  " obsolete syntax:
  PERFORM
    subr_name(prog_name)
    IF FOUND
    TABLES lt_any USING
    lv_any_value CHANGING lv_other_value.
ENDFORM.

… into:

FORM any_form.
  PERFORM any_subroutine_with_a_long_name
    USING lv_any_value
          42
          'ABCDEFGHIJKLMN'
          gc_any_constant
          '3.14159265'.

  PERFORM other_subr TABLES lt_any
                     USING  lt_any_table[]
                            lv_other_table[].

  PERFORM third_subr IN PROGRAM any_program TABLES lt_any_table
                                                   lt_other_table
                                            USING  lv_other_value.

  PERFORM (lv_subr_name) IN PROGRAM other_program IF FOUND
    TABLES   lr_table_ref->*
             <lt_other_table>
    USING    if_any_interface=>co_any_constant
             lo_any_instance->mv_any_attribute
    CHANGING <ls_any_structure>-any_component.

  PERFORM (lv_subr_name) IN PROGRAM (lv_program_name) IF FOUND
    USING    100 200 300 400 500 600 700 800 " comment
             'abcde' 'fghij' 'klmno' 'pqrst' 'uwvxy' gc_any_constant gc_other_constant gc_third_constant
             gc_fourth_constant
    CHANGING lv_any_value lv_other_value.

  PERFORM lv_subr_index OF form_one
                           form_two
                           form_three
                           form_four
                           form_five
                           form_six
                           form_seven.

  " obsolete syntax:
  PERFORM subr_name(prog_name) IF FOUND TABLES   lt_any
                                        USING    lv_any_value
                                        CHANGING lv_other_value.
ENDFORM.

As you can see in the fifth example, my impression was that in some cases, you have so many parameters that putting each of them on a distinct line doesn't help readability anymore, hence the last option.

Kind regards,
Jörg-Michael

@ConjuringCoffee
Copy link
Contributor Author

Awesome, thank you!

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