-
Notifications
You must be signed in to change notification settings - Fork 459
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
Add support for Eclipse Clean Up #292
Comments
The But you are right, the JDT Clean-Up would be useful. I added the clean-up tasks already for Eclipse-WTP as far as supported. Should be no problem to add it for JDT as well. |
@JamieMagee Don't know when I'll find time. If you want to do it yourself, I am happy to assist. |
I'm all for it, but I see some potential hangups, e.g. |
Is there any progress on this? |
@HoldYourWaffle I am afraid I still have no time. But I am always happy to assist if you volunteer to implement it. |
@fvgh I'd happily volunteer, but I just don't know enough (basically none) about the eclipse platform or the internals of spotless to implement it. |
@HoldYourWaffle The Eclipse formatter is part of the We obtain the Eclispe JDT parts from MavenCentral. I expect Clean-Up to be part of the JDT core code, so the current setup of the spotless-eclipse-jdt should be sufficient for this task. I always use Eclipse for coding, but since you don't need to care about the Eclipse plugins and the OSGI layer, InelliJ should also work fine. Since MavenCentral also provides the Java source bundles for JDT, debugging your code should not be problematic. All Spotless Eclipse formatter basically just do the following:
Don't worry too much about the underlying Eclipse framework. I think the the current SpotlessEclipseFramwork setup should be sufficient. Eclipse uses OSGI and JDT is just a plugin. Since we don't want the full Eclipse environment, our framework just stubs out most of the Eclipse framework functionality. So in the end you just have to find the JDT method for the clean-up and how to configure it. Add the configuration to the Afterwards we can talk about remaining issues (documentation, default configuration, ...). As Ned pointed out, not all clean-up functionality can work with Spotless, since Spotless only knows the content of a single file and not the project structure. Hence some configuration option must be suppressed. |
Provided first POC showing the import organization. The |
VERY cool!! |
Another +1 for this functionality. This would be super helpful for us. |
+1 from me as well! This would really take Spotless to the next level! |
+1 |
The Eclipse CleanUp work is being revived in #1587, following the effort from @fvgh . In the meantime, one can find some related Java refactoring through Cleanthat (https://github.com/diffplug/spotless/blob/main/lib/src/main/java/com/diffplug/spotless/java/CleanthatJavaStep.java) |
+1 This would still take Spotless to the next level! Are there any updates? |
From my understanding Spotless uses
org.eclipse.jdt:org.eclipse.jdt.core
to do formatting with Eclipse. Currently this only provides whitespace changes, but Eclipse itself also hasClean Up
which makes code changes. I think this functionality is provided by theorg.eclipse.jdt:org.eclipse.jdt.ui
package. Would it be possible to also add this functionality to Spotless?The text was updated successfully, but these errors were encountered: