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

Question: Clean-Up Interactive Mode without changing the class? #114

Closed
ZEAL-IT opened this issue Sep 26, 2023 · 11 comments
Closed

Question: Clean-Up Interactive Mode without changing the class? #114

ZEAL-IT opened this issue Sep 26, 2023 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@ZEAL-IT
Copy link

ZEAL-IT commented Sep 26, 2023

Hello,
while I introduced this great functionality to some colleagues, I noticed that even when trying to jump into interactive mode I'm already changing the class, therefore I must be added to the transport request. We want to use the cleaner in Code Reviews, so I would like to see how much the cleaner finds, but in a "read only" mode if that makes sense?
What do you think?

@jelliottp
Copy link

This is a good idea. I've often wanted to do something similar, to check whether another developer has run the cleanup.

@jmgrassau
Copy link
Member

Hi ZEAL-IT and Josh,

that's indeed a good point – ABAP cleaner starts a "rewrite session" when opening the interactive cleanup, which prevents other people from changing the object in the meantime.

A "read only" mode would also be beneficial when looking at legacy code (or any code in non-development systems) which you can't or won't change at that moment: With the cleanup rules applied, the code might simply be easier to read and understand.

So, yes, very nice idea – I'd only hesitate a bit about adding another menu item (and shortcut?) for it.

For the time being, a quick workaround would be to install the stand-alone version in parallel: You can paste any amount of ABAP code into that just via clipboard, as long as blocks like IF ... ENDIF are complete (see usage). Both the stand-alone version and the ADT plug-in share the same profile settings etc., which are saved on the local machine.

Kind regards,
Jörg-Michael

@jmgrassau jmgrassau added the enhancement New feature or request label Sep 26, 2023
@ZEAL-IT
Copy link
Author

ZEAL-IT commented Sep 26, 2023

This is a good idea. I've often wanted to do something similar, to check whether another developer has run the cleanup.

That would be a cool feature too. The code pal would insert a line at the beginning with a checksum or something and an ATC check can check if the comment exists and the checksum is correct

@ZEAL-IT
Copy link
Author

ZEAL-IT commented Sep 26, 2023

Hi ZEAL-IT and Josh,

that's indeed a good point – ABAP cleaner starts a "rewrite session" when opening the interactive cleanup, which prevents other people from changing the object in the meantime.

A "read only" mode would also be beneficial when looking at legacy code (or any code in non-development systems) which you can't or won't change at that moment: With the cleanup rules applied, the code might simply be easier to read and understand.

So, yes, very nice idea – I'd only hesitate a bit about adding another menu item (and shortcut?) for it.

For the time being, a quick workaround would be to install the stand-alone version in parallel: You can paste any amount of ABAP code into that just via clipboard, as long as blocks like IF ... ENDIF are complete (see usage). Both the stand-alone version and the ADT plug-in share the same profile settings etc., which are saved on the local machine.

Kind regards, Jörg-Michael

Haven't thought of the standalone version, thank you! I guess you can't tell if the class is already locked (in that case the edit mode would be fine) or if the class is in read only mode (which it is in Eclipse until you change something)

@vonglan
Copy link

vonglan commented Sep 29, 2023

+1 (to the general idea of a read-only, not locking mode)

@jmgrassau jmgrassau self-assigned this Oct 1, 2023
@jmgrassau
Copy link
Member

Hi ZEAL-IT, Josh and Edo,

with the next ABAP cleaner release, there will now be a third menu item (hope the menu text + shortcut are intuitive?)

image

This opens the interactive window without locking the object, so you can also call it if someone else locked the object, or you don't have a transport, or you're in the wrong client, or you don't even have development authorization in the system.

Inside the ABAP cleaner UI, everything is exactly the same, except that you don't have the "Apply and Close" button and menu, but instead, you only have

image
and
image

So whatever you do inside the ABAP cleaner UI, the code in the ADT editor will not be affected. You can nevertheless change ABAP cleaner configuration (selected profile, restriction to ABAP release, activation of rules, rule options etc.) just as you would in the interactive cleanup, and these changes are kept.

Another small improvement is that the window title now also shows the ABAP release of the system in which the code editor was opened:

image

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

jmgrassau commented Oct 1, 2023

P.S.: If you have better suggestions for "Preview as Read-Only With ABAP Cleaner…", please let me know. "Show Read-Only Preview of Cleanup With ABAP Cleaner…" would be more precise, but that would be a bit long. I also considered "Preview (Read-Only) With ABAP Cleaner…", but the parentheses look a bit awkward in the menu.

Regarding the shortcut, Ctrl+5 would probably also be available, but since this opens the UI, I felt that it is better to have a shortcut that is similar to Ctrl+Shift+4. Anyway, everybody could configure this as needed – and I know, on certain macOS releases, both Ctrl+Shift+4 and Ctrl+Shift+5 are reserved by the system for screenshot(?) functionality.

@ZEAL-IT
Copy link
Author

ZEAL-IT commented Oct 2, 2023

Hi Jörg-Michael,
that is awesome, thank you! For the text I think just "Preview with ABAP Cleaner" is enough, but yours works too for sure. I agree with the shortcut, it should be Ctrl+Shift and the 5 just makes sense

@jmgrassau
Copy link
Member

Hi ZEAL-IT,

thanks a lot! I actually changed the menu text again to "Show Read-Only Preview With ABAP Cleaner…", because I felt "Preview as Read-Only" sounded a bit awkward (but I'm obviously not a native speaker).

Anyway, I somehow wanted to have "Read-Only" in the text in order to point out the difference to the interactive cleanup – which could of course also be used as a preview, if you close it with "Cancel".

Release process is on its way now, so this will be available very soon :-)

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi ZEAL-IT,

thanks again for this great idea! This is now available with version 1.6.0, which was just released!

Kind regards,
Jörg-Michael

@JoachimRees
Copy link

This all makes a lot of sense, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants