-
Notifications
You must be signed in to change notification settings - Fork 51
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
Comments - again :-/ #395
Comments
Hi Vlad, thanks for those examples! (By the way: when creating an issue, you can simply use Ctrl+V to paste a screenshot to GitHub, no need to refer to an external dropbox location! On Windows, I meanwhile use the shortcut Win+Shift+S a lot for screenshots). I tried to create a minimal example for this: TYPES:
BEGIN OF ty_s_any_struc, " comment 1
any_integer TYPE i, " comment 2
name TYPE string, " comment 3
END OF ty_s_any_struc.
DATA:
lo_any_ref TYPE REF TO cl_any_class_name,
lt_any_table_name TYPE TABLE OF string, " comment A
lt_other_table_name TYPE STANDARD TABLE OF ty_s_any_struc. " comment B Things happen in cleanup rule "Align declarations": With the "comment 2" that I added, you can see that the rule does align the comments at the end of the declarations, but the Regarding comment A+B, this is clearly a bug, and interestingly, the result is different without the first declaration: Will look into it! Regarding cursor position, what setting do you use in the main window -> Cleanup Settings -> Default cleanup range? I assume 'Current command', which would explain why only some code gets changed, depending on cursor position. If you use the ADT menu "Clean Up With Interactive ABAP Cleaner…", you can see which line range your cursor position is expanded to (everything else gets grayed out and simply won't be changed): Kind regards, |
Hi Jörg-Michael, Thanks for the quick reply! Re Dropbox-links vs pasted for screenshots: I pasted them first, but they didn't appear in the published issue, so I edited the issue and changed it to Dropbox-links afterwards. I'll paste one more screenshot and hope for the best;-) Re "comment 2" on the BEGIN OF: It would be great if you could change it. Re Default cleanup range in Cleanup Settings: It is actually "Current method etc." Thanks again! Regards, |
Hi Vlad, I meanwhile found out that the alignment issue in the DATA section happened because DATA … TYPE … TABLE statements are only aligned up to the TYPE keyword. Otherwise, this code … DATA lv_pi TYPE p LENGTH 10 DECIMALS 10 VALUE '3.1415926536'.
DATA lv_e TYPE p LENGTH 8 DECIMALS 10 VALUE '2.718281828'.
DATA lt_table TYPE STANDARD TABLE OF ty_s_any_struc WITH DEFAULT KEY. … would be aligned as … DATA lv_pi TYPE p LENGTH 10 DECIMALS 10 VALUE '3.1415926536'.
DATA lv_e TYPE p LENGTH 8 DECIMALS 10 VALUE '2.718281828'.
DATA lt_table TYPE STANDARD TABLE OF ty_s_any_struc WITH DEFAULT KEY. … because the TYPE 'column' is so wide. With that, however, the 'line-end comment column' cannot be properly aligned, either. Therefore, all I could do for now is to exclude line-end comments after 'TYPE … TABLE' from alignment. This means that ABAP cleaner will not actively align them, but on the other hand, it will no more mess up manual alignment here. Hope that's fine. Again, a general solution as mentioned in #291 could help. Will still look into line-end comments after BEGIN OF! Kind regards, |
Hi Jörg-Michael, hmmm... I think I see it a little bit differently, because the formatting in the DATA part is:
I even go so far as to say that a slight change ONLY for the comments, not for the rest of the declarations, would solve it: left-align the comments according to the widest line in the block of the DATA-declarations. What do you think? Regards, |
Hello
and a happy new year to you all!
I must re-address the issue of formatting the comments (see also my initial gripe with it in the Issue #291 here).
My problem: Depending on where exactly the cursor is when I start the ABAP Cleaner the results of the formatting are different and in some case maddening ;-)
Here comes my example.
I have an include with global declarations.
When I position the cursor in the line 4 the result after ABAP Cleaner looks like this.
This is what I expected, everything is ok.
Placing the cursor in line 14 produce this result (the changed comment is in the line 16).
Hmmm…
And - God forbid! ;-) - when the cursor is in line 38 the comments... well, they go as wild as back in April 2024 when I first address this issue (the changed comments are in the lines 41 and 42).
Now that I know how ABAP Cleaner reacts depending on the position of the cursor I developed a sort of muscle memory in order to activate this workaround and get the expected results.
However it still hits me once in a while when I forget :-D and damn is that annoying! ;-)
Since there is some logic in this madness don't you think that there could be a solution somehow?
Thanks!
Regards,
Vlad
The text was updated successfully, but these errors were encountered: