Feature request: Split statements and indent additions
Hi, currently we have the rule "Align keywords with second word of first line" that has no options.
Starting point for all examples is this code:
READ TABLE lt_data
ASSIGNING FIELD-SYMBOL(<ls_data>) WITH KEY key1_id = lv_key_id1 keyfield2_id = lv_key2_id.
Result with the current rule:
READ TABLE lt_data
ASSIGNING FIELD-SYMBOL(<ls_data>) WITH KEY key1_id = lv_key_id1 keyfield2_id = lv_key2_id.
If the statement is not already split into two lines, the rule doesn't do anything.
What we'd like to request is a rule (or option for the existing rule) that can split statements like READ TABLE into separate lines, indenting the additional lines by a number of spaces (mostly 2). In the following examples also the rule "Align parameters and components" is active.
Target 1: Split the statement by every word and indent the words by a number of spaces.
READ TABLE lt_data
ASSIGNING FIELD-SYMBOL(<ls_data>)
WITH KEY key1_id = lv_key1_id
keyfield2_id = lv_key2_id.
Target 2: Another option could give a result like this (keeping the target in the same line, but creating additional lines for further "words"):
READ TABLE lt_data ASSIGNING FIELD-SYMBOL(<ls_data>)
WITH KEY key1_id = lv_key1_id
keyfield2_id = lv_key2_id.
Similar things could be done with LOOP statements.
Hi Stefan,
sorry for responding only now! I don't think there can easily be a generic rule (working on all sorts of different ABAP statements) for this, but rather, there should be a specific rule for each of those statements that can sometimes get very long (READ TABLE and LOOP definitely being good candidates). This way, it could be evaluated in each case, whether and where it makes sense to introduce (or even remove) line breaks, we could offer options to keep/create one-liners etc.
Sometimes, this could also involve reordering the clauses of the statement: the compiler accepts both "READ TABLE … WITH KEY … INTO …" and "READ TABLE … INTO … WITH KEY …", but it is certainly a good idea to put the result (INTO …) to the end.
Kind regards, Jörg-Michael