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: Support Eclipse "Source Clean Up" actions #1626

Open
ghokun opened this issue Sep 18, 2020 · 7 comments
Open

Feature Request: Support Eclipse "Source Clean Up" actions #1626

ghokun opened this issue Sep 18, 2020 · 7 comments

Comments

@ghokun
Copy link
Contributor

ghokun commented Sep 18, 2020

Eclipse provides a feature called Clean up (Right click a source folder: Source -> Clean Up). Clean up profile can be defined from
Preferences -> Java -> Code Style -> Clean Up. Clean up profiles can be exported to an xml file.

Screenshot_2020-09-18_11-00-04

Like format settings, clean up settings could be set up with an xml file.

{
    "java.format.settings.url": "...",
    "java.cleanup.settings.url" : "..."
}

Also, I would like to contribute to this issue, if someone points me to the right direction.

mentioned in #1379

@xtianus79
Copy link

@jdneo and @testforstephen is there any update on this a year later?

@chriscasola
Copy link

I am interested in this feature as well - any update? Or pointers on how to contribute?

@jcolladosp
Copy link

Hi guys, do you know if there's any update on this?
Thanks

@gayanper
Copy link
Contributor

Anything stopping this enhancement? I see most of cleanup implementation doesn’t have ui component dependencies. Could we move those in jdt ui like we have done for type hierarchy?

or are we looking at handling this in a different way for vscode ? Like having individual cleanup as code actions?

@testforstephen @jdneo @rgrunber

@testforstephen
Copy link
Collaborator

Assign to @rgrunber since his team is working on this area recently.

@rgrunber
Copy link
Member

We started doing this through the new setting java.cleanup.actionsOnSave (through https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/cleanup/CleanUpRegistry.java in JDT-LS). Currently supported ones are https://github.com/redhat-developer/vscode-java/blob/master/document/_java.learnMoreAboutCleanUps.md#java-clean-ups .

Any from the following list could be supported though :
AbstractCleanupCore

Might be best to prioritize the more interesting ones.

They could probably be added to the "Source Action" menu with just a few lines of code. In order to get them as code actions (quick assists), the cleanup would need to have some helper method to have it apply on an individual ASTNode as opposed to on the entire CompilationUnit, but that should be possible.

@blacelle
Copy link

blacelle commented Apr 6, 2023

Hello. I've tried integrating Eclipse CleanUp into Spotless (diffplug/spotless#1587) but there is still quite a long way to go. I feel some effort would be shared with the one in vscode-java.

Concurrently, you may wish to have a look into Cleanthat which offers a various list of similar CleanUp rules (Mutators).

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

8 participants