@@ -50,7 +50,7 @@ private enum Columns {
50
50
public String getDisplayName () { return "Align FORM declarations" ; }
51
51
52
52
@ Override
53
- public String getDescription () { return "Aligns ( obsolete) FORM declarations." ; }
53
+ public String getDescription () { return "Aligns obsolete subroutine declarations with FORM ." ; }
54
54
55
55
@ Override
56
56
public LocalDate getDateCreated () { return LocalDate .of (2023 , 10 , 31 ); }
@@ -60,32 +60,32 @@ private enum Columns {
60
60
61
61
@ Override
62
62
public String getExample () {
63
- return LINE_SEP + "FORM any_form USING iv_any_value TYPE string."
63
+ return LINE_SEP + "FORM any_subroutine USING iv_any_value TYPE string."
64
64
+ LINE_SEP
65
- + LINE_SEP + " \" any FORM implementation"
65
+ + LINE_SEP + " \" any subroutine implementation"
66
66
+ LINE_SEP + "ENDFORM."
67
67
+ LINE_SEP
68
68
+ LINE_SEP
69
- + LINE_SEP + "FORM other_form USING iv_any_value TYPE i iv_other_value TYPE string CHANGING cv_third_value TYPE i."
70
- + LINE_SEP + " \" other FORM implementation"
69
+ + LINE_SEP + "FORM other_subroutine USING iv_any_value TYPE i iv_other_value TYPE string CHANGING cv_third_value TYPE i."
70
+ + LINE_SEP + " \" other subroutine implementation"
71
71
+ LINE_SEP + "ENDFORM."
72
72
+ LINE_SEP
73
73
+ LINE_SEP
74
- + LINE_SEP + "FORM third_form_with_a_long_name TABLES it_any_table STRUCTURE ty_s_any_struc"
74
+ + LINE_SEP + "FORM third_subr_with_a_long_name TABLES it_any_table STRUCTURE ty_s_any_struc"
75
75
+ LINE_SEP + " it_other_table TYPE STANDARD TABLE it_third_table it_fourth_table TYPE ty_tt_any"
76
76
+ LINE_SEP + " CHANGING ct_table TYPE ty_tt_table cs_struc TYPE LINE OF ty_tt_any cs_other_struc LIKE cs_any"
77
77
+ LINE_SEP + " cs_third_struc LIKE LINE OF ct_table."
78
- + LINE_SEP + " \" third FORM implementation"
78
+ + LINE_SEP + " \" third subroutine implementation"
79
79
+ LINE_SEP + "ENDFORM."
80
80
+ LINE_SEP
81
81
+ LINE_SEP
82
- + LINE_SEP + "FORM fourth_form "
82
+ + LINE_SEP + "FORM fourth_subroutine "
83
83
+ LINE_SEP + " USING"
84
84
+ LINE_SEP + " VALUE(iv_any) TYPE string"
85
85
+ LINE_SEP + " iv_other TYPE REF TO object"
86
86
+ LINE_SEP + " RAISING"
87
87
+ LINE_SEP + " cx_any_exception RESUMABLE(cx_other_exception) cx_third_exception."
88
- + LINE_SEP + " \" fourth FORM implementation"
88
+ + LINE_SEP + " \" fourth subroutine implementation"
89
89
+ LINE_SEP + "ENDFORM." ;
90
90
}
91
91
@@ -120,7 +120,7 @@ protected boolean executeOn(Code code, Command command, int releaseRestriction)
120
120
121
121
// add FORM name
122
122
Token formName = formKeyword .getNextCodeSibling ();
123
- if (!formName .isIdentifier ())
123
+ if (!formName .isIdentifier ()) // pro forma
124
124
return false ;
125
125
line .setCell (Columns .FORM_NAME .getValue (), new AlignCellToken (formName ));
126
126
@@ -189,15 +189,14 @@ protected boolean executeOn(Code code, Command command, int releaseRestriction)
189
189
if (table .getLineCount () > 1 && line .getCell (Columns .PARAMETER_NAME .getValue ()) == null )
190
190
table .removeLastLine ();
191
191
192
- int basicIndent = command .getFirstToken ().spacesLeft ;
193
192
boolean breakAfterFormName = (table .getLineCount () > configParamCountBehindFormName .getValue ());
194
193
if (breakAfterFormName ) {
195
194
table .getColumn (Columns .FORM_NAME .getValue ()).setForceLineBreakAfter (false );
196
- table .getColumn (Columns .PARAMETER_GROUP .getValue ()).setForceIndent (basicIndent + ABAP .INDENT_STEP );
195
+ table .getColumn (Columns .PARAMETER_GROUP .getValue ()).setForceIndent (ABAP .INDENT_STEP );
197
196
}
198
197
if (!configContinueAfterParamGroupKeyword .getValue ()) {
199
198
table .getColumn (Columns .PARAMETER_GROUP .getValue ()).setForceLineBreakAfter (false );
200
- int paramGroupIndent = basicIndent + (breakAfterFormName ? ABAP .INDENT_STEP : formKeyword .getTextLength () + 1 + formName .getTextLength () + 1 );
199
+ int paramGroupIndent = (breakAfterFormName ? ABAP .INDENT_STEP : formKeyword .getTextLength () + 1 + formName .getTextLength () + 1 );
201
200
table .getColumn (Columns .PARAMETER_NAME .getValue ()).setForceIndent (paramGroupIndent + ABAP .INDENT_STEP );
202
201
}
203
202
if (!configAlignTypes .getValue ()) {
@@ -208,6 +207,7 @@ protected boolean executeOn(Code code, Command command, int releaseRestriction)
208
207
}
209
208
}
210
209
210
+ int basicIndent = command .getFirstToken ().spacesLeft ;
211
211
int firstLineBreaks = command .getFirstToken ().lineBreaks ;
212
212
Command [] changedCommands = table .align (basicIndent , firstLineBreaks , false , true );
213
213
for (Command changedCommand : changedCommands ) {
0 commit comments