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

Some Improvement #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Some Improvement #49

wants to merge 1 commit into from

Conversation

b0c1
Copy link

@b0c1 b0c1 commented Jan 31, 2023

  • Add commit handler to format all documents when push
  • Add editor context menu to format current file
  • Add VCS change list context menu to format multiple files

- [x] Added Reformat multiple files in VCS context menu
- [x] Add editor context menu
@ragurney
Copy link
Owner

ragurney commented Feb 2, 2023

Thanks for the contribution @b0c1, I'll review in the next couple of days. Would you mind posting some screenshots of any UI changes for future reference?

Also, I just added Spotless to this project. Could you run ./gradlew spotlessApply so we can format your changes to match the rest of the project?

PsiManager manager = PsiManager.getInstance(project);
Stream
.concat(getExactlySelectedFiles(manager, event).stream(), selectedChangesetFiles(manager, event).stream())
.forEach(file -> new ReformatCodeProcessor(file, false).run());
Copy link
Owner

Choose a reason for hiding this comment

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

Unfortunately, this does not work since we can only run one gradle process at a time on a project. If you try to run this with multiple files, you will see an error such as:
image.

This is the same issue that #33 ran into. In order for this to be fixed and for me to accept this change, we'll need to implement or push for some progress on diffplug/spotless#791.

Another alternative is to switch over to using IntelliJ's External Formatter API which I attempt to do in this branch, but this would drastically change the UX of the plugin, and I was running into some multithreading issues :(

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.

None yet

2 participants