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 ActionOnSave #33

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

oraum
Copy link

@oraum oraum commented May 12, 2022

  • add configuration to save whether action on save is enabled
  • add actiononsave triggered on save of documents
  • add infoprovider to show option in settings

Heavily inspired by Jetbrains prettierJS plugin

resolves #8

Copy link
Owner

@ragurney ragurney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @oraum, thanks so much for the PR! I have a couple of nit-pick comments, and also we will need to bump the plugin version in this PR as well.

The main blocker for this is that during manual testing I found it doesn't handle processing multiple files on save. It only formats the first file that is open, but errors out on the second.
See this for repro steps.

I haven't had the chance to dig into this too much, but made a post here so hopefully we'll get an answer there on how to resolve this.

Copy link
Owner

@ragurney ragurney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good @oraum, thanks a lot!

I think the only blocker at this point is the resolution to the issue I mentioned with saving multiple files in this comment.

I've asked IntelliJ what the proper fix for this is here, and hopefully we'll get an answer soon! It looks like they're saying to use the external formatter hook, but that would be a completely separate project as far as I understand it.

@ragurney
Copy link
Owner

ragurney commented Jun 2, 2022

I think this is blocked until either diffplug/spotless#791 is implemented and merged or we change this PR to only support format on save for the current file only due to the lack of gradle support to run multiple builds in parallel.

@pr11me
Copy link

pr11me commented Apr 17, 2024

Hey guys, thanks for the work so far :) What is the status of this PR, looks "abandoned"?
I think, the ability to format on save the current file only is already quite useful because this is the main use case for this Action on Save anyway. For formatting several files/the whole project one can rely on Gradle (making spotlessApply part of the build chain and/or using a pre-commit hook). The main benefit of the Action on Save for me is being able to write stuff without paying attention to format and then it's tidied up during a thinking pause, thus keeping the code I am working on readable :)
What is missing in the PR besides the conflicts? Maybe I could finish it.

@ErtugrulSener
Copy link

ErtugrulSener commented May 31, 2024

I think this is blocked until either diffplug/spotless#791 is implemented and merged or we change this PR to only support format on save for the current file only due to the lack of gradle support to run multiple builds in parallel.

Hey. Could we just re-label this PR and run spotless for the currently opened file? This would already solve a lot.

@fokkoru
Copy link

fokkoru commented Sep 27, 2024

Any updates on this?

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

Successfully merging this pull request may close these issues.

Add a Reformat Code with Spotless Action on Save Setting
5 participants