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

Add a Reformat Code with Spotless Action on Save Setting #8

Open
ragurney opened this issue Jan 1, 2022 · 8 comments · May be fixed by #33
Open

Add a Reformat Code with Spotless Action on Save Setting #8

ragurney opened this issue Jan 1, 2022 · 8 comments · May be fixed by #33

Comments

@ragurney
Copy link
Owner

ragurney commented Jan 1, 2022

This entails:

  • Adding UI elements and implementing functionality for allowing the enable/disable of Reformat Code with Spotless on save
@ragurney ragurney self-assigned this Jan 1, 2022
@ragurney ragurney changed the title Run Reformat Code with Spotless Action on Save Add a Reformat Code with Spotless Action on Save Setting Jan 1, 2022
@ragurney ragurney removed their assignment Jan 21, 2022
@simonbasle
Copy link

Since IntelliJ 2021.2 Jetbrains added support for Actions on Save under Preferences/Settings | Tools | Actions on Save. I wonder if plugins can contribute to that list of actions 🤔

@ragurney
Copy link
Owner Author

I'll have to look into it! I'm still stuck on v2021.1 at work unfortunately so I would like to make something that works for at least that version as well

@ln-12
Copy link

ln-12 commented Feb 24, 2022

Maybe this plugin might be helpful to look at: https://github.com/dubreuia/intellij-plugin-save-actions

@melissachang
Copy link

melissachang commented Mar 10, 2022

I was able to use File Watchers to run ./gradlew spotlessApply on save. Need to install File Watchers plugin. You can run any command. Note - Needs to be configured for every repo.

image

@ragurney
Copy link
Owner Author

Thanks @ln-12 and @melissachang! Yes there are a couple plugins you can use in concert with this plugin to get format on save -- save actions is one I've been currently using. I would love to make this a bundled feature in this plugin though. I'm currently quite busy getting ready to move across the country but will try to get to implementing this in the near future.

@oraum
Copy link

oraum commented May 7, 2022

There are extensionpoints (ActionOnSave and ActionOnSaveInfoProvider) which can be used PlatformExtensionPoints

@ragurney
Copy link
Owner Author

ragurney commented May 9, 2022

Thanks @oraum! I've been dealing with a crosss-country move so haven't had time to invest into this yet. I'd be happy to accept a PR for this, or can likely work on it myself in the next month or so.

@oraum oraum linked a pull request May 12, 2022 that will close this issue
@ErtugrulSener
Copy link

Any updates on this topic?
It is the main reason people use formatters, they want to see the formatted code.

And there is no plugin for intellij yet, using the OnActionSave extension point for spotless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants